| 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.graphics.drawable.ClipDrawable; | 8 import android.graphics.drawable.ClipDrawable; |
| 9 import android.text.TextUtils; | 9 import android.text.TextUtils; |
| 10 import android.util.AttributeSet; | 10 import android.util.AttributeSet; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 import org.chromium.base.annotations.CalledByNative; | 23 import org.chromium.base.annotations.CalledByNative; |
| 24 import org.chromium.base.annotations.JNINamespace; | 24 import org.chromium.base.annotations.JNINamespace; |
| 25 import org.chromium.content.browser.ContentView; | 25 import org.chromium.content.browser.ContentView; |
| 26 import org.chromium.content.browser.ContentViewClient; | 26 import org.chromium.content.browser.ContentViewClient; |
| 27 import org.chromium.content.browser.ContentViewCore; | 27 import org.chromium.content.browser.ContentViewCore; |
| 28 import org.chromium.content.browser.ContentViewRenderView; | 28 import org.chromium.content.browser.ContentViewRenderView; |
| 29 import org.chromium.content_public.browser.LoadUrlParams; | 29 import org.chromium.content_public.browser.LoadUrlParams; |
| 30 import org.chromium.content_public.browser.NavigationController; | 30 import org.chromium.content_public.browser.NavigationController; |
| 31 import org.chromium.content_public.browser.WebContents; | 31 import org.chromium.content_public.browser.WebContents; |
| 32 import org.chromium.ui.base.ViewAndroidDelegate; |
| 32 import org.chromium.ui.base.WindowAndroid; | 33 import org.chromium.ui.base.WindowAndroid; |
| 33 | 34 |
| 34 /** | 35 /** |
| 35 * Container for the various UI components that make up a shell window. | 36 * Container for the various UI components that make up a shell window. |
| 36 */ | 37 */ |
| 37 @JNINamespace("content") | 38 @JNINamespace("content") |
| 38 public class Shell extends LinearLayout { | 39 public class Shell extends LinearLayout { |
| 39 | 40 |
| 40 private static final long COMPLETED_PROGRESS_TIMEOUT_MS = 200; | 41 private static final long COMPLETED_PROGRESS_TIMEOUT_MS = 200; |
| 41 | 42 |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 /** | 282 /** |
| 282 * Initializes the ContentView based on the native tab contents pointer pass
ed in. | 283 * Initializes the ContentView based on the native tab contents pointer pass
ed in. |
| 283 * @param webContents A {@link WebContents} object. | 284 * @param webContents A {@link WebContents} object. |
| 284 */ | 285 */ |
| 285 @SuppressWarnings("unused") | 286 @SuppressWarnings("unused") |
| 286 @CalledByNative | 287 @CalledByNative |
| 287 private void initFromNativeTabContents(WebContents webContents) { | 288 private void initFromNativeTabContents(WebContents webContents) { |
| 288 Context context = getContext(); | 289 Context context = getContext(); |
| 289 mContentViewCore = new ContentViewCore(context); | 290 mContentViewCore = new ContentViewCore(context); |
| 290 ContentView cv = ContentView.createContentView(context, mContentViewCore
); | 291 ContentView cv = ContentView.createContentView(context, mContentViewCore
); |
| 291 mContentViewCore.initialize(cv, cv, webContents, mWindow); | 292 mContentViewCore.initialize(ViewAndroidDelegate.createBasicDelegate(cv),
cv, |
| 293 webContents, mWindow); |
| 292 mContentViewCore.setContentViewClient(mContentViewClient); | 294 mContentViewCore.setContentViewClient(mContentViewClient); |
| 293 mWebContents = mContentViewCore.getWebContents(); | 295 mWebContents = mContentViewCore.getWebContents(); |
| 294 mNavigationController = mWebContents.getNavigationController(); | 296 mNavigationController = mWebContents.getNavigationController(); |
| 295 if (getParent() != null) mContentViewCore.onShow(); | 297 if (getParent() != null) mContentViewCore.onShow(); |
| 296 if (mWebContents.getUrl() != null) { | 298 if (mWebContents.getUrl() != null) { |
| 297 mUrlTextView.setText(mWebContents.getUrl()); | 299 mUrlTextView.setText(mWebContents.getUrl()); |
| 298 } | 300 } |
| 299 ((FrameLayout) findViewById(R.id.contentview_holder)).addView(cv, | 301 ((FrameLayout) findViewById(R.id.contentview_holder)).addView(cv, |
| 300 new FrameLayout.LayoutParams( | 302 new FrameLayout.LayoutParams( |
| 301 FrameLayout.LayoutParams.MATCH_PARENT, | 303 FrameLayout.LayoutParams.MATCH_PARENT, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 Context.INPUT_METHOD_SERVICE); | 347 Context.INPUT_METHOD_SERVICE); |
| 346 if (visible) { | 348 if (visible) { |
| 347 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); | 349 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); |
| 348 } else { | 350 } else { |
| 349 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); | 351 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); |
| 350 } | 352 } |
| 351 } | 353 } |
| 352 | 354 |
| 353 private static native void nativeCloseShell(long shellPtr); | 355 private static native void nativeCloseShell(long shellPtr); |
| 354 } | 356 } |
| OLD | NEW |