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.inputmethod.EditorInfo; | 13 import android.view.inputmethod.EditorInfo; |
14 import android.view.inputmethod.InputMethodManager; | 14 import android.view.inputmethod.InputMethodManager; |
15 import android.widget.EditText; | 15 import android.widget.EditText; |
16 import android.widget.FrameLayout; | 16 import android.widget.FrameLayout; |
17 import android.widget.ImageButton; | 17 import android.widget.ImageButton; |
18 import android.widget.LinearLayout; | 18 import android.widget.LinearLayout; |
19 import android.widget.TextView; | 19 import android.widget.TextView; |
20 import android.widget.TextView.OnEditorActionListener; | 20 import android.widget.TextView.OnEditorActionListener; |
21 | 21 |
22 import org.chromium.base.CalledByNative; | 22 import org.chromium.base.CalledByNative; |
23 import org.chromium.base.JNINamespace; | 23 import org.chromium.base.JNINamespace; |
24 import org.chromium.content.browser.ContentView; | 24 import org.chromium.content.browser.ContentView; |
25 import org.chromium.content.browser.ContentViewClient; | 25 import org.chromium.content.browser.ContentViewClient; |
| 26 import org.chromium.content.browser.ContentViewCore; |
26 import org.chromium.content.browser.ContentViewRenderView; | 27 import org.chromium.content.browser.ContentViewRenderView; |
27 import org.chromium.content.browser.LoadUrlParams; | 28 import org.chromium.content.browser.LoadUrlParams; |
28 import org.chromium.ui.base.WindowAndroid; | 29 import org.chromium.ui.base.WindowAndroid; |
29 | 30 |
30 /** | 31 /** |
31 * Container for the various UI components that make up a shell window. | 32 * Container for the various UI components that make up a shell window. |
32 */ | 33 */ |
33 @JNINamespace("content") | 34 @JNINamespace("content") |
34 public class Shell extends LinearLayout { | 35 public class Shell extends LinearLayout { |
35 | 36 |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 private void initFromNativeTabContents(long nativeTabContents) { | 253 private void initFromNativeTabContents(long nativeTabContents) { |
253 mContentView = ContentView.newInstance(getContext(), nativeTabContents,
mWindow); | 254 mContentView = ContentView.newInstance(getContext(), nativeTabContents,
mWindow); |
254 mContentView.setContentViewClient(mContentViewClient); | 255 mContentView.setContentViewClient(mContentViewClient); |
255 if (getParent() != null) mContentView.onShow(); | 256 if (getParent() != null) mContentView.onShow(); |
256 if (mContentView.getUrl() != null) mUrlTextView.setText(mContentView.get
Url()); | 257 if (mContentView.getUrl() != null) mUrlTextView.setText(mContentView.get
Url()); |
257 ((FrameLayout) findViewById(R.id.contentview_holder)).addView(mContentVi
ew, | 258 ((FrameLayout) findViewById(R.id.contentview_holder)).addView(mContentVi
ew, |
258 new FrameLayout.LayoutParams( | 259 new FrameLayout.LayoutParams( |
259 FrameLayout.LayoutParams.MATCH_PARENT, | 260 FrameLayout.LayoutParams.MATCH_PARENT, |
260 FrameLayout.LayoutParams.MATCH_PARENT)); | 261 FrameLayout.LayoutParams.MATCH_PARENT)); |
261 mContentView.requestFocus(); | 262 mContentView.requestFocus(); |
262 mContentViewRenderView.setCurrentContentView(mContentView); | 263 mContentViewRenderView.setCurrentContentViewCore(mContentView.getContent
ViewCore()); |
263 } | 264 } |
264 | 265 |
265 /** | 266 /** |
266 * @return The {@link ContentView} currently shown by this Shell. | 267 * @return The {@link ContentView} currently shown by this Shell. |
267 */ | 268 */ |
268 public ContentView getContentView() { | 269 public ContentView getContentView() { |
269 return mContentView; | 270 return mContentView; |
270 } | 271 } |
271 | 272 |
272 private void setKeyboardVisibilityForUrl(boolean visible) { | 273 private void setKeyboardVisibilityForUrl(boolean visible) { |
273 InputMethodManager imm = (InputMethodManager) getContext().getSystemServ
ice( | 274 InputMethodManager imm = (InputMethodManager) getContext().getSystemServ
ice( |
274 Context.INPUT_METHOD_SERVICE); | 275 Context.INPUT_METHOD_SERVICE); |
275 if (visible) { | 276 if (visible) { |
276 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); | 277 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); |
277 } else { | 278 } else { |
278 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); | 279 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); |
279 } | 280 } |
280 } | 281 } |
281 | 282 |
282 private static native void nativeCloseShell(long shellPtr); | 283 private static native void nativeCloseShell(long shellPtr); |
283 } | 284 } |
OLD | NEW |