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; |
11 import android.view.KeyEvent; | 11 import android.view.KeyEvent; |
12 import android.view.View; | 12 import android.view.View; |
13 import android.view.ViewGroup; | 13 import android.view.ViewGroup; |
14 import android.view.inputmethod.EditorInfo; | 14 import android.view.inputmethod.EditorInfo; |
15 import android.view.inputmethod.InputMethodManager; | 15 import android.view.inputmethod.InputMethodManager; |
16 import android.widget.EditText; | 16 import android.widget.EditText; |
17 import android.widget.FrameLayout; | 17 import android.widget.FrameLayout; |
18 import android.widget.ImageButton; | 18 import android.widget.ImageButton; |
19 import android.widget.LinearLayout; | 19 import android.widget.LinearLayout; |
20 import android.widget.TextView; | 20 import android.widget.TextView; |
21 import android.widget.TextView.OnEditorActionListener; | 21 import android.widget.TextView.OnEditorActionListener; |
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.ContentViewAndroidDelegate; |
26 import org.chromium.content.browser.ContentViewClient; | 27 import org.chromium.content.browser.ContentViewClient; |
27 import org.chromium.content.browser.ContentViewCore; | 28 import org.chromium.content.browser.ContentViewCore; |
28 import org.chromium.content.browser.ContentViewRenderView; | 29 import org.chromium.content.browser.ContentViewRenderView; |
29 import org.chromium.content_public.browser.LoadUrlParams; | 30 import org.chromium.content_public.browser.LoadUrlParams; |
30 import org.chromium.content_public.browser.NavigationController; | 31 import org.chromium.content_public.browser.NavigationController; |
31 import org.chromium.content_public.browser.WebContents; | 32 import org.chromium.content_public.browser.WebContents; |
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. |
(...skipping 245 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 ContentViewAndroidDelegate viewDelegate = new ContentViewAndroidDelegate
(cv); |
| 293 mContentViewCore.initialize(cv, viewDelegate, cv, 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 |