| 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 #include "components/toolbar/toolbar_model_impl.h" | 5 #include "components/toolbar/toolbar_model_impl.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 bool ignore_editing) const { | 66 bool ignore_editing) const { |
| 67 // When editing or empty, assume no security style. | 67 // When editing or empty, assume no security style. |
| 68 return ((input_in_progress() && !ignore_editing) || !ShouldDisplayURL()) | 68 return ((input_in_progress() && !ignore_editing) || !ShouldDisplayURL()) |
| 69 ? SecurityStateModel::NONE | 69 ? SecurityStateModel::NONE |
| 70 : delegate_->GetSecurityLevel(); | 70 : delegate_->GetSecurityLevel(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 int ToolbarModelImpl::GetIcon() const { | 73 int ToolbarModelImpl::GetIcon() const { |
| 74 switch (GetSecurityLevel(false)) { | 74 switch (GetSecurityLevel(false)) { |
| 75 case SecurityStateModel::NONE: | 75 case SecurityStateModel::NONE: |
| 76 case SecurityStateModel::HTTP_SHOW_WARNING: |
| 76 return IDR_LOCATION_BAR_HTTP; | 77 return IDR_LOCATION_BAR_HTTP; |
| 77 case SecurityStateModel::EV_SECURE: | 78 case SecurityStateModel::EV_SECURE: |
| 78 case SecurityStateModel::SECURE: | 79 case SecurityStateModel::SECURE: |
| 79 return IDR_OMNIBOX_HTTPS_VALID; | 80 return IDR_OMNIBOX_HTTPS_VALID; |
| 80 case SecurityStateModel::SECURITY_WARNING: | 81 case SecurityStateModel::SECURITY_WARNING: |
| 81 // Surface Dubious as Neutral. | 82 // Surface Dubious as Neutral. |
| 82 return IDR_LOCATION_BAR_HTTP; | 83 return IDR_LOCATION_BAR_HTTP; |
| 83 case SecurityStateModel::SECURITY_POLICY_WARNING: | 84 case SecurityStateModel::SECURITY_POLICY_WARNING: |
| 84 return IDR_OMNIBOX_HTTPS_POLICY_WARNING; | 85 return IDR_OMNIBOX_HTTPS_POLICY_WARNING; |
| 85 case SecurityStateModel::SECURITY_ERROR: | 86 case SecurityStateModel::SECURITY_ERROR: |
| 86 return IDR_OMNIBOX_HTTPS_INVALID; | 87 return IDR_OMNIBOX_HTTPS_INVALID; |
| 87 } | 88 } |
| 88 | 89 |
| 89 NOTREACHED(); | 90 NOTREACHED(); |
| 90 return IDR_LOCATION_BAR_HTTP; | 91 return IDR_LOCATION_BAR_HTTP; |
| 91 } | 92 } |
| 92 | 93 |
| 93 gfx::VectorIconId ToolbarModelImpl::GetVectorIcon() const { | 94 gfx::VectorIconId ToolbarModelImpl::GetVectorIcon() const { |
| 94 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 95 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 95 switch (GetSecurityLevel(false)) { | 96 switch (GetSecurityLevel(false)) { |
| 96 case SecurityStateModel::NONE: | 97 case SecurityStateModel::NONE: |
| 98 case SecurityStateModel::HTTP_SHOW_WARNING: |
| 97 return gfx::VectorIconId::LOCATION_BAR_HTTP; | 99 return gfx::VectorIconId::LOCATION_BAR_HTTP; |
| 98 case SecurityStateModel::EV_SECURE: | 100 case SecurityStateModel::EV_SECURE: |
| 99 case SecurityStateModel::SECURE: | 101 case SecurityStateModel::SECURE: |
| 100 return gfx::VectorIconId::LOCATION_BAR_HTTPS_VALID; | 102 return gfx::VectorIconId::LOCATION_BAR_HTTPS_VALID; |
| 101 case SecurityStateModel::SECURITY_WARNING: | 103 case SecurityStateModel::SECURITY_WARNING: |
| 102 // Surface Dubious as Neutral. | 104 // Surface Dubious as Neutral. |
| 103 return gfx::VectorIconId::LOCATION_BAR_HTTP; | 105 return gfx::VectorIconId::LOCATION_BAR_HTTP; |
| 104 case SecurityStateModel::SECURITY_POLICY_WARNING: | 106 case SecurityStateModel::SECURITY_POLICY_WARNING: |
| 105 return gfx::VectorIconId::BUSINESS; | 107 return gfx::VectorIconId::BUSINESS; |
| 106 case SecurityStateModel::SECURITY_ERROR: | 108 case SecurityStateModel::SECURITY_ERROR: |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 ? IDS_DANGEROUS_VERBOSE_STATE | 140 ? IDS_DANGEROUS_VERBOSE_STATE |
| 139 : IDS_NOT_SECURE_VERBOSE_STATE); | 141 : IDS_NOT_SECURE_VERBOSE_STATE); |
| 140 default: | 142 default: |
| 141 return base::string16(); | 143 return base::string16(); |
| 142 } | 144 } |
| 143 } | 145 } |
| 144 | 146 |
| 145 bool ToolbarModelImpl::ShouldDisplayURL() const { | 147 bool ToolbarModelImpl::ShouldDisplayURL() const { |
| 146 return delegate_->ShouldDisplayURL(); | 148 return delegate_->ShouldDisplayURL(); |
| 147 } | 149 } |
| OLD | NEW |