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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 if (mContentViewCore.getUrl() != null) mUrlTextView.setText(mContentView
Core.getUrl()); | 261 if (mContentViewCore.getUrl() != null) mUrlTextView.setText(mContentView
Core.getUrl()); |
262 ((FrameLayout) findViewById(R.id.contentview_holder)).addView(cv, | 262 ((FrameLayout) findViewById(R.id.contentview_holder)).addView(cv, |
263 new FrameLayout.LayoutParams( | 263 new FrameLayout.LayoutParams( |
264 FrameLayout.LayoutParams.MATCH_PARENT, | 264 FrameLayout.LayoutParams.MATCH_PARENT, |
265 FrameLayout.LayoutParams.MATCH_PARENT)); | 265 FrameLayout.LayoutParams.MATCH_PARENT)); |
266 cv.requestFocus(); | 266 cv.requestFocus(); |
267 mContentViewRenderView.setCurrentContentViewCore(mContentViewCore); | 267 mContentViewRenderView.setCurrentContentViewCore(mContentViewCore); |
268 } | 268 } |
269 | 269 |
270 /** | 270 /** |
| 271 * Enable/Disable navigation(Prev/Next) button if navigation is allowed/disa
llowed |
| 272 * in respective direction. |
| 273 * @param controlId Id of button to update |
| 274 * @param enabled enable/disable value |
| 275 */ |
| 276 @CalledByNative |
| 277 private void enableUiControl(int controlId, boolean enabled) { |
| 278 if (controlId == 0) mPrevButton.setEnabled(enabled); |
| 279 else if (controlId == 1) mNextButton.setEnabled(enabled); |
| 280 } |
| 281 |
| 282 /** |
271 * @return The {@link ViewGroup} currently shown by this Shell. | 283 * @return The {@link ViewGroup} currently shown by this Shell. |
272 */ | 284 */ |
273 public ViewGroup getContentView() { | 285 public ViewGroup getContentView() { |
274 return mContentViewCore.getContainerView(); | 286 return mContentViewCore.getContainerView(); |
275 } | 287 } |
276 | 288 |
277 /** | 289 /** |
278 * @return The {@link ContentViewCore} currently managing the view shown by
this Shell. | 290 * @return The {@link ContentViewCore} currently managing the view shown by
this Shell. |
279 */ | 291 */ |
280 public ContentViewCore getContentViewCore() { | 292 public ContentViewCore getContentViewCore() { |
281 return mContentViewCore; | 293 return mContentViewCore; |
282 } | 294 } |
283 | 295 |
284 private void setKeyboardVisibilityForUrl(boolean visible) { | 296 private void setKeyboardVisibilityForUrl(boolean visible) { |
285 InputMethodManager imm = (InputMethodManager) getContext().getSystemServ
ice( | 297 InputMethodManager imm = (InputMethodManager) getContext().getSystemServ
ice( |
286 Context.INPUT_METHOD_SERVICE); | 298 Context.INPUT_METHOD_SERVICE); |
287 if (visible) { | 299 if (visible) { |
288 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); | 300 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); |
289 } else { | 301 } else { |
290 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); | 302 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); |
291 } | 303 } |
292 } | 304 } |
293 | 305 |
294 private static native void nativeCloseShell(long shellPtr); | 306 private static native void nativeCloseShell(long shellPtr); |
295 } | 307 } |
OLD | NEW |