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

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

Issue 24153012: Fix cyclic dependency between ProfilePolicyConnector and PrefService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed. Created 7 years, 1 month 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 | Annotate | Revision Log
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/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/autocomplete/autocomplete_classifier.h" 10 #include "chrome/browser/autocomplete/autocomplete_classifier.h"
11 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" 11 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
12 #include "chrome/browser/autocomplete/autocomplete_input.h" 12 #include "chrome/browser/autocomplete/autocomplete_input.h"
13 #include "chrome/browser/autocomplete/autocomplete_match.h" 13 #include "chrome/browser/autocomplete/autocomplete_match.h"
14 #include "chrome/browser/google/google_util.h" 14 #include "chrome/browser/google/google_util.h"
15 #include "chrome/browser/policy/profile_policy_connector.h"
16 #include "chrome/browser/policy/profile_policy_connector_factory.h"
17 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/search/search.h" 16 #include "chrome/browser/search/search.h"
19 #include "chrome/browser/ssl/ssl_error_info.h" 17 #include "chrome/browser/ssl/ssl_error_info.h"
20 #include "chrome/browser/ui/toolbar/toolbar_model_delegate.h" 18 #include "chrome/browser/ui/toolbar/toolbar_model_delegate.h"
21 #include "chrome/common/chrome_constants.h" 19 #include "chrome/common/chrome_constants.h"
22 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
23 #include "chrome/common/pref_names.h" 21 #include "chrome/common/pref_names.h"
24 #include "chrome/common/url_constants.h" 22 #include "chrome/common/url_constants.h"
25 #include "content/public/browser/cert_store.h" 23 #include "content/public/browser/cert_store.h"
26 #include "content/public/browser/navigation_controller.h" 24 #include "content/public/browser/navigation_controller.h"
27 #include "content/public/browser/navigation_entry.h" 25 #include "content/public/browser/navigation_entry.h"
28 #include "content/public/browser/web_contents.h" 26 #include "content/public/browser/web_contents.h"
29 #include "content/public/browser/web_ui.h" 27 #include "content/public/browser/web_ui.h"
30 #include "content/public/common/content_constants.h" 28 #include "content/public/common/content_constants.h"
31 #include "content/public/common/ssl_status.h" 29 #include "content/public/common/ssl_status.h"
32 #include "grit/generated_resources.h" 30 #include "grit/generated_resources.h"
33 #include "grit/theme_resources.h" 31 #include "grit/theme_resources.h"
34 #include "net/base/net_util.h" 32 #include "net/base/net_util.h"
35 #include "net/cert/cert_status_flags.h" 33 #include "net/cert/cert_status_flags.h"
36 #include "net/cert/x509_certificate.h" 34 #include "net/cert/x509_certificate.h"
37 #include "ui/base/l10n/l10n_util.h" 35 #include "ui/base/l10n/l10n_util.h"
38 36
37 #if defined(OS_CHROMEOS)
38 #include "chrome/browser/chromeos/policy/policy_cert_service.h"
39 #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h"
40 #endif
41
39 using content::NavigationController; 42 using content::NavigationController;
40 using content::NavigationEntry; 43 using content::NavigationEntry;
41 using content::SSLStatus; 44 using content::SSLStatus;
42 using content::WebContents; 45 using content::WebContents;
43 46
44 ToolbarModelImpl::ToolbarModelImpl(ToolbarModelDelegate* delegate) 47 ToolbarModelImpl::ToolbarModelImpl(ToolbarModelDelegate* delegate)
45 : delegate_(delegate) { 48 : delegate_(delegate) {
46 } 49 }
47 50
48 ToolbarModelImpl::~ToolbarModelImpl() { 51 ToolbarModelImpl::~ToolbarModelImpl() {
(...skipping 10 matching lines...) Expand all
59 62
60 const SSLStatus& ssl = entry->GetSSL(); 63 const SSLStatus& ssl = entry->GetSSL();
61 switch (ssl.security_style) { 64 switch (ssl.security_style) {
62 case content::SECURITY_STYLE_UNKNOWN: 65 case content::SECURITY_STYLE_UNKNOWN:
63 case content::SECURITY_STYLE_UNAUTHENTICATED: 66 case content::SECURITY_STYLE_UNAUTHENTICATED:
64 return NONE; 67 return NONE;
65 68
66 case content::SECURITY_STYLE_AUTHENTICATION_BROKEN: 69 case content::SECURITY_STYLE_AUTHENTICATION_BROKEN:
67 return SECURITY_ERROR; 70 return SECURITY_ERROR;
68 71
69 case content::SECURITY_STYLE_AUTHENTICATED: 72 case content::SECURITY_STYLE_AUTHENTICATED: {
70 if (policy::ProfilePolicyConnectorFactory::GetForProfile( 73 #if defined(OS_CHROMEOS)
71 Profile::FromBrowserContext(web_contents->GetBrowserContext()))-> 74 policy::PolicyCertService* service =
72 UsedPolicyCertificates()) 75 policy::PolicyCertServiceFactory::GetForProfile(
76 Profile::FromBrowserContext(web_contents->GetBrowserContext()));
77 if (service && service->UsedPolicyCertificates())
73 return SECURITY_POLICY_WARNING; 78 return SECURITY_POLICY_WARNING;
79 #endif
74 if (!!(ssl.content_status & SSLStatus::DISPLAYED_INSECURE_CONTENT)) 80 if (!!(ssl.content_status & SSLStatus::DISPLAYED_INSECURE_CONTENT))
75 return SECURITY_WARNING; 81 return SECURITY_WARNING;
76 if (net::IsCertStatusError(ssl.cert_status)) { 82 if (net::IsCertStatusError(ssl.cert_status)) {
77 DCHECK(net::IsCertStatusMinorError(ssl.cert_status)); 83 DCHECK(net::IsCertStatusMinorError(ssl.cert_status));
78 return SECURITY_WARNING; 84 return SECURITY_WARNING;
79 } 85 }
80 if ((ssl.cert_status & net::CERT_STATUS_IS_EV) && 86 if ((ssl.cert_status & net::CERT_STATUS_IS_EV) &&
81 content::CertStore::GetInstance()->RetrieveCert(ssl.cert_id, NULL)) 87 content::CertStore::GetInstance()->RetrieveCert(ssl.cert_id, NULL))
82 return EV_SECURE; 88 return EV_SECURE;
83 return SECURE; 89 return SECURE;
84 90 }
85 default: 91 default:
86 NOTREACHED(); 92 NOTREACHED();
87 return NONE; 93 return NONE;
88 } 94 }
89 } 95 }
90 96
91 // ToolbarModelImpl Implementation. 97 // ToolbarModelImpl Implementation.
92 string16 ToolbarModelImpl::GetText(bool allow_search_term_replacement) const { 98 string16 ToolbarModelImpl::GetText(bool allow_search_term_replacement) const {
93 if (allow_search_term_replacement) { 99 if (allow_search_term_replacement) {
94 string16 search_terms(GetSearchTerms(false)); 100 string16 search_terms(GetSearchTerms(false));
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 if (entry && 276 if (entry &&
271 google_util::StartsWithCommandLineGoogleBaseURL(entry->GetVirtualURL())) 277 google_util::StartsWithCommandLineGoogleBaseURL(entry->GetVirtualURL()))
272 return search_terms; 278 return search_terms;
273 279
274 // Otherwise, extract search terms for HTTPS pages that do not have a security 280 // Otherwise, extract search terms for HTTPS pages that do not have a security
275 // error. 281 // error.
276 ToolbarModel::SecurityLevel security_level = GetSecurityLevel(ignore_editing); 282 ToolbarModel::SecurityLevel security_level = GetSecurityLevel(ignore_editing);
277 return ((security_level == NONE) || (security_level == SECURITY_ERROR)) ? 283 return ((security_level == NONE) || (security_level == SECURITY_ERROR)) ?
278 string16() : search_terms; 284 string16() : search_terms;
279 } 285 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_io_data.cc ('k') | chrome/browser/ui/website_settings/website_settings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698