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 16 matching lines...) Expand all Loading... |
27 import org.chromium.ui.WindowAndroid; | 27 import org.chromium.ui.WindowAndroid; |
28 | 28 |
29 /** | 29 /** |
30 * Container for the various UI components that make up a shell window. | 30 * Container for the various UI components that make up a shell window. |
31 */ | 31 */ |
32 @JNINamespace("content") | 32 @JNINamespace("content") |
33 public class Shell extends LinearLayout { | 33 public class Shell extends LinearLayout { |
34 | 34 |
35 private static final long COMPLETED_PROGRESS_TIMEOUT_MS = 200; | 35 private static final long COMPLETED_PROGRESS_TIMEOUT_MS = 200; |
36 | 36 |
37 private Runnable mClearProgressRunnable = new Runnable() { | 37 private final Runnable mClearProgressRunnable = new Runnable() { |
38 @Override | 38 @Override |
39 public void run() { | 39 public void run() { |
40 mProgressDrawable.setLevel(0); | 40 mProgressDrawable.setLevel(0); |
41 } | 41 } |
42 }; | 42 }; |
43 | 43 |
44 // TODO(jrg): a mContentView.destroy() call is needed, both upstream and dow
nstream. | 44 // TODO(jrg): a mContentView.destroy() call is needed, both upstream and dow
nstream. |
45 private ContentView mContentView; | 45 private ContentView mContentView; |
46 private EditText mUrlTextView; | 46 private EditText mUrlTextView; |
47 private ImageButton mPrevButton; | 47 private ImageButton mPrevButton; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 /** | 134 /** |
135 * Loads an URL. This will perform minimal amounts of sanitizing of the URL
to attempt to | 135 * Loads an URL. This will perform minimal amounts of sanitizing of the URL
to attempt to |
136 * make it valid. | 136 * make it valid. |
137 * | 137 * |
138 * @param url The URL to be loaded by the shell. | 138 * @param url The URL to be loaded by the shell. |
139 */ | 139 */ |
140 public void loadUrl(String url) { | 140 public void loadUrl(String url) { |
141 if (url == null) return; | 141 if (url == null) return; |
142 | 142 |
143 if (TextUtils.equals(url, mContentView.getUrl())) { | 143 if (TextUtils.equals(url, mContentView.getUrl())) { |
144 mContentView.reload(); | 144 mContentView.getContentViewCore().reload(true); |
145 } else { | 145 } else { |
146 mContentView.loadUrl(new LoadUrlParams(sanitizeUrl(url))); | 146 mContentView.loadUrl(new LoadUrlParams(sanitizeUrl(url))); |
147 } | 147 } |
148 mUrlTextView.clearFocus(); | 148 mUrlTextView.clearFocus(); |
149 // TODO(aurimas): Remove this when crbug.com/174541 is fixed. | 149 // TODO(aurimas): Remove this when crbug.com/174541 is fixed. |
150 mContentView.clearFocus(); | 150 mContentView.clearFocus(); |
151 mContentView.requestFocus(); | 151 mContentView.requestFocus(); |
152 } | 152 } |
153 | 153 |
154 /** | 154 /** |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 private void setKeyboardVisibilityForUrl(boolean visible) { | 236 private void setKeyboardVisibilityForUrl(boolean visible) { |
237 InputMethodManager imm = (InputMethodManager) getContext().getSystemServ
ice( | 237 InputMethodManager imm = (InputMethodManager) getContext().getSystemServ
ice( |
238 Context.INPUT_METHOD_SERVICE); | 238 Context.INPUT_METHOD_SERVICE); |
239 if (visible) { | 239 if (visible) { |
240 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); | 240 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); |
241 } else { | 241 } else { |
242 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); | 242 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); |
243 } | 243 } |
244 } | 244 } |
245 } | 245 } |
OLD | NEW |