OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "chrome/browser/profiles/profile.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
15 #include "base/string_util.h" | 15 #include "base/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/content_settings/host_content_settings_map.h" | 19 #include "chrome/browser/content_settings/host_content_settings_map.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_manager.h" | 21 #include "chrome/browser/download/download_manager.h" |
22 #include "chrome/browser/extensions/extension_info_map.h" | 22 #include "chrome/browser/extensions/extension_info_map.h" |
23 #include "chrome/browser/extensions/extension_message_service.h" | 23 #include "chrome/browser/extensions/extension_message_service.h" |
24 #include "chrome/browser/extensions/extension_pref_store.h" | 24 #include "chrome/browser/extensions/extension_pref_store.h" |
25 #include "chrome/browser/extensions/extension_process_manager.h" | 25 #include "chrome/browser/extensions/extension_process_manager.h" |
26 #include "chrome/browser/extensions/extension_service.h" | 26 #include "chrome/browser/extensions/extension_service.h" |
27 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 27 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
28 #include "chrome/browser/extensions/extension_webrequest_api.h" | 28 #include "chrome/browser/extensions/extension_webrequest_api.h" |
29 #include "chrome/browser/io_thread.h" | |
willchan no longer on Chromium
2011/08/10 07:04:08
Is this include needed still?
rpetterson
2011/08/12 03:12:36
Nope. Removed.
| |
30 #include "chrome/browser/net/predictor.h" | |
29 #include "chrome/browser/net/pref_proxy_config_service.h" | 31 #include "chrome/browser/net/pref_proxy_config_service.h" |
30 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 32 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
31 #include "chrome/browser/prefs/pref_service.h" | 33 #include "chrome/browser/prefs/pref_service.h" |
32 #include "chrome/browser/profiles/off_the_record_profile_io_data.h" | 34 #include "chrome/browser/profiles/off_the_record_profile_io_data.h" |
33 #include "chrome/browser/profiles/profile_dependency_manager.h" | 35 #include "chrome/browser/profiles/profile_dependency_manager.h" |
34 #include "chrome/browser/sync/profile_sync_service.h" | 36 #include "chrome/browser/sync/profile_sync_service.h" |
35 #include "chrome/browser/themes/theme_service.h" | 37 #include "chrome/browser/themes/theme_service.h" |
36 #include "chrome/browser/transport_security_persister.h" | 38 #include "chrome/browser/transport_security_persister.h" |
37 #include "chrome/browser/ui/browser_list.h" | 39 #include "chrome/browser/ui/browser_list.h" |
38 #include "chrome/browser/ui/find_bar/find_bar_state.h" | 40 #include "chrome/browser/ui/find_bar/find_bar_state.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
218 #endif | 220 #endif |
219 } | 221 } |
220 | 222 |
221 bool Profile::IsSyncAccessible() { | 223 bool Profile::IsSyncAccessible() { |
222 ProfileSyncService* syncService = GetProfileSyncService(); | 224 ProfileSyncService* syncService = GetProfileSyncService(); |
223 return syncService && !syncService->IsManaged(); | 225 return syncService && !syncService->IsManaged(); |
224 } | 226 } |
225 | 227 |
226 //////////////////////////////////////////////////////////////////////////////// | 228 //////////////////////////////////////////////////////////////////////////////// |
227 // | 229 // |
230 // This section supports the about:dns page. | |
231 // | |
232 //////////////////////////////////////////////////////////////////////////////// | |
233 | |
234 // Provide global support for the about:dns page. | |
235 void Profile::PredictorGetHtmlInfo(std::string* output) { | |
236 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
237 | |
238 output->append("<html><head><title>About DNS</title>" | |
239 // We'd like the following no-cache... but it doesn't work. | |
240 // "<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">" | |
241 "</head><body>"); | |
242 chrome_browser_net::Predictor* predictor = GetNetworkPredictor(); | |
243 if (predictor && predictor->predictor_enabled()) { | |
244 output->append("DNS pre-resolution and TCP pre-connection is disabled."); | |
245 } else { | |
246 predictor->GetHtmlInfo(output); | |
247 } | |
248 output->append("</body></html>"); | |
249 } | |
250 | |
251 //////////////////////////////////////////////////////////////////////////////// | |
252 // | |
228 // OffTheRecordProfileImpl is a profile subclass that wraps an existing profile | 253 // OffTheRecordProfileImpl is a profile subclass that wraps an existing profile |
229 // to make it suitable for the incognito mode. | 254 // to make it suitable for the incognito mode. |
230 // | 255 // |
231 //////////////////////////////////////////////////////////////////////////////// | 256 //////////////////////////////////////////////////////////////////////////////// |
232 class OffTheRecordProfileImpl : public Profile, | 257 class OffTheRecordProfileImpl : public Profile, |
233 public BrowserList::Observer { | 258 public BrowserList::Observer { |
234 public: | 259 public: |
235 explicit OffTheRecordProfileImpl(Profile* real_profile) | 260 explicit OffTheRecordProfileImpl(Profile* real_profile) |
236 : profile_(real_profile), | 261 : profile_(real_profile), |
237 prefs_(real_profile->GetOffTheRecordPrefs()), | 262 prefs_(real_profile->GetOffTheRecordPrefs()), |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
867 }; | 892 }; |
868 #endif | 893 #endif |
869 | 894 |
870 Profile* Profile::CreateOffTheRecordProfile() { | 895 Profile* Profile::CreateOffTheRecordProfile() { |
871 #if defined(OS_CHROMEOS) | 896 #if defined(OS_CHROMEOS) |
872 if (Profile::IsGuestSession()) | 897 if (Profile::IsGuestSession()) |
873 return new GuestSessionProfile(this); | 898 return new GuestSessionProfile(this); |
874 #endif | 899 #endif |
875 return new OffTheRecordProfileImpl(this); | 900 return new OffTheRecordProfileImpl(this); |
876 } | 901 } |
OLD | NEW |