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/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 #include "content/public/browser/browser_thread.h" | 45 #include "content/public/browser/browser_thread.h" |
46 #include "content/public/browser/host_zoom_map.h" | 46 #include "content/public/browser/host_zoom_map.h" |
47 #include "content/public/browser/render_process_host.h" | 47 #include "content/public/browser/render_process_host.h" |
48 #include "content/public/browser/storage_partition.h" | 48 #include "content/public/browser/storage_partition.h" |
49 #include "content/public/browser/url_data_source.h" | 49 #include "content/public/browser/url_data_source.h" |
50 #include "content/public/browser/web_contents.h" | 50 #include "content/public/browser/web_contents.h" |
51 #include "net/http/http_server_properties.h" | 51 #include "net/http/http_server_properties.h" |
52 #include "net/http/transport_security_state.h" | 52 #include "net/http/transport_security_state.h" |
53 #include "webkit/database/database_tracker.h" | 53 #include "webkit/database/database_tracker.h" |
54 | 54 |
55 #if defined(OS_ANDROID) | 55 #if defined(OS_ANDROID) || defined(OS_IOS) |
56 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 56 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
57 #endif | 57 #endif // defined(OS_ANDROID) || defined(OS_IOS) |
58 | 58 |
59 #if defined(OS_CHROMEOS) | 59 #if defined(OS_CHROMEOS) |
60 #include "chrome/browser/chromeos/preferences.h" | 60 #include "chrome/browser/chromeos/preferences.h" |
61 #include "chrome/browser/chromeos/proxy_config_service_impl.h" | 61 #include "chrome/browser/chromeos/proxy_config_service_impl.h" |
62 #endif | 62 #endif |
63 | 63 |
64 using content::BrowserThread; | 64 using content::BrowserThread; |
65 using content::DownloadManagerDelegate; | 65 using content::DownloadManagerDelegate; |
66 using content::HostZoomMap; | 66 using content::HostZoomMap; |
67 | 67 |
(...skipping 25 matching lines...) Expand all Loading... |
93 } | 93 } |
94 | 94 |
95 void OffTheRecordProfileImpl::Init() { | 95 void OffTheRecordProfileImpl::Init() { |
96 ProfileDependencyManager::GetInstance()->CreateProfileServices(this, false); | 96 ProfileDependencyManager::GetInstance()->CreateProfileServices(this, false); |
97 | 97 |
98 extensions::ExtensionSystem::Get(this)->InitForOTRProfile(); | 98 extensions::ExtensionSystem::Get(this)->InitForOTRProfile(); |
99 | 99 |
100 DCHECK_NE(IncognitoModePrefs::DISABLED, | 100 DCHECK_NE(IncognitoModePrefs::DISABLED, |
101 IncognitoModePrefs::GetAvailability(profile_->GetPrefs())); | 101 IncognitoModePrefs::GetAvailability(profile_->GetPrefs())); |
102 | 102 |
103 #if defined(OS_ANDROID) | 103 #if defined(OS_ANDROID) || defined(OS_IOS) |
104 UseSystemProxy(); | 104 UseSystemProxy(); |
105 #endif // defined(OS_ANDROID) | 105 #endif // defined(OS_ANDROID) || defined(OS_IOS) |
106 | 106 |
107 // TODO(oshima): Remove the need to eagerly initialize the request context | 107 // TODO(oshima): Remove the need to eagerly initialize the request context |
108 // getter. chromeos::OnlineAttempt is illegally trying to access this | 108 // getter. chromeos::OnlineAttempt is illegally trying to access this |
109 // Profile member from a thread other than the UI thread, so we need to | 109 // Profile member from a thread other than the UI thread, so we need to |
110 // prevent a race. | 110 // prevent a race. |
111 #if defined(OS_CHROMEOS) | 111 #if defined(OS_CHROMEOS) |
112 GetRequestContext(); | 112 GetRequestContext(); |
113 #endif // defined(OS_CHROMEOS) | 113 #endif // defined(OS_CHROMEOS) |
114 | 114 |
115 InitHostZoomMap(); | 115 InitHostZoomMap(); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 void OffTheRecordProfileImpl::InitHostZoomMap() { | 159 void OffTheRecordProfileImpl::InitHostZoomMap() { |
160 HostZoomMap* host_zoom_map = HostZoomMap::GetForBrowserContext(this); | 160 HostZoomMap* host_zoom_map = HostZoomMap::GetForBrowserContext(this); |
161 HostZoomMap* parent_host_zoom_map = | 161 HostZoomMap* parent_host_zoom_map = |
162 HostZoomMap::GetForBrowserContext(profile_); | 162 HostZoomMap::GetForBrowserContext(profile_); |
163 host_zoom_map->CopyFrom(parent_host_zoom_map); | 163 host_zoom_map->CopyFrom(parent_host_zoom_map); |
164 // Observe parent's HZM change for propagating change of parent's | 164 // Observe parent's HZM change for propagating change of parent's |
165 // change to this HZM. | 165 // change to this HZM. |
166 parent_host_zoom_map->AddZoomLevelChangedCallback(zoom_callback_); | 166 parent_host_zoom_map->AddZoomLevelChangedCallback(zoom_callback_); |
167 } | 167 } |
168 | 168 |
169 #if defined(OS_ANDROID) | 169 #if defined(OS_ANDROID) || defined(OS_IOS) |
170 void OffTheRecordProfileImpl::UseSystemProxy() { | 170 void OffTheRecordProfileImpl::UseSystemProxy() { |
171 // Force the use of the system-assigned proxy when off the record. | 171 // Force the use of the system-assigned proxy when off the record. |
172 const char kProxyMode[] = "mode"; | 172 const char kProxyMode[] = "mode"; |
173 const char kProxyServer[] = "server"; | 173 const char kProxyServer[] = "server"; |
174 const char kProxyBypassList[] = "bypass_list"; | 174 const char kProxyBypassList[] = "bypass_list"; |
175 const char kProxyPacUrl[] = "pac_url"; | 175 const char kProxyPacUrl[] = "pac_url"; |
176 DictionaryPrefUpdate update(prefs_, prefs::kProxy); | 176 DictionaryPrefUpdate update(prefs_, prefs::kProxy); |
177 DictionaryValue* dict = update.Get(); | 177 DictionaryValue* dict = update.Get(); |
178 dict->SetString(kProxyMode, ProxyModeToString(ProxyPrefs::MODE_SYSTEM)); | 178 dict->SetString(kProxyMode, ProxyModeToString(ProxyPrefs::MODE_SYSTEM)); |
179 dict->SetString(kProxyPacUrl, ""); | 179 dict->SetString(kProxyPacUrl, ""); |
180 dict->SetString(kProxyServer, ""); | 180 dict->SetString(kProxyServer, ""); |
181 dict->SetString(kProxyBypassList, ""); | 181 dict->SetString(kProxyBypassList, ""); |
182 } | 182 } |
183 #endif // defined(OS_ANDROID) | 183 #endif // defined(OS_ANDROID) || defined(OS_IOS) |
184 | 184 |
185 std::string OffTheRecordProfileImpl::GetProfileName() { | 185 std::string OffTheRecordProfileImpl::GetProfileName() { |
186 // Incognito profile should not return the profile name. | 186 // Incognito profile should not return the profile name. |
187 return std::string(); | 187 return std::string(); |
188 } | 188 } |
189 | 189 |
190 base::FilePath OffTheRecordProfileImpl::GetPath() { | 190 base::FilePath OffTheRecordProfileImpl::GetPath() { |
191 return profile_->GetPath(); | 191 return profile_->GetPath(); |
192 } | 192 } |
193 | 193 |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 case HostZoomMap::ZOOM_CHANGED_FOR_HOST: | 473 case HostZoomMap::ZOOM_CHANGED_FOR_HOST: |
474 host_zoom_map->SetZoomLevelForHost(change.host, change.zoom_level); | 474 host_zoom_map->SetZoomLevelForHost(change.host, change.zoom_level); |
475 return; | 475 return; |
476 case HostZoomMap::ZOOM_CHANGED_FOR_SCHEME_AND_HOST: | 476 case HostZoomMap::ZOOM_CHANGED_FOR_SCHEME_AND_HOST: |
477 host_zoom_map->SetZoomLevelForHostAndScheme(change.scheme, | 477 host_zoom_map->SetZoomLevelForHostAndScheme(change.scheme, |
478 change.host, | 478 change.host, |
479 change.zoom_level); | 479 change.zoom_level); |
480 return; | 480 return; |
481 } | 481 } |
482 } | 482 } |
OLD | NEW |