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

Side by Side Diff: chrome/browser/profiles/profile_io_data.cc

Issue 24153012: Fix cyclic dependency between ProfilePolicyConnector and PrefService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use callback_list in PolicyCertVerifier. Created 7 years, 2 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/profiles/profile_io_data.h" 5 #include "chrome/browser/profiles/profile_io_data.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 #include "chrome/common/chrome_paths.h" 56 #include "chrome/common/chrome_paths.h"
57 #include "chrome/common/chrome_switches.h" 57 #include "chrome/common/chrome_switches.h"
58 #include "chrome/common/pref_names.h" 58 #include "chrome/common/pref_names.h"
59 #include "chrome/common/url_constants.h" 59 #include "chrome/common/url_constants.h"
60 #include "components/startup_metric_utils/startup_metric_utils.h" 60 #include "components/startup_metric_utils/startup_metric_utils.h"
61 #include "content/public/browser/browser_thread.h" 61 #include "content/public/browser/browser_thread.h"
62 #include "content/public/browser/host_zoom_map.h" 62 #include "content/public/browser/host_zoom_map.h"
63 #include "content/public/browser/notification_service.h" 63 #include "content/public/browser/notification_service.h"
64 #include "content/public/browser/resource_context.h" 64 #include "content/public/browser/resource_context.h"
65 #include "extensions/common/constants.h" 65 #include "extensions/common/constants.h"
66 #include "net/cert/cert_verifier.h"
67 #include "net/cookies/canonical_cookie.h" 66 #include "net/cookies/canonical_cookie.h"
68 #include "net/cookies/cookie_monster.h" 67 #include "net/cookies/cookie_monster.h"
69 #include "net/http/http_transaction_factory.h" 68 #include "net/http/http_transaction_factory.h"
70 #include "net/http/http_util.h" 69 #include "net/http/http_util.h"
71 #include "net/proxy/proxy_config_service_fixed.h" 70 #include "net/proxy/proxy_config_service_fixed.h"
72 #include "net/proxy/proxy_script_fetcher_impl.h" 71 #include "net/proxy/proxy_script_fetcher_impl.h"
73 #include "net/proxy/proxy_service.h" 72 #include "net/proxy/proxy_service.h"
74 #include "net/ssl/server_bound_cert_service.h" 73 #include "net/ssl/server_bound_cert_service.h"
75 #include "net/url_request/data_protocol_handler.h" 74 #include "net/url_request/data_protocol_handler.h"
76 #include "net/url_request/file_protocol_handler.h" 75 #include "net/url_request/file_protocol_handler.h"
77 #include "net/url_request/ftp_protocol_handler.h" 76 #include "net/url_request/ftp_protocol_handler.h"
78 #include "net/url_request/protocol_intercept_job_factory.h" 77 #include "net/url_request/protocol_intercept_job_factory.h"
79 #include "net/url_request/url_request.h" 78 #include "net/url_request/url_request.h"
80 #include "net/url_request/url_request_file_job.h" 79 #include "net/url_request/url_request_file_job.h"
81 #include "net/url_request/url_request_job_factory_impl.h" 80 #include "net/url_request/url_request_job_factory_impl.h"
82 81
83 #if defined(ENABLE_MANAGED_USERS) 82 #if defined(ENABLE_MANAGED_USERS)
84 #include "chrome/browser/managed_mode/managed_mode_url_filter.h" 83 #include "chrome/browser/managed_mode/managed_mode_url_filter.h"
85 #include "chrome/browser/managed_mode/managed_user_service.h" 84 #include "chrome/browser/managed_mode/managed_user_service.h"
86 #include "chrome/browser/managed_mode/managed_user_service_factory.h" 85 #include "chrome/browser/managed_mode/managed_user_service_factory.h"
87 #endif 86 #endif
88 87
89 #if defined(OS_CHROMEOS) 88 #if defined(OS_CHROMEOS)
90 #include "chrome/browser/chromeos/drive/drive_protocol_handler.h" 89 #include "chrome/browser/chromeos/drive/drive_protocol_handler.h"
90 #include "chrome/browser/chromeos/policy/network_policy_service.h"
91 #include "chrome/browser/chromeos/policy/network_policy_service_factory.h"
91 #include "chrome/browser/chromeos/policy/policy_cert_verifier.h" 92 #include "chrome/browser/chromeos/policy/policy_cert_verifier.h"
92 #include "chrome/browser/chromeos/settings/cros_settings.h" 93 #include "chrome/browser/chromeos/settings/cros_settings.h"
93 #include "chrome/browser/policy/profile_policy_connector.h"
94 #include "chrome/browser/policy/profile_policy_connector_factory.h"
95 #include "chromeos/settings/cros_settings_names.h" 94 #include "chromeos/settings/cros_settings_names.h"
96 #endif // defined(OS_CHROMEOS) 95 #endif // defined(OS_CHROMEOS)
97 96
98 using content::BrowserContext; 97 using content::BrowserContext;
99 using content::BrowserThread; 98 using content::BrowserThread;
100 using content::ResourceContext; 99 using content::ResourceContext;
101 100
102 namespace { 101 namespace {
103 102
104 // ---------------------------------------------------------------------------- 103 // ----------------------------------------------------------------------------
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); 218 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN));
220 219
221 return NULL; 220 return NULL;
222 } 221 }
223 }; 222 };
224 #endif // defined(DEBUG_DEVTOOLS) 223 #endif // defined(DEBUG_DEVTOOLS)
225 224
226 #if defined(OS_CHROMEOS) 225 #if defined(OS_CHROMEOS)
227 scoped_ptr<policy::PolicyCertVerifier> CreatePolicyCertVerifier( 226 scoped_ptr<policy::PolicyCertVerifier> CreatePolicyCertVerifier(
228 Profile* profile) { 227 Profile* profile) {
229 policy::ProfilePolicyConnector* connector = 228 policy::NetworkPolicyService* service =
230 policy::ProfilePolicyConnectorFactory::GetForProfile(profile); 229 policy::NetworkPolicyServiceFactory::GetForProfile(profile);
231 base::Closure policy_cert_trusted_callback = 230 if (!service)
232 base::Bind(base::IgnoreResult(&content::BrowserThread::PostTask), 231 return scoped_ptr<policy::PolicyCertVerifier>();
233 content::BrowserThread::UI, 232
234 FROM_HERE,
235 connector->GetPolicyCertTrustedCallback());
236 scoped_ptr<policy::PolicyCertVerifier> cert_verifier( 233 scoped_ptr<policy::PolicyCertVerifier> cert_verifier(
237 new policy::PolicyCertVerifier(policy_cert_trusted_callback)); 234 new policy::PolicyCertVerifier());
238 connector->SetPolicyCertVerifier(cert_verifier.get()); 235 service->SetPolicyCertVerifier(cert_verifier.get());
239 return cert_verifier.Pass(); 236 return cert_verifier.Pass();
240 } 237 }
241 #endif 238 #endif
242 } // namespace 239 } // namespace
243 240
244 void ProfileIOData::InitializeOnUIThread(Profile* profile) { 241 void ProfileIOData::InitializeOnUIThread(Profile* profile) {
245 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 242 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
246 PrefService* pref_service = profile->GetPrefs(); 243 PrefService* pref_service = profile->GetPrefs();
247 PrefService* local_state_pref_service = g_browser_process->local_state(); 244 PrefService* local_state_pref_service = g_browser_process->local_state();
248 245
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 if (profile_params_->resource_prefetch_predictor_observer_) { 815 if (profile_params_->resource_prefetch_predictor_observer_) {
819 resource_prefetch_predictor_observer_.reset( 816 resource_prefetch_predictor_observer_.reset(
820 profile_params_->resource_prefetch_predictor_observer_.release()); 817 profile_params_->resource_prefetch_predictor_observer_.release());
821 } 818 }
822 819
823 #if defined(ENABLE_MANAGED_USERS) 820 #if defined(ENABLE_MANAGED_USERS)
824 managed_mode_url_filter_ = profile_params_->managed_mode_url_filter; 821 managed_mode_url_filter_ = profile_params_->managed_mode_url_filter;
825 #endif 822 #endif
826 823
827 #if defined(OS_CHROMEOS) 824 #if defined(OS_CHROMEOS)
828 profile_params_->cert_verifier->InitializeOnIOThread(); 825 if (profile_params_->cert_verifier) {
829 cert_verifier_ = profile_params_->cert_verifier.Pass(); 826 cert_verifier_ = profile_params_->cert_verifier.Pass();
830 main_request_context_->set_cert_verifier(cert_verifier_.get()); 827 cert_verifier_->InitializeOnIOThread();
828 main_request_context_->set_cert_verifier(cert_verifier_.get());
829 } else {
830 main_request_context_->set_cert_verifier(
831 io_thread_globals->cert_verifier.get());
832 }
831 #else 833 #else
832 main_request_context_->set_cert_verifier( 834 main_request_context_->set_cert_verifier(
833 io_thread_globals->cert_verifier.get()); 835 io_thread_globals->cert_verifier.get());
834 #endif 836 #endif
835 837
836 InitializeInternal(profile_params_.get(), protocol_handlers); 838 InitializeInternal(profile_params_.get(), protocol_handlers);
837 839
838 profile_params_.reset(); 840 profile_params_.reset();
839 initialized_ = true; 841 initialized_ = true;
840 } 842 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 if (signin_names_) 919 if (signin_names_)
918 signin_names_->ReleaseResourcesOnUIThread(); 920 signin_names_->ReleaseResourcesOnUIThread();
919 921
920 google_services_username_.Destroy(); 922 google_services_username_.Destroy();
921 google_services_username_pattern_.Destroy(); 923 google_services_username_pattern_.Destroy();
922 reverse_autologin_enabled_.Destroy(); 924 reverse_autologin_enabled_.Destroy();
923 one_click_signin_rejected_email_list_.Destroy(); 925 one_click_signin_rejected_email_list_.Destroy();
924 enable_referrers_.Destroy(); 926 enable_referrers_.Destroy();
925 enable_do_not_track_.Destroy(); 927 enable_do_not_track_.Destroy();
926 force_safesearch_.Destroy(); 928 force_safesearch_.Destroy();
927 #if !defined(OS_CHROMEOS) 929 #if defined(OS_CHROMEOS)
930 cert_verifier_->ShutdownOnUIThread();
931 #else
928 enable_metrics_.Destroy(); 932 enable_metrics_.Destroy();
929 #endif 933 #endif
930 safe_browsing_enabled_.Destroy(); 934 safe_browsing_enabled_.Destroy();
931 printing_enabled_.Destroy(); 935 printing_enabled_.Destroy();
932 sync_disabled_.Destroy(); 936 sync_disabled_.Destroy();
933 signin_allowed_.Destroy(); 937 signin_allowed_.Destroy();
934 session_startup_pref_.Destroy(); 938 session_startup_pref_.Destroy();
935 #if defined(ENABLE_CONFIGURATION_POLICY) 939 #if defined(ENABLE_CONFIGURATION_POLICY)
936 if (url_blacklist_manager_) 940 if (url_blacklist_manager_)
937 url_blacklist_manager_->ShutdownOnUIThread(); 941 url_blacklist_manager_->ShutdownOnUIThread();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 void ProfileIOData::SetCookieSettingsForTesting( 982 void ProfileIOData::SetCookieSettingsForTesting(
979 CookieSettings* cookie_settings) { 983 CookieSettings* cookie_settings) {
980 DCHECK(!cookie_settings_.get()); 984 DCHECK(!cookie_settings_.get());
981 cookie_settings_ = cookie_settings; 985 cookie_settings_ = cookie_settings;
982 } 986 }
983 987
984 void ProfileIOData::set_signin_names_for_testing( 988 void ProfileIOData::set_signin_names_for_testing(
985 SigninNamesOnIOThread* signin_names) { 989 SigninNamesOnIOThread* signin_names) {
986 signin_names_.reset(signin_names); 990 signin_names_.reset(signin_names);
987 } 991 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698