Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Side by Side Diff: content/shell/android/java/src/org/chromium/content_shell/ShellManager.java

Issue 2827263006: Revert "Refactor ContentViewClient (6/6)" (Closed)
Patch Set: Revert "Let ImeAdapterAndroid have the same lifecycle as its Java peer" Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.content_shell; 5 package org.chromium.content_shell;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.util.AttributeSet; 8 import android.util.AttributeSet;
9 import android.view.LayoutInflater; 9 import android.view.LayoutInflater;
10 import android.widget.FrameLayout; 10 import android.widget.FrameLayout;
11 11
12 import org.chromium.base.ThreadUtils; 12 import org.chromium.base.ThreadUtils;
13 import org.chromium.base.annotations.CalledByNative; 13 import org.chromium.base.annotations.CalledByNative;
14 import org.chromium.base.annotations.JNINamespace; 14 import org.chromium.base.annotations.JNINamespace;
15 import org.chromium.content.browser.ContentViewClient;
15 import org.chromium.content.browser.ContentViewCore; 16 import org.chromium.content.browser.ContentViewCore;
16 import org.chromium.content.browser.ContentViewRenderView; 17 import org.chromium.content.browser.ContentViewRenderView;
17 import org.chromium.ui.base.WindowAndroid; 18 import org.chromium.ui.base.WindowAndroid;
18 19
19 /** 20 /**
20 * Container and generator of ShellViews. 21 * Container and generator of ShellViews.
21 */ 22 */
22 @JNINamespace("content") 23 @JNINamespace("content")
23 public class ShellManager extends FrameLayout { 24 public class ShellManager extends FrameLayout {
24 25
25 public static final String DEFAULT_SHELL_URL = "http://www.google.com"; 26 public static final String DEFAULT_SHELL_URL = "http://www.google.com";
26 private WindowAndroid mWindow; 27 private WindowAndroid mWindow;
27 private Shell mActiveShell; 28 private Shell mActiveShell;
28 29
29 private String mStartupUrl = DEFAULT_SHELL_URL; 30 private String mStartupUrl = DEFAULT_SHELL_URL;
30 31
31 // The target for all content rendering. 32 // The target for all content rendering.
32 private ContentViewRenderView mContentViewRenderView; 33 private ContentViewRenderView mContentViewRenderView;
34 private final ContentViewClient mContentViewClient = new ContentViewClient() ;
33 35
34 /** 36 /**
35 * Constructor for inflating via XML. 37 * Constructor for inflating via XML.
36 */ 38 */
37 public ShellManager(final Context context, AttributeSet attrs) { 39 public ShellManager(final Context context, AttributeSet attrs) {
38 super(context, attrs); 40 super(context, attrs);
39 nativeInit(this); 41 nativeInit(this);
40 } 42 }
41 43
42 /** 44 /**
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 mContentViewRenderView.setOverlayVideoMode(enabled); 99 mContentViewRenderView.setOverlayVideoMode(enabled);
98 } 100 }
99 101
100 @SuppressWarnings("unused") 102 @SuppressWarnings("unused")
101 @CalledByNative 103 @CalledByNative
102 private Object createShell(long nativeShellPtr) { 104 private Object createShell(long nativeShellPtr) {
103 assert mContentViewRenderView != null; 105 assert mContentViewRenderView != null;
104 LayoutInflater inflater = 106 LayoutInflater inflater =
105 (LayoutInflater) getContext().getSystemService(Context.LAYOUT_IN FLATER_SERVICE); 107 (LayoutInflater) getContext().getSystemService(Context.LAYOUT_IN FLATER_SERVICE);
106 Shell shellView = (Shell) inflater.inflate(R.layout.shell_view, null); 108 Shell shellView = (Shell) inflater.inflate(R.layout.shell_view, null);
107 shellView.initialize(nativeShellPtr, mWindow); 109 shellView.initialize(nativeShellPtr, mWindow, mContentViewClient);
108 110
109 // TODO(tedchoc): Allow switching back to these inactive shells. 111 // TODO(tedchoc): Allow switching back to these inactive shells.
110 if (mActiveShell != null) removeShell(mActiveShell); 112 if (mActiveShell != null) removeShell(mActiveShell);
111 113
112 showShell(shellView); 114 showShell(shellView);
113 return shellView; 115 return shellView;
114 } 116 }
115 117
116 private void showShell(Shell shellView) { 118 private void showShell(Shell shellView) {
117 shellView.setContentViewRenderView(mContentViewRenderView); 119 shellView.setContentViewRenderView(mContentViewRenderView);
(...skipping 23 matching lines...) Expand all
141 public void destroy() { 143 public void destroy() {
142 // Remove active shell (Currently single shell support only available). 144 // Remove active shell (Currently single shell support only available).
143 removeShell(mActiveShell); 145 removeShell(mActiveShell);
144 mContentViewRenderView.destroy(); 146 mContentViewRenderView.destroy();
145 mContentViewRenderView = null; 147 mContentViewRenderView = null;
146 } 148 }
147 149
148 private static native void nativeInit(Object shellManagerInstance); 150 private static native void nativeInit(Object shellManagerInstance);
149 private static native void nativeLaunchShell(String url); 151 private static native void nativeLaunchShell(String url);
150 } 152 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698