| OLD | NEW |
| 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; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 return shellView; | 115 return shellView; |
| 116 } | 116 } |
| 117 | 117 |
| 118 private void showShell(Shell shellView) { | 118 private void showShell(Shell shellView) { |
| 119 shellView.setContentViewRenderView(mContentViewRenderView); | 119 shellView.setContentViewRenderView(mContentViewRenderView); |
| 120 addView(shellView, new FrameLayout.LayoutParams( | 120 addView(shellView, new FrameLayout.LayoutParams( |
| 121 FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.
MATCH_PARENT)); | 121 FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.
MATCH_PARENT)); |
| 122 mActiveShell = shellView; | 122 mActiveShell = shellView; |
| 123 ContentViewCore contentViewCore = mActiveShell.getContentViewCore(); | 123 ContentViewCore contentViewCore = mActiveShell.getContentViewCore(); |
| 124 if (contentViewCore != null) { | 124 if (contentViewCore != null) { |
| 125 mContentViewRenderView.setCurrentContentViewCore(contentViewCore); | 125 mContentViewRenderView.setCurrentContent(contentViewCore, shellView.
getViewRoot()); |
| 126 contentViewCore.onShow(); | 126 contentViewCore.onShow(); |
| 127 } | 127 } |
| 128 } | 128 } |
| 129 | 129 |
| 130 @CalledByNative | 130 @CalledByNative |
| 131 private void removeShell(Shell shellView) { | 131 private void removeShell(Shell shellView) { |
| 132 if (shellView == mActiveShell) mActiveShell = null; | 132 if (shellView == mActiveShell) mActiveShell = null; |
| 133 if (shellView.getParent() == null) return; | 133 if (shellView.getParent() == null) return; |
| 134 ContentViewCore contentViewCore = shellView.getContentViewCore(); | 134 ContentViewCore contentViewCore = shellView.getContentViewCore(); |
| 135 if (contentViewCore != null) contentViewCore.onHide(); | 135 if (contentViewCore != null) contentViewCore.onHide(); |
| 136 shellView.setContentViewRenderView(null); | 136 shellView.setContentViewRenderView(null); |
| 137 removeView(shellView); | 137 removeView(shellView); |
| 138 } | 138 } |
| 139 | 139 |
| 140 /** | 140 /** |
| 141 * Destroys the Shell manager and associated components. | 141 * Destroys the Shell manager and associated components. |
| 142 */ | 142 */ |
| 143 public void destroy() { | 143 public void destroy() { |
| 144 // Remove active shell (Currently single shell support only available). | 144 // Remove active shell (Currently single shell support only available). |
| 145 removeShell(mActiveShell); | 145 removeShell(mActiveShell); |
| 146 mContentViewRenderView.destroy(); | 146 mContentViewRenderView.destroy(); |
| 147 mContentViewRenderView = null; | 147 mContentViewRenderView = null; |
| 148 } | 148 } |
| 149 | 149 |
| 150 private static native void nativeInit(Object shellManagerInstance); | 150 private static native void nativeInit(Object shellManagerInstance); |
| 151 private static native void nativeLaunchShell(String url); | 151 private static native void nativeLaunchShell(String url); |
| 152 } | 152 } |
| OLD | NEW |