Chromium Code Reviews| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 154 } | 154 } |
| 155 }); | 155 }); |
| 156 mUrlTextView.setOnFocusChangeListener(new OnFocusChangeListener() { | 156 mUrlTextView.setOnFocusChangeListener(new OnFocusChangeListener() { |
| 157 @Override | 157 @Override |
| 158 public void onFocusChange(View v, boolean hasFocus) { | 158 public void onFocusChange(View v, boolean hasFocus) { |
| 159 setKeyboardVisibilityForUrl(hasFocus); | 159 setKeyboardVisibilityForUrl(hasFocus); |
| 160 mNextButton.setVisibility(hasFocus ? GONE : VISIBLE); | 160 mNextButton.setVisibility(hasFocus ? GONE : VISIBLE); |
| 161 mPrevButton.setVisibility(hasFocus ? GONE : VISIBLE); | 161 mPrevButton.setVisibility(hasFocus ? GONE : VISIBLE); |
| 162 if (!hasFocus) { | 162 if (!hasFocus) { |
| 163 mUrlTextView.setText(mContentViewCore.getUrl()); | 163 mUrlTextView.setText(mContentViewCore.getUrl()); |
| 164 mPrevButton.setEnabled(mContentViewCore.canGoBack()); | |
| 165 mNextButton.setEnabled(mContentViewCore.canGoForward()); | |
| 164 } | 166 } |
| 165 } | 167 } |
| 166 }); | 168 }); |
| 167 } | 169 } |
| 168 | 170 |
| 169 /** | 171 /** |
| 170 * Loads an URL. This will perform minimal amounts of sanitizing of the URL to attempt to | 172 * Loads an URL. This will perform minimal amounts of sanitizing of the URL to attempt to |
| 171 * make it valid. | 173 * make it valid. |
| 172 * | 174 * |
| 173 * @param url The URL to be loaded by the shell. | 175 * @param url The URL to be loaded by the shell. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 219 @CalledByNative | 221 @CalledByNative |
| 220 private void onUpdateUrl(String url) { | 222 private void onUpdateUrl(String url) { |
| 221 mUrlTextView.setText(url); | 223 mUrlTextView.setText(url); |
| 222 } | 224 } |
| 223 | 225 |
| 224 @SuppressWarnings("unused") | 226 @SuppressWarnings("unused") |
| 225 @CalledByNative | 227 @CalledByNative |
| 226 private void onLoadProgressChanged(double progress) { | 228 private void onLoadProgressChanged(double progress) { |
| 227 removeCallbacks(mClearProgressRunnable); | 229 removeCallbacks(mClearProgressRunnable); |
| 228 mProgressDrawable.setLevel((int) (10000.0 * progress)); | 230 mProgressDrawable.setLevel((int) (10000.0 * progress)); |
| 229 if (progress == 1.0) postDelayed(mClearProgressRunnable, COMPLETED_PROGR ESS_TIMEOUT_MS); | 231 if (progress == 1.0) { |
| 232 postDelayed(mClearProgressRunnable, COMPLETED_PROGRESS_TIMEOUT_MS); | |
| 233 mPrevButton.setEnabled(mContentViewCore.canGoBack()); | |
|
Ted C
2014/05/20 22:29:37
In my previous comment, I meant that we should act
| |
| 234 mNextButton.setEnabled(mContentViewCore.canGoForward()); | |
| 235 } | |
| 230 } | 236 } |
| 231 | 237 |
| 232 @CalledByNative | 238 @CalledByNative |
| 233 private void toggleFullscreenModeForTab(boolean enterFullscreen) { | 239 private void toggleFullscreenModeForTab(boolean enterFullscreen) { |
| 234 } | 240 } |
| 235 | 241 |
| 236 @CalledByNative | 242 @CalledByNative |
| 237 private boolean isFullscreenForTabOrPending() { | 243 private boolean isFullscreenForTabOrPending() { |
| 238 return false; | 244 return false; |
| 239 } | 245 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 286 Context.INPUT_METHOD_SERVICE); | 292 Context.INPUT_METHOD_SERVICE); |
| 287 if (visible) { | 293 if (visible) { |
| 288 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); | 294 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); |
| 289 } else { | 295 } else { |
| 290 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); | 296 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); |
| 291 } | 297 } |
| 292 } | 298 } |
| 293 | 299 |
| 294 private static native void nativeCloseShell(long shellPtr); | 300 private static native void nativeCloseShell(long shellPtr); |
| 295 } | 301 } |
| OLD | NEW |