Chromium Code Reviews| 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.app.Activity; | 7 import android.app.Activity; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.graphics.drawable.ClipDrawable; | 9 import android.graphics.drawable.ClipDrawable; |
| 10 import android.text.TextUtils; | 10 import android.text.TextUtils; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 import org.chromium.content.browser.ContentVideoViewEmbedder; | 30 import org.chromium.content.browser.ContentVideoViewEmbedder; |
| 31 import org.chromium.content.browser.ContentView; | 31 import org.chromium.content.browser.ContentView; |
| 32 import org.chromium.content.browser.ContentViewClient; | 32 import org.chromium.content.browser.ContentViewClient; |
| 33 import org.chromium.content.browser.ContentViewCore; | 33 import org.chromium.content.browser.ContentViewCore; |
| 34 import org.chromium.content.browser.ContentViewRenderView; | 34 import org.chromium.content.browser.ContentViewRenderView; |
| 35 import org.chromium.content_public.browser.ActionModeCallbackHelper; | 35 import org.chromium.content_public.browser.ActionModeCallbackHelper; |
| 36 import org.chromium.content_public.browser.LoadUrlParams; | 36 import org.chromium.content_public.browser.LoadUrlParams; |
| 37 import org.chromium.content_public.browser.NavigationController; | 37 import org.chromium.content_public.browser.NavigationController; |
| 38 import org.chromium.content_public.browser.WebContents; | 38 import org.chromium.content_public.browser.WebContents; |
| 39 import org.chromium.ui.base.ViewAndroidDelegate; | 39 import org.chromium.ui.base.ViewAndroidDelegate; |
| 40 import org.chromium.ui.base.ViewRoot; | |
| 40 import org.chromium.ui.base.WindowAndroid; | 41 import org.chromium.ui.base.WindowAndroid; |
| 41 | 42 |
| 42 /** | 43 /** |
| 43 * Container for the various UI components that make up a shell window. | 44 * Container for the various UI components that make up a shell window. |
| 44 */ | 45 */ |
| 45 @JNINamespace("content") | 46 @JNINamespace("content") |
| 46 public class Shell extends LinearLayout { | 47 public class Shell extends LinearLayout { |
| 47 | 48 |
| 48 private static final long COMPLETED_PROGRESS_TIMEOUT_MS = 200; | 49 private static final long COMPLETED_PROGRESS_TIMEOUT_MS = 200; |
| 49 | 50 |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 290 * Initializes the ContentView based on the native tab contents pointer pass ed in. | 291 * Initializes the ContentView based on the native tab contents pointer pass ed in. |
| 291 * @param webContents A {@link WebContents} object. | 292 * @param webContents A {@link WebContents} object. |
| 292 */ | 293 */ |
| 293 @SuppressWarnings("unused") | 294 @SuppressWarnings("unused") |
| 294 @CalledByNative | 295 @CalledByNative |
| 295 private void initFromNativeTabContents(WebContents webContents) { | 296 private void initFromNativeTabContents(WebContents webContents) { |
| 296 Context context = getContext(); | 297 Context context = getContext(); |
| 297 mContentViewCore = new ContentViewCore(context, ""); | 298 mContentViewCore = new ContentViewCore(context, ""); |
| 298 ContentView cv = ContentView.createContentView(context, mContentViewCore ); | 299 ContentView cv = ContentView.createContentView(context, mContentViewCore ); |
| 299 mContentViewCore.initialize(ViewAndroidDelegate.createBasicDelegate(cv), cv, | 300 mContentViewCore.initialize(ViewAndroidDelegate.createBasicDelegate(cv), cv, |
| 300 webContents, mWindow); | 301 webContents, ViewRoot.create(mWindow)); |
|
boliu
2017/01/05 19:09:28
first question is what calls destroy?
Then after
Jinsuk Kim
2017/01/05 22:30:15
Shouldn't it be created where 'content' is created
boliu
2017/01/05 22:39:38
No, except webview. If it weren't for webview, Vie
| |
| 301 mContentViewCore.setActionModeCallback(defaultActionCallback()); | 302 mContentViewCore.setActionModeCallback(defaultActionCallback()); |
| 302 mContentViewCore.setContentViewClient(mContentViewClient); | 303 mContentViewCore.setContentViewClient(mContentViewClient); |
| 303 mWebContents = mContentViewCore.getWebContents(); | 304 mWebContents = mContentViewCore.getWebContents(); |
| 304 mNavigationController = mWebContents.getNavigationController(); | 305 mNavigationController = mWebContents.getNavigationController(); |
| 305 if (getParent() != null) mContentViewCore.onShow(); | 306 if (getParent() != null) mContentViewCore.onShow(); |
| 306 if (mWebContents.getUrl() != null) { | 307 if (mWebContents.getUrl() != null) { |
| 307 mUrlTextView.setText(mWebContents.getUrl()); | 308 mUrlTextView.setText(mWebContents.getUrl()); |
| 308 } | 309 } |
| 309 ((FrameLayout) findViewById(R.id.contentview_holder)).addView(cv, | 310 ((FrameLayout) findViewById(R.id.contentview_holder)).addView(cv, |
| 310 new FrameLayout.LayoutParams( | 311 new FrameLayout.LayoutParams( |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 404 Context.INPUT_METHOD_SERVICE); | 405 Context.INPUT_METHOD_SERVICE); |
| 405 if (visible) { | 406 if (visible) { |
| 406 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); | 407 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); |
| 407 } else { | 408 } else { |
| 408 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); | 409 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); |
| 409 } | 410 } |
| 410 } | 411 } |
| 411 | 412 |
| 412 private static native void nativeCloseShell(long shellPtr); | 413 private static native void nativeCloseShell(long shellPtr); |
| 413 } | 414 } |
| OLD | NEW |