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

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: Fix some includes and nits. Created 7 years, 3 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 | 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/network_policy_service.h"
39 #include "chrome/browser/chromeos/policy/network_policy_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 11 matching lines...) Expand all
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 if (policy::NetworkPolicyServiceFactory::GetForProfile(
72 UsedPolicyCertificates()) 75 Profile::FromBrowserContext(web_contents->GetBrowserContext()))
76 ->UsedPolicyCertificates())
73 return SECURITY_POLICY_WARNING; 77 return SECURITY_POLICY_WARNING;
78 #endif
74 if (!!(ssl.content_status & SSLStatus::DISPLAYED_INSECURE_CONTENT)) 79 if (!!(ssl.content_status & SSLStatus::DISPLAYED_INSECURE_CONTENT))
75 return SECURITY_WARNING; 80 return SECURITY_WARNING;
76 if (net::IsCertStatusError(ssl.cert_status)) { 81 if (net::IsCertStatusError(ssl.cert_status)) {
77 DCHECK(net::IsCertStatusMinorError(ssl.cert_status)); 82 DCHECK(net::IsCertStatusMinorError(ssl.cert_status));
78 return SECURITY_WARNING; 83 return SECURITY_WARNING;
79 } 84 }
80 if ((ssl.cert_status & net::CERT_STATUS_IS_EV) && 85 if ((ssl.cert_status & net::CERT_STATUS_IS_EV) &&
81 content::CertStore::GetInstance()->RetrieveCert(ssl.cert_id, NULL)) 86 content::CertStore::GetInstance()->RetrieveCert(ssl.cert_id, NULL))
82 return EV_SECURE; 87 return EV_SECURE;
83 return SECURE; 88 return SECURE;
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 if (entry && 275 if (entry &&
271 google_util::StartsWithCommandLineGoogleBaseURL(entry->GetVirtualURL())) 276 google_util::StartsWithCommandLineGoogleBaseURL(entry->GetVirtualURL()))
272 return search_terms; 277 return search_terms;
273 278
274 // Otherwise, extract search terms for HTTPS pages that do not have a security 279 // Otherwise, extract search terms for HTTPS pages that do not have a security
275 // error. 280 // error.
276 ToolbarModel::SecurityLevel security_level = GetSecurityLevel(ignore_editing); 281 ToolbarModel::SecurityLevel security_level = GetSecurityLevel(ignore_editing);
277 return ((security_level == NONE) || (security_level == SECURITY_ERROR)) ? 282 return ((security_level == NONE) || (security_level == SECURITY_ERROR)) ?
278 string16() : search_terms; 283 string16() : search_terms;
279 } 284 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698