OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 mLoading = loading; | 209 mLoading = loading; |
210 } | 210 } |
211 | 211 |
212 /** | 212 /** |
213 * Initializes the ContentView based on the native tab contents pointer pass
ed in. | 213 * Initializes the ContentView based on the native tab contents pointer pass
ed in. |
214 * @param nativeTabContents The pointer to the native tab contents object. | 214 * @param nativeTabContents The pointer to the native tab contents object. |
215 */ | 215 */ |
216 @SuppressWarnings("unused") | 216 @SuppressWarnings("unused") |
217 @CalledByNative | 217 @CalledByNative |
218 private void initFromNativeTabContents(int nativeTabContents) { | 218 private void initFromNativeTabContents(int nativeTabContents) { |
219 mContentView = ContentView.newInstance( | 219 mContentView = ContentView.newInstance(getContext(), nativeTabContents,
mWindow); |
220 getContext(), nativeTabContents, mWindow, ContentView.PERSONALIT
Y_CHROME); | |
221 if (mContentView.getUrl() != null) mUrlTextView.setText(mContentView.get
Url()); | 220 if (mContentView.getUrl() != null) mUrlTextView.setText(mContentView.get
Url()); |
222 ((FrameLayout) findViewById(R.id.contentview_holder)).addView(mContentVi
ew, | 221 ((FrameLayout) findViewById(R.id.contentview_holder)).addView(mContentVi
ew, |
223 new FrameLayout.LayoutParams( | 222 new FrameLayout.LayoutParams( |
224 FrameLayout.LayoutParams.MATCH_PARENT, | 223 FrameLayout.LayoutParams.MATCH_PARENT, |
225 FrameLayout.LayoutParams.MATCH_PARENT)); | 224 FrameLayout.LayoutParams.MATCH_PARENT)); |
226 mContentView.requestFocus(); | 225 mContentView.requestFocus(); |
227 mContentViewRenderView.setCurrentContentView(mContentView); | 226 mContentViewRenderView.setCurrentContentView(mContentView); |
228 } | 227 } |
229 | 228 |
230 /** | 229 /** |
231 * @return The {@link ContentView} currently shown by this Shell. | 230 * @return The {@link ContentView} currently shown by this Shell. |
232 */ | 231 */ |
233 public ContentView getContentView() { | 232 public ContentView getContentView() { |
234 return mContentView; | 233 return mContentView; |
235 } | 234 } |
236 | 235 |
237 private void setKeyboardVisibilityForUrl(boolean visible) { | 236 private void setKeyboardVisibilityForUrl(boolean visible) { |
238 InputMethodManager imm = (InputMethodManager) getContext().getSystemServ
ice( | 237 InputMethodManager imm = (InputMethodManager) getContext().getSystemServ
ice( |
239 Context.INPUT_METHOD_SERVICE); | 238 Context.INPUT_METHOD_SERVICE); |
240 if (visible) { | 239 if (visible) { |
241 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); | 240 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); |
242 } else { | 241 } else { |
243 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); | 242 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); |
244 } | 243 } |
245 } | 244 } |
246 } | 245 } |
OLD | NEW |