Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: chrome/browser/ui/toolbar/toolbar_model_impl.cc

Issue 13483010: Add UI notifications for admin-provided SSL certificates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/browser/ui/toolbar/toolbar_model_impl.h" 5 #include "chrome/browser/ui/toolbar/toolbar_model_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/autocomplete/autocomplete_classifier.h" 10 #include "chrome/browser/autocomplete/autocomplete_classifier.h"
(...skipping 16 matching lines...) Expand all
27 #include "content/public/browser/web_ui.h" 27 #include "content/public/browser/web_ui.h"
28 #include "content/public/common/content_constants.h" 28 #include "content/public/common/content_constants.h"
29 #include "content/public/common/ssl_status.h" 29 #include "content/public/common/ssl_status.h"
30 #include "grit/generated_resources.h" 30 #include "grit/generated_resources.h"
31 #include "grit/theme_resources.h" 31 #include "grit/theme_resources.h"
32 #include "net/base/net_util.h" 32 #include "net/base/net_util.h"
33 #include "net/cert/cert_status_flags.h" 33 #include "net/cert/cert_status_flags.h"
34 #include "net/cert/x509_certificate.h" 34 #include "net/cert/x509_certificate.h"
35 #include "ui/base/l10n/l10n_util.h" 35 #include "ui/base/l10n/l10n_util.h"
36 36
37 #if defined(ENABLE_CONFIGURATION_POLICY)
38 #include "chrome/browser/policy/browser_policy_connector.h"
39 #endif
40
37 using content::NavigationController; 41 using content::NavigationController;
38 using content::NavigationEntry; 42 using content::NavigationEntry;
39 using content::SSLStatus; 43 using content::SSLStatus;
40 using content::WebContents; 44 using content::WebContents;
41 45
42 ToolbarModelImpl::ToolbarModelImpl(ToolbarModelDelegate* delegate) 46 ToolbarModelImpl::ToolbarModelImpl(ToolbarModelDelegate* delegate)
43 : delegate_(delegate), 47 : delegate_(delegate),
44 input_in_progress_(false) { 48 input_in_progress_(false) {
45 } 49 }
46 50
(...skipping 12 matching lines...) Expand all
59 const SSLStatus& ssl = entry->GetSSL(); 63 const SSLStatus& ssl = entry->GetSSL();
60 switch (ssl.security_style) { 64 switch (ssl.security_style) {
61 case content::SECURITY_STYLE_UNKNOWN: 65 case content::SECURITY_STYLE_UNKNOWN:
62 case content::SECURITY_STYLE_UNAUTHENTICATED: 66 case content::SECURITY_STYLE_UNAUTHENTICATED:
63 return NONE; 67 return NONE;
64 68
65 case content::SECURITY_STYLE_AUTHENTICATION_BROKEN: 69 case content::SECURITY_STYLE_AUTHENTICATION_BROKEN:
66 return SECURITY_ERROR; 70 return SECURITY_ERROR;
67 71
68 case content::SECURITY_STYLE_AUTHENTICATED: 72 case content::SECURITY_STYLE_AUTHENTICATED:
73 #if defined(ENABLE_CONFIGURATION_POLICY)
74 if (policy::BrowserPolicyConnector::UsedPolicyCertificates(
75 Profile::FromBrowserContext(web_contents->GetBrowserContext())))
76 return SECURITY_POLICY_WARNING;
77 #endif
69 if (!!(ssl.content_status & SSLStatus::DISPLAYED_INSECURE_CONTENT)) 78 if (!!(ssl.content_status & SSLStatus::DISPLAYED_INSECURE_CONTENT))
70 return SECURITY_WARNING; 79 return SECURITY_WARNING;
71 if (net::IsCertStatusError(ssl.cert_status)) { 80 if (net::IsCertStatusError(ssl.cert_status)) {
72 DCHECK(net::IsCertStatusMinorError(ssl.cert_status)); 81 DCHECK(net::IsCertStatusMinorError(ssl.cert_status));
73 return SECURITY_WARNING; 82 return SECURITY_WARNING;
74 } 83 }
75 if ((ssl.cert_status & net::CERT_STATUS_IS_EV) && 84 if ((ssl.cert_status & net::CERT_STATUS_IS_EV) &&
76 content::CertStore::GetInstance()->RetrieveCert(ssl.cert_id, NULL)) 85 content::CertStore::GetInstance()->RetrieveCert(ssl.cert_id, NULL))
77 return EV_SECURE; 86 return EV_SECURE;
78 return SECURE; 87 return SECURE;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 } 192 }
184 193
185 int ToolbarModelImpl::GetIcon() const { 194 int ToolbarModelImpl::GetIcon() const {
186 if (WouldReplaceSearchURLWithSearchTerms()) 195 if (WouldReplaceSearchURLWithSearchTerms())
187 return IDR_OMNIBOX_SEARCH; 196 return IDR_OMNIBOX_SEARCH;
188 static int icon_ids[NUM_SECURITY_LEVELS] = { 197 static int icon_ids[NUM_SECURITY_LEVELS] = {
189 IDR_LOCATION_BAR_HTTP, 198 IDR_LOCATION_BAR_HTTP,
190 IDR_OMNIBOX_HTTPS_VALID, 199 IDR_OMNIBOX_HTTPS_VALID,
191 IDR_OMNIBOX_HTTPS_VALID, 200 IDR_OMNIBOX_HTTPS_VALID,
192 IDR_OMNIBOX_HTTPS_WARNING, 201 IDR_OMNIBOX_HTTPS_WARNING,
202 IDR_OMNIBOX_HTTPS_POLICY_WARNING,
193 IDR_OMNIBOX_HTTPS_INVALID, 203 IDR_OMNIBOX_HTTPS_INVALID,
194 }; 204 };
195 DCHECK(arraysize(icon_ids) == NUM_SECURITY_LEVELS); 205 DCHECK(arraysize(icon_ids) == NUM_SECURITY_LEVELS);
196 return icon_ids[GetSecurityLevel()]; 206 return icon_ids[GetSecurityLevel()];
197 } 207 }
198 208
199 string16 ToolbarModelImpl::GetEVCertName() const { 209 string16 ToolbarModelImpl::GetEVCertName() const {
200 DCHECK_EQ(GetSecurityLevel(), EV_SECURE); 210 DCHECK_EQ(GetSecurityLevel(), EV_SECURE);
201 scoped_refptr<net::X509Certificate> cert; 211 scoped_refptr<net::X509Certificate> cert;
202 // Note: Navigation controller and active entry are guaranteed non-NULL or 212 // Note: Navigation controller and active entry are guaranteed non-NULL or
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 Profile* profile = 267 Profile* profile =
258 Profile::FromBrowserContext(contents->GetBrowserContext()); 268 Profile::FromBrowserContext(contents->GetBrowserContext());
259 AutocompleteClassifierFactory::GetForProfile(profile)->Classify( 269 AutocompleteClassifierFactory::GetForProfile(profile)->Classify(
260 search_terms, false, false, &match, NULL); 270 search_terms, false, false, &match, NULL);
261 if (!AutocompleteMatch::IsSearchType(match.type)) 271 if (!AutocompleteMatch::IsSearchType(match.type))
262 search_terms.clear(); 272 search_terms.clear();
263 } 273 }
264 274
265 return search_terms; 275 return search_terms;
266 } 276 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698