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/off_the_record_profile_impl.h" | 5 #include "chrome/browser/profiles/off_the_record_profile_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 #if defined(OS_ANDROID) || defined(OS_IOS) | 59 #if defined(OS_ANDROID) || defined(OS_IOS) |
60 #include "base/prefs/scoped_user_pref_update.h" | 60 #include "base/prefs/scoped_user_pref_update.h" |
61 #include "chrome/browser/prefs/proxy_prefs.h" | 61 #include "chrome/browser/prefs/proxy_prefs.h" |
62 #endif // defined(OS_ANDROID) || defined(OS_IOS) | 62 #endif // defined(OS_ANDROID) || defined(OS_IOS) |
63 | 63 |
64 #if defined(OS_CHROMEOS) | 64 #if defined(OS_CHROMEOS) |
65 #include "chrome/browser/chromeos/preferences.h" | 65 #include "chrome/browser/chromeos/preferences.h" |
66 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 66 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
67 #endif | 67 #endif |
68 | 68 |
| 69 #if defined(ENABLE_CONFIGURATION_POLICY) && !defined(OS_CHROMEOS) |
| 70 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" |
| 71 #endif |
| 72 |
69 using content::BrowserThread; | 73 using content::BrowserThread; |
70 using content::DownloadManagerDelegate; | 74 using content::DownloadManagerDelegate; |
71 using content::HostZoomMap; | 75 using content::HostZoomMap; |
72 | 76 |
73 namespace { | 77 namespace { |
74 | 78 |
75 void NotifyOTRProfileCreatedOnIOThread(void* original_profile, | 79 void NotifyOTRProfileCreatedOnIOThread(void* original_profile, |
76 void* otr_profile) { | 80 void* otr_profile) { |
77 ExtensionWebRequestEventRouter::GetInstance()->OnOTRProfileCreated( | 81 ExtensionWebRequestEventRouter::GetInstance()->OnOTRProfileCreated( |
78 original_profile, otr_profile); | 82 original_profile, otr_profile); |
(...skipping 10 matching lines...) Expand all Loading... |
89 OffTheRecordProfileImpl::OffTheRecordProfileImpl(Profile* real_profile) | 93 OffTheRecordProfileImpl::OffTheRecordProfileImpl(Profile* real_profile) |
90 : profile_(real_profile), | 94 : profile_(real_profile), |
91 prefs_(PrefServiceSyncable::IncognitoFromProfile(real_profile)), | 95 prefs_(PrefServiceSyncable::IncognitoFromProfile(real_profile)), |
92 io_data_(this), | 96 io_data_(this), |
93 start_time_(Time::Now()) { | 97 start_time_(Time::Now()) { |
94 // Register on BrowserContext. | 98 // Register on BrowserContext. |
95 user_prefs::UserPrefs::Set(this, prefs_); | 99 user_prefs::UserPrefs::Set(this, prefs_); |
96 } | 100 } |
97 | 101 |
98 void OffTheRecordProfileImpl::Init() { | 102 void OffTheRecordProfileImpl::Init() { |
| 103 #if defined(ENABLE_CONFIGURATION_POLICY) && !defined(OS_CHROMEOS) |
| 104 // Because UserCloudPolicyManager is in a component, it cannot access |
| 105 // GetOriginalProfile. Instead, we have to inject this relation here. |
| 106 policy::UserCloudPolicyManagerFactory::RegisterForOffTheRecordProfile( |
| 107 this->GetOriginalProfile(), this); |
| 108 #endif |
| 109 |
99 BrowserContextDependencyManager::GetInstance()->CreateBrowserContextServices( | 110 BrowserContextDependencyManager::GetInstance()->CreateBrowserContextServices( |
100 this); | 111 this); |
101 | 112 |
102 DCHECK_NE(IncognitoModePrefs::DISABLED, | 113 DCHECK_NE(IncognitoModePrefs::DISABLED, |
103 IncognitoModePrefs::GetAvailability(profile_->GetPrefs())); | 114 IncognitoModePrefs::GetAvailability(profile_->GetPrefs())); |
104 | 115 |
105 #if defined(OS_ANDROID) || defined(OS_IOS) | 116 #if defined(OS_ANDROID) || defined(OS_IOS) |
106 UseSystemProxy(); | 117 UseSystemProxy(); |
107 #endif // defined(OS_ANDROID) || defined(OS_IOS) | 118 #endif // defined(OS_ANDROID) || defined(OS_IOS) |
108 | 119 |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 PrefProxyConfigTracker* OffTheRecordProfileImpl::CreateProxyConfigTracker() { | 509 PrefProxyConfigTracker* OffTheRecordProfileImpl::CreateProxyConfigTracker() { |
499 #if defined(OS_CHROMEOS) | 510 #if defined(OS_CHROMEOS) |
500 if (chromeos::ProfileHelper::IsSigninProfile(this)) { | 511 if (chromeos::ProfileHelper::IsSigninProfile(this)) { |
501 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( | 512 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( |
502 g_browser_process->local_state()); | 513 g_browser_process->local_state()); |
503 } | 514 } |
504 #endif // defined(OS_CHROMEOS) | 515 #endif // defined(OS_CHROMEOS) |
505 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( | 516 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( |
506 GetPrefs(), g_browser_process->local_state()); | 517 GetPrefs(), g_browser_process->local_state()); |
507 } | 518 } |
OLD | NEW |