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

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

Issue 14977010: Android: implement content::Shell::Close() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/shell/android/shell_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 85 }
86 86
87 @SuppressWarnings("unused") 87 @SuppressWarnings("unused")
88 @CalledByNative 88 @CalledByNative
89 private Object createShell() { 89 private Object createShell() {
90 LayoutInflater inflater = 90 LayoutInflater inflater =
91 (LayoutInflater) getContext().getSystemService(Context.LAYOUT_IN FLATER_SERVICE); 91 (LayoutInflater) getContext().getSystemService(Context.LAYOUT_IN FLATER_SERVICE);
92 Shell shellView = (Shell) inflater.inflate(R.layout.shell_view, null); 92 Shell shellView = (Shell) inflater.inflate(R.layout.shell_view, null);
93 shellView.setWindow(mWindow); 93 shellView.setWindow(mWindow);
94 94
95 removeAllViews(); 95 if (mActiveShell != null) closeShell(mActiveShell);
96 if (mActiveShell != null) {
97 ContentView contentView = mActiveShell.getContentView();
98 if (contentView != null) contentView.onHide();
99 mActiveShell.setContentViewRenderView(null);
100 }
101 96
102 shellView.setContentViewRenderView(mContentViewRenderView); 97 shellView.setContentViewRenderView(mContentViewRenderView);
103 addView(shellView, new FrameLayout.LayoutParams( 98 addView(shellView, new FrameLayout.LayoutParams(
104 FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams. MATCH_PARENT)); 99 FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams. MATCH_PARENT));
105 mActiveShell = shellView; 100 mActiveShell = shellView;
106 ContentView contentView = mActiveShell.getContentView(); 101 ContentView contentView = mActiveShell.getContentView();
107 if (contentView != null) { 102 if (contentView != null) {
108 mContentViewRenderView.setCurrentContentView(contentView); 103 mContentViewRenderView.setCurrentContentView(contentView);
109 contentView.onShow(); 104 contentView.onShow();
110 } 105 }
111 106
112 return shellView; 107 return shellView;
113 } 108 }
114 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
115 private static native void nativeInit(Object shellManagerInstance); 121 private static native void nativeInit(Object shellManagerInstance);
116 private static native void nativeLaunchShell(String url); 122 private static native void nativeLaunchShell(String url);
117 } 123 }
OLDNEW
« no previous file with comments | « no previous file | content/shell/android/shell_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698