Chromium Code Reviews| 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" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/prefs/json_pref_store.h" | 13 #include "base/prefs/json_pref_store.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 #include "chrome/browser/background/background_contents_service_factory.h" | 17 #include "chrome/browser/background/background_contents_service_factory.h" |
| 18 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/browser/dom_distiller/profile_utils.h" | 19 #include "chrome/browser/dom_distiller/profile_utils.h" |
| 20 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 20 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
| 21 #include "chrome/browser/download/download_service.h" | 21 #include "chrome/browser/download/download_service.h" |
| 22 #include "chrome/browser/download/download_service_factory.h" | 22 #include "chrome/browser/download/download_service_factory.h" |
| 23 #include "chrome/browser/io_thread.h" | 23 #include "chrome/browser/io_thread.h" |
| 24 #include "chrome/browser/net/chrome_url_request_context_getter.h" | 24 #include "chrome/browser/net/chrome_url_request_context_getter.h" |
| 25 #include "chrome/browser/net/pref_proxy_config_tracker.h" | 25 #include "chrome/browser/net/pref_proxy_config_tracker.h" |
| 26 #include "chrome/browser/net/proxy_service_factory.h" | 26 #include "chrome/browser/net/proxy_service_factory.h" |
| 27 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator. h" | |
| 27 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" | 28 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" |
| 28 #include "chrome/browser/plugins/plugin_prefs.h" | 29 #include "chrome/browser/plugins/plugin_prefs.h" |
| 29 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 30 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 30 #include "chrome/browser/prefs/pref_service_syncable.h" | 31 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 31 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" | 32 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" |
| 32 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h" | 33 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h" |
| 33 #include "chrome/browser/themes/theme_service.h" | 34 #include "chrome/browser/themes/theme_service.h" |
| 34 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 35 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
| 35 #include "chrome/common/chrome_constants.h" | 36 #include "chrome/common/chrome_constants.h" |
| 36 #include "chrome/common/chrome_paths.h" | 37 #include "chrome/common/chrome_paths.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 #endif | 125 #endif |
| 125 | 126 |
| 126 BrowserContextDependencyManager::GetInstance()->CreateBrowserContextServices( | 127 BrowserContextDependencyManager::GetInstance()->CreateBrowserContextServices( |
| 127 this); | 128 this); |
| 128 | 129 |
| 129 // Guest profiles may always be OTR. Check IncognitoModePrefs otherwise. | 130 // Guest profiles may always be OTR. Check IncognitoModePrefs otherwise. |
| 130 DCHECK(profile_->IsGuestSession() || | 131 DCHECK(profile_->IsGuestSession() || |
| 131 IncognitoModePrefs::GetAvailability(profile_->GetPrefs()) != | 132 IncognitoModePrefs::GetAvailability(profile_->GetPrefs()) != |
| 132 IncognitoModePrefs::DISABLED); | 133 IncognitoModePrefs::DISABLED); |
| 133 | 134 |
| 134 #if defined(OS_ANDROID) || defined(OS_IOS) | 135 DataReductionProxyChromeConfigurator* data_reduction_proxy_configurator = |
| 135 UseSystemProxy(); | 136 new DataReductionProxyChromeConfigurator( |
| 136 #endif // defined(OS_ANDROID) || defined(OS_IOS) | 137 prefs_, |
| 138 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | |
| 139 data_reduction_proxy_configurator->Disable(); | |
|
bengr
2014/10/27 23:28:01
Could this be a static function called:
void DataR
Not at Google. Contact bengr
2014/10/28 19:51:03
Done.
| |
| 137 | 140 |
| 138 // TODO(oshima): Remove the need to eagerly initialize the request context | 141 // TODO(oshima): Remove the need to eagerly initialize the request context |
| 139 // getter. chromeos::OnlineAttempt is illegally trying to access this | 142 // getter. chromeos::OnlineAttempt is illegally trying to access this |
| 140 // Profile member from a thread other than the UI thread, so we need to | 143 // Profile member from a thread other than the UI thread, so we need to |
| 141 // prevent a race. | 144 // prevent a race. |
| 142 #if defined(OS_CHROMEOS) | 145 #if defined(OS_CHROMEOS) |
| 143 GetRequestContext(); | 146 GetRequestContext(); |
| 144 #endif // defined(OS_CHROMEOS) | 147 #endif // defined(OS_CHROMEOS) |
| 145 | 148 |
| 146 InitHostZoomMap(); | 149 InitHostZoomMap(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 204 HostZoomMap* parent_host_zoom_map = | 207 HostZoomMap* parent_host_zoom_map = |
| 205 HostZoomMap::GetDefaultForBrowserContext(profile_); | 208 HostZoomMap::GetDefaultForBrowserContext(profile_); |
| 206 host_zoom_map->CopyFrom(parent_host_zoom_map); | 209 host_zoom_map->CopyFrom(parent_host_zoom_map); |
| 207 // Observe parent's HZM change for propagating change of parent's | 210 // Observe parent's HZM change for propagating change of parent's |
| 208 // change to this HZM. | 211 // change to this HZM. |
| 209 zoom_subscription_ = parent_host_zoom_map->AddZoomLevelChangedCallback( | 212 zoom_subscription_ = parent_host_zoom_map->AddZoomLevelChangedCallback( |
| 210 base::Bind(&OffTheRecordProfileImpl::OnZoomLevelChanged, | 213 base::Bind(&OffTheRecordProfileImpl::OnZoomLevelChanged, |
| 211 base::Unretained(this))); | 214 base::Unretained(this))); |
| 212 } | 215 } |
| 213 | 216 |
| 214 #if defined(OS_ANDROID) || defined(OS_IOS) | |
| 215 void OffTheRecordProfileImpl::UseSystemProxy() { | |
| 216 // Force the use of the system-assigned proxy when off the record. | |
| 217 const char kProxyMode[] = "mode"; | |
| 218 const char kProxyServer[] = "server"; | |
| 219 const char kProxyBypassList[] = "bypass_list"; | |
| 220 const char kProxyPacUrl[] = "pac_url"; | |
| 221 DictionaryPrefUpdate update(prefs_, prefs::kProxy); | |
| 222 base::DictionaryValue* dict = update.Get(); | |
| 223 dict->SetString(kProxyMode, ProxyModeToString(ProxyPrefs::MODE_SYSTEM)); | |
| 224 dict->SetString(kProxyPacUrl, ""); | |
| 225 dict->SetString(kProxyServer, ""); | |
| 226 dict->SetString(kProxyBypassList, ""); | |
| 227 } | |
| 228 #endif // defined(OS_ANDROID) || defined(OS_IOS) | |
| 229 | |
| 230 std::string OffTheRecordProfileImpl::GetProfileName() { | 217 std::string OffTheRecordProfileImpl::GetProfileName() { |
| 231 // Incognito profile should not return the profile name. | 218 // Incognito profile should not return the profile name. |
| 232 return std::string(); | 219 return std::string(); |
| 233 } | 220 } |
| 234 | 221 |
| 235 Profile::ProfileType OffTheRecordProfileImpl::GetProfileType() const { | 222 Profile::ProfileType OffTheRecordProfileImpl::GetProfileType() const { |
| 236 return INCOGNITO_PROFILE; | 223 return INCOGNITO_PROFILE; |
| 237 } | 224 } |
| 238 | 225 |
| 239 base::FilePath OffTheRecordProfileImpl::GetPath() const { | 226 base::FilePath OffTheRecordProfileImpl::GetPath() const { |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 546 PrefProxyConfigTracker* OffTheRecordProfileImpl::CreateProxyConfigTracker() { | 533 PrefProxyConfigTracker* OffTheRecordProfileImpl::CreateProxyConfigTracker() { |
| 547 #if defined(OS_CHROMEOS) | 534 #if defined(OS_CHROMEOS) |
| 548 if (chromeos::ProfileHelper::IsSigninProfile(this)) { | 535 if (chromeos::ProfileHelper::IsSigninProfile(this)) { |
| 549 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( | 536 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( |
| 550 g_browser_process->local_state()); | 537 g_browser_process->local_state()); |
| 551 } | 538 } |
| 552 #endif // defined(OS_CHROMEOS) | 539 #endif // defined(OS_CHROMEOS) |
| 553 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( | 540 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( |
| 554 GetPrefs(), g_browser_process->local_state()); | 541 GetPrefs(), g_browser_process->local_state()); |
| 555 } | 542 } |
| OLD | NEW |