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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 | 245 |
246 /** | 246 /** |
247 * Initializes the ContentView based on the native tab contents pointer pass
ed in. | 247 * Initializes the ContentView based on the native tab contents pointer pass
ed in. |
248 * @param nativeTabContents The pointer to the native tab contents object. | 248 * @param nativeTabContents The pointer to the native tab contents object. |
249 */ | 249 */ |
250 @SuppressWarnings("unused") | 250 @SuppressWarnings("unused") |
251 @CalledByNative | 251 @CalledByNative |
252 private void initFromNativeTabContents(long nativeTabContents) { | 252 private void initFromNativeTabContents(long nativeTabContents) { |
253 mContentView = ContentView.newInstance(getContext(), nativeTabContents,
mWindow); | 253 mContentView = ContentView.newInstance(getContext(), nativeTabContents,
mWindow); |
254 mContentView.setContentViewClient(mContentViewClient); | 254 mContentView.setContentViewClient(mContentViewClient); |
| 255 if (getParent() != null) mContentView.onShow(); |
255 if (mContentView.getUrl() != null) mUrlTextView.setText(mContentView.get
Url()); | 256 if (mContentView.getUrl() != null) mUrlTextView.setText(mContentView.get
Url()); |
256 ((FrameLayout) findViewById(R.id.contentview_holder)).addView(mContentVi
ew, | 257 ((FrameLayout) findViewById(R.id.contentview_holder)).addView(mContentVi
ew, |
257 new FrameLayout.LayoutParams( | 258 new FrameLayout.LayoutParams( |
258 FrameLayout.LayoutParams.MATCH_PARENT, | 259 FrameLayout.LayoutParams.MATCH_PARENT, |
259 FrameLayout.LayoutParams.MATCH_PARENT)); | 260 FrameLayout.LayoutParams.MATCH_PARENT)); |
260 mContentView.requestFocus(); | 261 mContentView.requestFocus(); |
261 mContentViewRenderView.setCurrentContentView(mContentView); | 262 mContentViewRenderView.setCurrentContentView(mContentView); |
262 } | 263 } |
263 | 264 |
264 /** | 265 /** |
265 * @return The {@link ContentView} currently shown by this Shell. | 266 * @return The {@link ContentView} currently shown by this Shell. |
266 */ | 267 */ |
267 public ContentView getContentView() { | 268 public ContentView getContentView() { |
268 return mContentView; | 269 return mContentView; |
269 } | 270 } |
270 | 271 |
271 private void setKeyboardVisibilityForUrl(boolean visible) { | 272 private void setKeyboardVisibilityForUrl(boolean visible) { |
272 InputMethodManager imm = (InputMethodManager) getContext().getSystemServ
ice( | 273 InputMethodManager imm = (InputMethodManager) getContext().getSystemServ
ice( |
273 Context.INPUT_METHOD_SERVICE); | 274 Context.INPUT_METHOD_SERVICE); |
274 if (visible) { | 275 if (visible) { |
275 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); | 276 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); |
276 } else { | 277 } else { |
277 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); | 278 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); |
278 } | 279 } |
279 } | 280 } |
280 | 281 |
281 private static native void nativeCloseShell(long shellPtr); | 282 private static native void nativeCloseShell(long shellPtr); |
282 } | 283 } |
OLD | NEW |