EMMA Coverage Report (generated Fri Aug 23 16:39:17 PDT 2013)
[all classes][org.chromium.content_shell]

COVERAGE SUMMARY FOR SOURCE FILE [ShellManager.java]

nameclass, %method, %block, %line, %
ShellManager.java100% (2/2)93%  (14/15)94%  (136/145)92%  (35/38)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ShellManager100% (1/1)92%  (12/13)93%  (116/125)91%  (31/34)
getWindow (): WindowAndroid 0%   (0/1)0%   (0/3)0%   (0/1)
createShell (): Object 100% (1/1)88%  (46/52)83%  (10/12)
<static initializer> 100% (1/1)100% (3/3)100% (1/1)
ShellManager (Context, AttributeSet): void 100% (1/1)100% (17/17)100% (5/5)
access$000 (): boolean 100% (1/1)100% (2/2)100% (1/1)
access$002 (boolean): boolean 100% (1/1)100% (4/4)100% (1/1)
access$100 (ShellManager): String 100% (1/1)100% (3/3)100% (1/1)
access$200 (ShellManager): Shell 100% (1/1)100% (3/3)100% (1/1)
closeShell (Shell): void 100% (1/1)100% (24/24)100% (7/7)
getActiveShell (): Shell 100% (1/1)100% (3/3)100% (1/1)
launchShell (String): void 100% (1/1)100% (3/3)100% (2/2)
setStartupUrl (String): void 100% (1/1)100% (4/4)100% (2/2)
setWindow (WindowAndroid): void 100% (1/1)100% (4/4)100% (2/2)
     
class ShellManager$1100% (1/1)100% (2/2)100% (20/20)100% (5/5)
ShellManager$1 (ShellManager, Context): void 100% (1/1)100% (7/7)100% (1/1)
onReadyToRender (): void 100% (1/1)100% (13/13)100% (4/4)

1// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4 
5package org.chromium.content_shell;
6 
7import android.content.Context;
8import android.util.AttributeSet;
9import android.view.LayoutInflater;
10import android.widget.FrameLayout;
11 
12import org.chromium.base.CalledByNative;
13import org.chromium.base.JNINamespace;
14import org.chromium.content.browser.ContentView;
15import org.chromium.content.browser.ContentViewRenderView;
16import org.chromium.ui.WindowAndroid;
17 
18/**
19 * Container and generator of ShellViews.
20 */
21@JNINamespace("content")
22public class ShellManager extends FrameLayout {
23 
24    public static final String DEFAULT_SHELL_URL = "http://www.google.com";
25    private static boolean sStartup = true;
26    private WindowAndroid mWindow;
27    private Shell mActiveShell;
28 
29    private String mStartupUrl = DEFAULT_SHELL_URL;
30 
31    // The target for all content rendering.
32    private ContentViewRenderView mContentViewRenderView;
33 
34    /**
35     * Constructor for inflating via XML.
36     */
37    public ShellManager(Context context, AttributeSet attrs) {
38        super(context, attrs);
39        nativeInit(this);
40        mContentViewRenderView = new ContentViewRenderView(context) {
41            @Override
42            protected void onReadyToRender() {
43                if (sStartup) {
44                    mActiveShell.loadUrl(mStartupUrl);
45                    sStartup = false;
46                }
47            }
48        };
49    }
50 
51    /**
52     * @param window The window used to generate all shells.
53     */
54    public void setWindow(WindowAndroid window) {
55        mWindow = window;
56    }
57 
58    /**
59     * @return The window used to generate all shells.
60     */
61    public WindowAndroid getWindow() {
62        return mWindow;
63    }
64 
65    /**
66     * Sets the startup URL for new shell windows.
67     */
68    public void setStartupUrl(String url) {
69        mStartupUrl = url;
70    }
71 
72    /**
73     * @return The currently visible shell view or null if one is not showing.
74     */
75    public Shell getActiveShell() {
76        return mActiveShell;
77    }
78 
79    /**
80     * Creates a new shell pointing to the specified URL.
81     * @param url The URL the shell should load upon creation.
82     */
83    public void launchShell(String url) {
84        nativeLaunchShell(url);
85    }
86 
87    @SuppressWarnings("unused")
88    @CalledByNative
89    private Object createShell() {
90        LayoutInflater inflater =
91                (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
92        Shell shellView = (Shell) inflater.inflate(R.layout.shell_view, null);
93        shellView.setWindow(mWindow);
94 
95        if (mActiveShell != null) closeShell(mActiveShell);
96 
97        shellView.setContentViewRenderView(mContentViewRenderView);
98        addView(shellView, new FrameLayout.LayoutParams(
99                FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT));
100        mActiveShell = shellView;
101        ContentView contentView = mActiveShell.getContentView();
102        if (contentView != null) {
103            mContentViewRenderView.setCurrentContentView(contentView);
104            contentView.onShow();
105        }
106 
107        return shellView;
108    }
109 
110    @SuppressWarnings("unused")
111    @CalledByNative
112    private void closeShell(Shell shellView) {
113        if (shellView == mActiveShell) mActiveShell = null;
114        ContentView contentView = shellView.getContentView();
115        if (contentView != null) contentView.onHide();
116        shellView.setContentViewRenderView(null);
117        shellView.setWindow(null);
118        removeView(shellView);
119    }
120 
121    private static native void nativeInit(Object shellManagerInstance);
122    private static native void nativeLaunchShell(String url);
123}

[all classes][org.chromium.content_shell]
EMMA 2.0.5312 (C) Vladimir Roubtsov