OLD | NEW |
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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 #include "net/url_request/url_request_job_factory_impl.h" | 81 #include "net/url_request/url_request_job_factory_impl.h" |
82 | 82 |
83 #if defined(ENABLE_MANAGED_USERS) | 83 #if defined(ENABLE_MANAGED_USERS) |
84 #include "chrome/browser/managed_mode/managed_mode_url_filter.h" | 84 #include "chrome/browser/managed_mode/managed_mode_url_filter.h" |
85 #include "chrome/browser/managed_mode/managed_user_service.h" | 85 #include "chrome/browser/managed_mode/managed_user_service.h" |
86 #include "chrome/browser/managed_mode/managed_user_service_factory.h" | 86 #include "chrome/browser/managed_mode/managed_user_service_factory.h" |
87 #endif | 87 #endif |
88 | 88 |
89 #if defined(OS_CHROMEOS) | 89 #if defined(OS_CHROMEOS) |
90 #include "chrome/browser/chromeos/drive/drive_protocol_handler.h" | 90 #include "chrome/browser/chromeos/drive/drive_protocol_handler.h" |
| 91 #include "chrome/browser/chromeos/login/user.h" |
| 92 #include "chrome/browser/chromeos/login/user_manager.h" |
91 #include "chrome/browser/chromeos/policy/policy_cert_verifier.h" | 93 #include "chrome/browser/chromeos/policy/policy_cert_verifier.h" |
92 #include "chrome/browser/chromeos/settings/cros_settings.h" | 94 #include "chrome/browser/chromeos/settings/cros_settings.h" |
93 #include "chrome/browser/policy/profile_policy_connector.h" | 95 #include "chrome/browser/policy/profile_policy_connector.h" |
94 #include "chrome/browser/policy/profile_policy_connector_factory.h" | 96 #include "chrome/browser/policy/profile_policy_connector_factory.h" |
95 #include "chromeos/settings/cros_settings_names.h" | 97 #include "chromeos/settings/cros_settings_names.h" |
96 #endif // defined(OS_CHROMEOS) | 98 #endif // defined(OS_CHROMEOS) |
97 | 99 |
98 using content::BrowserContext; | 100 using content::BrowserContext; |
99 using content::BrowserThread; | 101 using content::BrowserThread; |
100 using content::ResourceContext; | 102 using content::ResourceContext; |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 .reset(ProxyServiceFactory::CreateProxyConfigService( | 291 .reset(ProxyServiceFactory::CreateProxyConfigService( |
290 profile->GetProxyConfigTracker())); | 292 profile->GetProxyConfigTracker())); |
291 #if defined(ENABLE_MANAGED_USERS) | 293 #if defined(ENABLE_MANAGED_USERS) |
292 ManagedUserService* managed_user_service = | 294 ManagedUserService* managed_user_service = |
293 ManagedUserServiceFactory::GetForProfile(profile); | 295 ManagedUserServiceFactory::GetForProfile(profile); |
294 params->managed_mode_url_filter = | 296 params->managed_mode_url_filter = |
295 managed_user_service->GetURLFilterForIOThread(); | 297 managed_user_service->GetURLFilterForIOThread(); |
296 #endif | 298 #endif |
297 #if defined(OS_CHROMEOS) | 299 #if defined(OS_CHROMEOS) |
298 params->cert_verifier = CreatePolicyCertVerifier(profile); | 300 params->cert_verifier = CreatePolicyCertVerifier(profile); |
| 301 chromeos::UserManager* user_manager = chromeos::UserManager::Get(); |
| 302 if (user_manager) { |
| 303 chromeos::User* user = user_manager->GetUserByProfile(profile); |
| 304 if (user) |
| 305 params->user_name = user->email(); |
| 306 } |
| 307 if (params->user_name.empty()) |
| 308 LOG(WARNING) << "no username"; |
299 #endif | 309 #endif |
300 | 310 |
301 params->profile = profile; | 311 params->profile = profile; |
302 profile_params_.reset(params.release()); | 312 profile_params_.reset(params.release()); |
303 | 313 |
304 ChromeNetworkDelegate::InitializePrefsOnUIThread( | 314 ChromeNetworkDelegate::InitializePrefsOnUIThread( |
305 &enable_referrers_, | 315 &enable_referrers_, |
306 &enable_do_not_track_, | 316 &enable_do_not_track_, |
307 &force_safesearch_, | 317 &force_safesearch_, |
308 pref_service); | 318 pref_service); |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 } | 831 } |
822 | 832 |
823 #if defined(ENABLE_MANAGED_USERS) | 833 #if defined(ENABLE_MANAGED_USERS) |
824 managed_mode_url_filter_ = profile_params_->managed_mode_url_filter; | 834 managed_mode_url_filter_ = profile_params_->managed_mode_url_filter; |
825 #endif | 835 #endif |
826 | 836 |
827 #if defined(OS_CHROMEOS) | 837 #if defined(OS_CHROMEOS) |
828 profile_params_->cert_verifier->InitializeOnIOThread(); | 838 profile_params_->cert_verifier->InitializeOnIOThread(); |
829 cert_verifier_ = profile_params_->cert_verifier.Pass(); | 839 cert_verifier_ = profile_params_->cert_verifier.Pass(); |
830 main_request_context_->set_cert_verifier(cert_verifier_.get()); | 840 main_request_context_->set_cert_verifier(cert_verifier_.get()); |
| 841 |
| 842 user_name_ = profile_params_->user_name; |
| 843 profile_path_ = profile_params_->path; |
831 #else | 844 #else |
832 main_request_context_->set_cert_verifier( | 845 main_request_context_->set_cert_verifier( |
833 io_thread_globals->cert_verifier.get()); | 846 io_thread_globals->cert_verifier.get()); |
834 #endif | 847 #endif |
835 | 848 |
836 InitializeInternal(profile_params_.get(), protocol_handlers); | 849 InitializeInternal(profile_params_.get(), protocol_handlers); |
837 | 850 |
838 profile_params_.reset(); | 851 profile_params_.reset(); |
839 initialized_ = true; | 852 initialized_ = true; |
840 } | 853 } |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
978 void ProfileIOData::SetCookieSettingsForTesting( | 991 void ProfileIOData::SetCookieSettingsForTesting( |
979 CookieSettings* cookie_settings) { | 992 CookieSettings* cookie_settings) { |
980 DCHECK(!cookie_settings_.get()); | 993 DCHECK(!cookie_settings_.get()); |
981 cookie_settings_ = cookie_settings; | 994 cookie_settings_ = cookie_settings; |
982 } | 995 } |
983 | 996 |
984 void ProfileIOData::set_signin_names_for_testing( | 997 void ProfileIOData::set_signin_names_for_testing( |
985 SigninNamesOnIOThread* signin_names) { | 998 SigninNamesOnIOThread* signin_names) { |
986 signin_names_.reset(signin_names); | 999 signin_names_.reset(signin_names); |
987 } | 1000 } |
OLD | NEW |