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

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: remove testing hack 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 17 matching lines...) Expand all
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 "extensions/common/constants.h" 30 #include "extensions/common/constants.h"
31 #include "grit/generated_resources.h" 31 #include "grit/generated_resources.h"
32 #include "grit/theme_resources.h" 32 #include "grit/theme_resources.h"
33 #include "net/base/net_util.h" 33 #include "net/base/net_util.h"
34 #include "net/cert/cert_status_flags.h" 34 #include "net/cert/cert_status_flags.h"
35 #include "net/cert/x509_certificate.h" 35 #include "net/cert/x509_certificate.h"
36 #include "ui/base/l10n/l10n_util.h" 36 #include "ui/base/l10n/l10n_util.h"
37 37
38 #if defined(OS_CHROMEOS)
39 #include "chrome/browser/policy/browser_policy_connector.h"
40 #endif
41
38 using content::NavigationController; 42 using content::NavigationController;
39 using content::NavigationEntry; 43 using content::NavigationEntry;
40 using content::SSLStatus; 44 using content::SSLStatus;
41 using content::WebContents; 45 using content::WebContents;
42 46
43 ToolbarModelImpl::ToolbarModelImpl(ToolbarModelDelegate* delegate) 47 ToolbarModelImpl::ToolbarModelImpl(ToolbarModelDelegate* delegate)
44 : delegate_(delegate), 48 : delegate_(delegate),
45 input_in_progress_(false) { 49 input_in_progress_(false) {
46 } 50 }
47 51
(...skipping 12 matching lines...) Expand all
60 const SSLStatus& ssl = entry->GetSSL(); 64 const SSLStatus& ssl = entry->GetSSL();
61 switch (ssl.security_style) { 65 switch (ssl.security_style) {
62 case content::SECURITY_STYLE_UNKNOWN: 66 case content::SECURITY_STYLE_UNKNOWN:
63 case content::SECURITY_STYLE_UNAUTHENTICATED: 67 case content::SECURITY_STYLE_UNAUTHENTICATED:
64 return NONE; 68 return NONE;
65 69
66 case content::SECURITY_STYLE_AUTHENTICATION_BROKEN: 70 case content::SECURITY_STYLE_AUTHENTICATION_BROKEN:
67 return SECURITY_ERROR; 71 return SECURITY_ERROR;
68 72
69 case content::SECURITY_STYLE_AUTHENTICATED: 73 case content::SECURITY_STYLE_AUTHENTICATED:
74 #if defined(OS_CHROMEOS)
Peter Kasting 2013/04/13 00:42:59 Nit: Bonus points if browser_policy_connector can
dconnelly 2013/04/17 11:46:51 Done.
75 if (policy::BrowserPolicyConnector::UsedPolicyCertificates(
76 Profile::FromBrowserContext(web_contents->GetBrowserContext()))) {
Peter Kasting 2013/04/13 00:42:59 Nit: Indent 4, not 8. No {}.
dconnelly 2013/04/17 11:46:51 Done.
77 return SECURITY_POLICY_WARNING;
78 }
79 #endif
70 if (!!(ssl.content_status & SSLStatus::DISPLAYED_INSECURE_CONTENT)) 80 if (!!(ssl.content_status & SSLStatus::DISPLAYED_INSECURE_CONTENT))
71 return SECURITY_WARNING; 81 return SECURITY_WARNING;
72 if (net::IsCertStatusError(ssl.cert_status)) { 82 if (net::IsCertStatusError(ssl.cert_status)) {
73 DCHECK(net::IsCertStatusMinorError(ssl.cert_status)); 83 DCHECK(net::IsCertStatusMinorError(ssl.cert_status));
74 return SECURITY_WARNING; 84 return SECURITY_WARNING;
75 } 85 }
76 if ((ssl.cert_status & net::CERT_STATUS_IS_EV) && 86 if ((ssl.cert_status & net::CERT_STATUS_IS_EV) &&
77 content::CertStore::GetInstance()->RetrieveCert(ssl.cert_id, NULL)) 87 content::CertStore::GetInstance()->RetrieveCert(ssl.cert_id, NULL))
78 return EV_SECURE; 88 return EV_SECURE;
79 return SECURE; 89 return SECURE;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 } 197 }
188 198
189 int ToolbarModelImpl::GetIcon() const { 199 int ToolbarModelImpl::GetIcon() const {
190 if (WouldReplaceSearchURLWithSearchTerms()) 200 if (WouldReplaceSearchURLWithSearchTerms())
191 return IDR_OMNIBOX_SEARCH; 201 return IDR_OMNIBOX_SEARCH;
192 static int icon_ids[NUM_SECURITY_LEVELS] = { 202 static int icon_ids[NUM_SECURITY_LEVELS] = {
193 IDR_LOCATION_BAR_HTTP, 203 IDR_LOCATION_BAR_HTTP,
194 IDR_OMNIBOX_HTTPS_VALID, 204 IDR_OMNIBOX_HTTPS_VALID,
195 IDR_OMNIBOX_HTTPS_VALID, 205 IDR_OMNIBOX_HTTPS_VALID,
196 IDR_OMNIBOX_HTTPS_WARNING, 206 IDR_OMNIBOX_HTTPS_WARNING,
207 IDR_OMNIBOX_HTTPS_POLICY_WARNING,
197 IDR_OMNIBOX_HTTPS_INVALID, 208 IDR_OMNIBOX_HTTPS_INVALID,
198 }; 209 };
199 DCHECK(arraysize(icon_ids) == NUM_SECURITY_LEVELS); 210 DCHECK(arraysize(icon_ids) == NUM_SECURITY_LEVELS);
200 return icon_ids[GetSecurityLevel()]; 211 return icon_ids[GetSecurityLevel()];
201 } 212 }
202 213
203 string16 ToolbarModelImpl::GetEVCertName() const { 214 string16 ToolbarModelImpl::GetEVCertName() const {
204 DCHECK_EQ(GetSecurityLevel(), EV_SECURE); 215 DCHECK_EQ(GetSecurityLevel(), EV_SECURE);
205 scoped_refptr<net::X509Certificate> cert; 216 scoped_refptr<net::X509Certificate> cert;
206 // Note: Navigation controller and active entry are guaranteed non-NULL or 217 // Note: Navigation controller and active entry are guaranteed non-NULL or
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 Profile* profile = 272 Profile* profile =
262 Profile::FromBrowserContext(contents->GetBrowserContext()); 273 Profile::FromBrowserContext(contents->GetBrowserContext());
263 AutocompleteClassifierFactory::GetForProfile(profile)->Classify( 274 AutocompleteClassifierFactory::GetForProfile(profile)->Classify(
264 search_terms, false, false, &match, NULL); 275 search_terms, false, false, &match, NULL);
265 if (!AutocompleteMatch::IsSearchType(match.type)) 276 if (!AutocompleteMatch::IsSearchType(match.type))
266 search_terms.clear(); 277 search_terms.clear();
267 } 278 }
268 279
269 return search_terms; 280 return search_terms;
270 } 281 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698