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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 mContentViewCore.getContainerView().clearFocus(); | 187 mContentViewCore.getContainerView().clearFocus(); |
188 mContentViewCore.getContainerView().requestFocus(); | 188 mContentViewCore.getContainerView().requestFocus(); |
189 } | 189 } |
190 | 190 |
191 /** | 191 /** |
192 * Given an URL, this performs minimal sanitizing to ensure it will be valid
. | 192 * Given an URL, this performs minimal sanitizing to ensure it will be valid
. |
193 * @param url The url to be sanitized. | 193 * @param url The url to be sanitized. |
194 * @return The sanitized URL. | 194 * @return The sanitized URL. |
195 */ | 195 */ |
196 public static String sanitizeUrl(String url) { | 196 public static String sanitizeUrl(String url) { |
197 if (url == null) return url; | 197 if (url == null) return null; |
198 if (url.startsWith("www.") || url.indexOf(":") == -1) url = "http://" +
url; | 198 if (url.startsWith("www.") || url.indexOf(":") == -1) url = "http://" +
url; |
199 return url; | 199 return url; |
200 } | 200 } |
201 | 201 |
202 private void initializeNavigationButtons() { | 202 private void initializeNavigationButtons() { |
203 mPrevButton = (ImageButton) findViewById(R.id.prev); | 203 mPrevButton = (ImageButton) findViewById(R.id.prev); |
204 mPrevButton.setOnClickListener(new OnClickListener() { | 204 mPrevButton.setOnClickListener(new OnClickListener() { |
205 @Override | 205 @Override |
206 public void onClick(View v) { | 206 public void onClick(View v) { |
207 if (mContentViewCore.canGoBack()) mContentViewCore.goBack(); | 207 if (mContentViewCore.canGoBack()) mContentViewCore.goBack(); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 Context.INPUT_METHOD_SERVICE); | 318 Context.INPUT_METHOD_SERVICE); |
319 if (visible) { | 319 if (visible) { |
320 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); | 320 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); |
321 } else { | 321 } else { |
322 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); | 322 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); |
323 } | 323 } |
324 } | 324 } |
325 | 325 |
326 private static native void nativeCloseShell(long shellPtr); | 326 private static native void nativeCloseShell(long shellPtr); |
327 } | 327 } |
OLD | NEW |