OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.omnibox; | 5 package org.chromium.chrome.browser.omnibox; |
6 | 6 |
7 import static org.chromium.chrome.browser.toolbar.ToolbarPhone.URL_FOCUS_CHANGE_
ANIMATION_DURATION_MS; | 7 import static org.chromium.chrome.browser.toolbar.ToolbarPhone.URL_FOCUS_CHANGE_
ANIMATION_DURATION_MS; |
8 | 8 |
9 import android.Manifest; | 9 import android.Manifest; |
10 import android.animation.Animator; | 10 import android.animation.Animator; |
(...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1204 public void updateSecurityIcon(int securityLevel) { | 1204 public void updateSecurityIcon(int securityLevel) { |
1205 if (mQueryInTheOmnibox) { | 1205 if (mQueryInTheOmnibox) { |
1206 if (securityLevel == ConnectionSecurityLevel.SECURE | 1206 if (securityLevel == ConnectionSecurityLevel.SECURE |
1207 || securityLevel == ConnectionSecurityLevel.EV_SECURE) { | 1207 || securityLevel == ConnectionSecurityLevel.EV_SECURE) { |
1208 securityLevel = ConnectionSecurityLevel.NONE; | 1208 securityLevel = ConnectionSecurityLevel.NONE; |
1209 } else if (securityLevel == ConnectionSecurityLevel.SECURITY_WARNING | 1209 } else if (securityLevel == ConnectionSecurityLevel.SECURITY_WARNING |
1210 || securityLevel == ConnectionSecurityLevel.SECURITY_ERROR)
{ | 1210 || securityLevel == ConnectionSecurityLevel.SECURITY_ERROR)
{ |
1211 setUrlToPageUrl(); | 1211 setUrlToPageUrl(); |
1212 } | 1212 } |
1213 } | 1213 } |
1214 | 1214 int id = getSecurityIconResource(securityLevel, !shouldEmphasizeHttpsSch
eme()); |
1215 // ImageView#setImageResource is no-op if given resource is the current
one. | 1215 // ImageView#setImageResource is no-op if given resource is the current
one. |
1216 mSecurityButton.setImageResource( | 1216 if (id == 0) { |
1217 getSecurityIconResource(securityLevel, !shouldEmphasizeHttpsSche
me())); | 1217 mSecurityButton.setImageDrawable(null); |
| 1218 } else { |
| 1219 mSecurityButton.setImageResource(id); |
| 1220 } |
1218 | 1221 |
1219 if (mSecurityIconType == securityLevel) return; | 1222 if (mSecurityIconType == securityLevel) return; |
1220 mSecurityIconType = securityLevel; | 1223 mSecurityIconType = securityLevel; |
1221 | 1224 |
1222 if (securityLevel == ConnectionSecurityLevel.NONE) { | 1225 if (securityLevel == ConnectionSecurityLevel.NONE) { |
1223 updateSecurityButton(false); | 1226 updateSecurityButton(false); |
1224 } else { | 1227 } else { |
1225 updateSecurityButton(true); | 1228 updateSecurityButton(true); |
1226 } | 1229 } |
1227 // Since we emphasize the schema of the URL based on the security type,
we need to | 1230 // Since we emphasize the schema of the URL based on the security type,
we need to |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1277 getResources(), R.drawable.ic_omnibox_page); | 1280 getResources(), R.drawable.ic_omnibox_page); |
1278 page.setColorFilter(mUseDarkColors | 1281 page.setColorFilter(mUseDarkColors |
1279 ? ApiCompatibilityUtils.getColor(getResources(), R.color
.light_normal_color) | 1282 ? ApiCompatibilityUtils.getColor(getResources(), R.color
.light_normal_color) |
1280 : Color.WHITE, PorterDuff.Mode.SRC_IN); | 1283 : Color.WHITE, PorterDuff.Mode.SRC_IN); |
1281 mNavigationButton.setImageDrawable(page); | 1284 mNavigationButton.setImageDrawable(page); |
1282 break; | 1285 break; |
1283 case MAGNIFIER: | 1286 case MAGNIFIER: |
1284 mNavigationButton.setImageResource(R.drawable.ic_omnibox_magnifi
er); | 1287 mNavigationButton.setImageResource(R.drawable.ic_omnibox_magnifi
er); |
1285 break; | 1288 break; |
1286 case EMPTY: | 1289 case EMPTY: |
1287 mNavigationButton.setImageResource(0); | 1290 mNavigationButton.setImageDrawable(null); |
1288 break; | 1291 break; |
1289 default: | 1292 default: |
1290 assert false; | 1293 assert false; |
1291 } | 1294 } |
1292 | 1295 |
1293 if (mNavigationButton.getVisibility() != VISIBLE) { | 1296 if (mNavigationButton.getVisibility() != VISIBLE) { |
1294 mNavigationButton.setVisibility(VISIBLE); | 1297 mNavigationButton.setVisibility(VISIBLE); |
1295 } | 1298 } |
1296 mNavigationButtonType = buttonType; | 1299 mNavigationButtonType = buttonType; |
1297 updateLocationBarIconContainerVisibility(); | 1300 updateLocationBarIconContainerVisibility(); |
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2428 public View getContainerView() { | 2431 public View getContainerView() { |
2429 return this; | 2432 return this; |
2430 } | 2433 } |
2431 | 2434 |
2432 @Override | 2435 @Override |
2433 public void setTitleToPageTitle() { } | 2436 public void setTitleToPageTitle() { } |
2434 | 2437 |
2435 @Override | 2438 @Override |
2436 public void setShowTitle(boolean showTitle) { } | 2439 public void setShowTitle(boolean showTitle) { } |
2437 } | 2440 } |
OLD | NEW |