| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.chrome.browser; | 5 package org.chromium.chrome.browser; |
| 6 | 6 |
| 7 import android.app.Dialog; | 7 import android.app.Dialog; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.content.DialogInterface; | 9 import android.content.DialogInterface; |
| 10 import android.graphics.Color; | 10 import android.graphics.Color; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 if (maxLines != mCurrentMaxLines) { | 158 if (maxLines != mCurrentMaxLines) { |
| 159 setMaxLines(maxLines); | 159 setMaxLines(maxLines); |
| 160 return true; | 160 return true; |
| 161 } | 161 } |
| 162 return false; | 162 return false; |
| 163 } | 163 } |
| 164 } | 164 } |
| 165 | 165 |
| 166 private static final int MAX_TABLET_DIALOG_WIDTH_DP = 400; | 166 private static final int MAX_TABLET_DIALOG_WIDTH_DP = 400; |
| 167 | 167 |
| 168 private static final char FIRST_UNICODE_WHITESPACE = '\u2000'; | |
| 169 private static final char FINAL_UNICODE_WHITESPACE = '\u200F'; | |
| 170 private static final char UNICODE_NBSP = '\u00A0'; | |
| 171 | |
| 172 private final Context mContext; | 168 private final Context mContext; |
| 173 private final Profile mProfile; | 169 private final Profile mProfile; |
| 174 private final WebContents mWebContents; | 170 private final WebContents mWebContents; |
| 175 | 171 |
| 176 // A pointer to the C++ object for this UI. | 172 // A pointer to the C++ object for this UI. |
| 177 private final long mNativeWebsiteSettingsPopup; | 173 private final long mNativeWebsiteSettingsPopup; |
| 178 | 174 |
| 179 // The outer container, filled with the layout from website_settings.xml. | 175 // The outer container, filled with the layout from website_settings.xml. |
| 180 private final LinearLayout mContainer; | 176 private final LinearLayout mContainer; |
| 181 | 177 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 } | 302 } |
| 307 | 303 |
| 308 /** | 304 /** |
| 309 * Percent-encodes suspicious Unicode whitespace characters in a URL so that
it can be safely | 305 * Percent-encodes suspicious Unicode whitespace characters in a URL so that
it can be safely |
| 310 * displayed. | 306 * displayed. |
| 311 */ | 307 */ |
| 312 public static String prepareUrlForDisplay(String urlStr) { | 308 public static String prepareUrlForDisplay(String urlStr) { |
| 313 StringBuilder urlBuilder = new StringBuilder(); | 309 StringBuilder urlBuilder = new StringBuilder(); |
| 314 for (int i = 0; i < urlStr.length(); i++) { | 310 for (int i = 0; i < urlStr.length(); i++) { |
| 315 char c = urlStr.charAt(i); | 311 char c = urlStr.charAt(i); |
| 316 if ((c >= FIRST_UNICODE_WHITESPACE | 312 if (Character.isSpaceChar(c)) { |
| 317 && c <= FINAL_UNICODE_WHITESPACE) | |
| 318 || c == ' ' | |
| 319 || c == UNICODE_NBSP) { | |
| 320 urlBuilder.append(Uri.encode(Character.toString(c))); | 313 urlBuilder.append(Uri.encode(Character.toString(c))); |
| 321 } else { | 314 } else { |
| 322 urlBuilder.append(c); | 315 urlBuilder.append(c); |
| 323 } | 316 } |
| 324 } | 317 } |
| 325 return urlBuilder.toString(); | 318 return urlBuilder.toString(); |
| 326 } | 319 } |
| 327 | 320 |
| 328 /** | 321 /** |
| 329 * Sets the visibility of the lower area of the dialog (containing the permi
ssions and 'Site | 322 * Sets the visibility of the lower area of the dialog (containing the permi
ssions and 'Site |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 new WebsiteSettingsPopup(context, profile, webContents); | 555 new WebsiteSettingsPopup(context, profile, webContents); |
| 563 } | 556 } |
| 564 | 557 |
| 565 private static native long nativeInit(WebsiteSettingsPopup popup, WebContent
s webContents); | 558 private static native long nativeInit(WebsiteSettingsPopup popup, WebContent
s webContents); |
| 566 | 559 |
| 567 private native void nativeDestroy(long nativeWebsiteSettingsPopupAndroid); | 560 private native void nativeDestroy(long nativeWebsiteSettingsPopupAndroid); |
| 568 | 561 |
| 569 private native void nativeOnPermissionSettingChanged(long nativeWebsiteSetti
ngsPopupAndroid, | 562 private native void nativeOnPermissionSettingChanged(long nativeWebsiteSetti
ngsPopupAndroid, |
| 570 int type, int setting); | 563 int type, int setting); |
| 571 } | 564 } |
| OLD | NEW |