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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 ? security_state::NONE | 72 ? security_state::NONE |
73 : delegate_->GetSecurityLevel(); | 73 : delegate_->GetSecurityLevel(); |
74 } | 74 } |
75 | 75 |
76 const gfx::VectorIcon& ToolbarModelImpl::GetVectorIcon() const { | 76 const gfx::VectorIcon& ToolbarModelImpl::GetVectorIcon() const { |
77 #if (!defined(OS_ANDROID) || BUILDFLAG(ENABLE_VR)) && !defined(OS_IOS) | 77 #if (!defined(OS_ANDROID) || BUILDFLAG(ENABLE_VR)) && !defined(OS_IOS) |
78 auto* const icon_override = delegate_->GetVectorIconOverride(); | 78 auto* const icon_override = delegate_->GetVectorIconOverride(); |
79 if (icon_override) | 79 if (icon_override) |
80 return *icon_override; | 80 return *icon_override; |
81 | 81 |
82 if (IsOfflinePage()) | |
cjgrant
2017/07/06 19:19:16
I assume we want this check after the override abo
| |
83 return toolbar::kOfflinePinIcon; | |
84 | |
82 switch (GetSecurityLevel(false)) { | 85 switch (GetSecurityLevel(false)) { |
83 case security_state::NONE: | 86 case security_state::NONE: |
84 case security_state::HTTP_SHOW_WARNING: | 87 case security_state::HTTP_SHOW_WARNING: |
85 return toolbar::kHttpIcon; | 88 return toolbar::kHttpIcon; |
86 case security_state::EV_SECURE: | 89 case security_state::EV_SECURE: |
87 case security_state::SECURE: | 90 case security_state::SECURE: |
88 return toolbar::kHttpsValidIcon; | 91 return toolbar::kHttpsValidIcon; |
89 case security_state::SECURITY_WARNING: | 92 case security_state::SECURITY_WARNING: |
90 // Surface Dubious as Neutral. | 93 // Surface Dubious as Neutral. |
91 return toolbar::kHttpIcon; | 94 return toolbar::kHttpIcon; |
(...skipping 22 matching lines...) Expand all Loading... | |
114 // EV are required to have an organization name and country. | 117 // EV are required to have an organization name and country. |
115 DCHECK(!cert->subject().organization_names.empty()); | 118 DCHECK(!cert->subject().organization_names.empty()); |
116 DCHECK(!cert->subject().country_name.empty()); | 119 DCHECK(!cert->subject().country_name.empty()); |
117 return l10n_util::GetStringFUTF16( | 120 return l10n_util::GetStringFUTF16( |
118 IDS_SECURE_CONNECTION_EV, | 121 IDS_SECURE_CONNECTION_EV, |
119 base::UTF8ToUTF16(cert->subject().organization_names[0]), | 122 base::UTF8ToUTF16(cert->subject().organization_names[0]), |
120 base::UTF8ToUTF16(cert->subject().country_name)); | 123 base::UTF8ToUTF16(cert->subject().country_name)); |
121 } | 124 } |
122 | 125 |
123 base::string16 ToolbarModelImpl::GetSecureVerboseText() const { | 126 base::string16 ToolbarModelImpl::GetSecureVerboseText() const { |
127 if (IsOfflinePage()) | |
128 return l10n_util::GetStringUTF16(IDS_OFFLINE_VERBOSE_STATE); | |
129 | |
124 switch (GetSecurityLevel(false)) { | 130 switch (GetSecurityLevel(false)) { |
125 case security_state::HTTP_SHOW_WARNING: | 131 case security_state::HTTP_SHOW_WARNING: |
126 return l10n_util::GetStringUTF16(IDS_NOT_SECURE_VERBOSE_STATE); | 132 return l10n_util::GetStringUTF16(IDS_NOT_SECURE_VERBOSE_STATE); |
127 case security_state::SECURE: | 133 case security_state::SECURE: |
128 return l10n_util::GetStringUTF16(IDS_SECURE_VERBOSE_STATE); | 134 return l10n_util::GetStringUTF16(IDS_SECURE_VERBOSE_STATE); |
129 case security_state::DANGEROUS: | 135 case security_state::DANGEROUS: |
130 return l10n_util::GetStringUTF16(delegate_->FailsMalwareCheck() | 136 return l10n_util::GetStringUTF16(delegate_->FailsMalwareCheck() |
131 ? IDS_DANGEROUS_VERBOSE_STATE | 137 ? IDS_DANGEROUS_VERBOSE_STATE |
132 : IDS_NOT_SECURE_VERBOSE_STATE); | 138 : IDS_NOT_SECURE_VERBOSE_STATE); |
133 default: | 139 default: |
134 return base::string16(); | 140 return base::string16(); |
135 } | 141 } |
136 } | 142 } |
137 | 143 |
138 bool ToolbarModelImpl::ShouldDisplayURL() const { | 144 bool ToolbarModelImpl::ShouldDisplayURL() const { |
139 return delegate_->ShouldDisplayURL(); | 145 return delegate_->ShouldDisplayURL(); |
140 } | 146 } |
141 | 147 |
142 bool ToolbarModelImpl::IsOfflinePage() const { | 148 bool ToolbarModelImpl::IsOfflinePage() const { |
143 return delegate_->IsOfflinePage(); | 149 return delegate_->IsOfflinePage(); |
144 } | 150 } |
OLD | NEW |