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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 private ImageButton mStopButton; | 56 private ImageButton mStopButton; |
57 private ImageButton mReloadButton; | 57 private ImageButton mReloadButton; |
58 | 58 |
59 private ClipDrawable mProgressDrawable; | 59 private ClipDrawable mProgressDrawable; |
60 | 60 |
61 private long mNativeShell; | 61 private long mNativeShell; |
62 private ContentViewRenderView mContentViewRenderView; | 62 private ContentViewRenderView mContentViewRenderView; |
63 private WindowAndroid mWindow; | 63 private WindowAndroid mWindow; |
64 | 64 |
65 private boolean mLoading = false; | 65 private boolean mLoading = false; |
| 66 private boolean mIsFullscreen = false; |
66 | 67 |
67 /** | 68 /** |
68 * Constructor for inflating via XML. | 69 * Constructor for inflating via XML. |
69 */ | 70 */ |
70 public Shell(Context context, AttributeSet attrs) { | 71 public Shell(Context context, AttributeSet attrs) { |
71 super(context, attrs); | 72 super(context, attrs); |
72 } | 73 } |
73 | 74 |
74 /** | 75 /** |
75 * Set the SurfaceView being renderered to as soon as it is available. | 76 * Set the SurfaceView being renderered to as soon as it is available. |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 @SuppressWarnings("unused") | 255 @SuppressWarnings("unused") |
255 @CalledByNative | 256 @CalledByNative |
256 private void onLoadProgressChanged(double progress) { | 257 private void onLoadProgressChanged(double progress) { |
257 removeCallbacks(mClearProgressRunnable); | 258 removeCallbacks(mClearProgressRunnable); |
258 mProgressDrawable.setLevel((int) (10000.0 * progress)); | 259 mProgressDrawable.setLevel((int) (10000.0 * progress)); |
259 if (progress == 1.0) postDelayed(mClearProgressRunnable, COMPLETED_PROGR
ESS_TIMEOUT_MS); | 260 if (progress == 1.0) postDelayed(mClearProgressRunnable, COMPLETED_PROGR
ESS_TIMEOUT_MS); |
260 } | 261 } |
261 | 262 |
262 @CalledByNative | 263 @CalledByNative |
263 private void toggleFullscreenModeForTab(boolean enterFullscreen) { | 264 private void toggleFullscreenModeForTab(boolean enterFullscreen) { |
| 265 mIsFullscreen = enterFullscreen; |
| 266 LinearLayout toolBar = (LinearLayout) findViewById(R.id.toolbar); |
| 267 toolBar.setVisibility(enterFullscreen ? GONE : VISIBLE); |
264 } | 268 } |
265 | 269 |
266 @CalledByNative | 270 @CalledByNative |
267 private boolean isFullscreenForTabOrPending() { | 271 private boolean isFullscreenForTabOrPending() { |
268 return false; | 272 return mIsFullscreen; |
269 } | 273 } |
270 | 274 |
271 @SuppressWarnings("unused") | 275 @SuppressWarnings("unused") |
272 @CalledByNative | 276 @CalledByNative |
273 private void setIsLoading(boolean loading) { | 277 private void setIsLoading(boolean loading) { |
274 mLoading = loading; | 278 mLoading = loading; |
275 } | 279 } |
276 | 280 |
277 /** | 281 /** |
278 * Initializes the ContentView based on the native tab contents pointer pass
ed in. | 282 * Initializes the ContentView based on the native tab contents pointer pass
ed in. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 Context.INPUT_METHOD_SERVICE); | 339 Context.INPUT_METHOD_SERVICE); |
336 if (visible) { | 340 if (visible) { |
337 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); | 341 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); |
338 } else { | 342 } else { |
339 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); | 343 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); |
340 } | 344 } |
341 } | 345 } |
342 | 346 |
343 private static native void nativeCloseShell(long shellPtr); | 347 private static native void nativeCloseShell(long shellPtr); |
344 } | 348 } |
OLD | NEW |