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_path.h" | 10 #include "base/file_path.h" |
(...skipping 16 matching lines...) Expand all Loading... |
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_system.h" | 28 #include "chrome/browser/extensions/extension_system.h" |
29 #include "chrome/browser/io_thread.h" | 29 #include "chrome/browser/io_thread.h" |
30 #include "chrome/browser/net/proxy_service_factory.h" | 30 #include "chrome/browser/net/proxy_service_factory.h" |
31 #include "chrome/browser/plugin_prefs.h" | 31 #include "chrome/browser/plugin_prefs.h" |
32 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 32 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
33 #include "chrome/browser/prefs/pref_service.h" | 33 #include "chrome/browser/prefs/pref_service.h" |
34 #include "chrome/browser/profiles/profile_dependency_manager.h" | 34 #include "chrome/browser/profiles/profile_dependency_manager.h" |
35 #include "chrome/browser/themes/theme_service.h" | 35 #include "chrome/browser/themes/theme_service.h" |
36 #include "chrome/browser/transport_security_persister.h" | 36 #include "chrome/browser/transport_security_persister.h" |
37 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 37 #include "chrome/browser/ui/webui/chrome_url_data_manager_factory.h" |
38 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 38 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
39 #include "chrome/common/chrome_constants.h" | 39 #include "chrome/common/chrome_constants.h" |
40 #include "chrome/common/chrome_notification_types.h" | 40 #include "chrome/common/chrome_notification_types.h" |
41 #include "chrome/common/chrome_paths.h" | 41 #include "chrome/common/chrome_paths.h" |
42 #include "chrome/common/chrome_switches.h" | 42 #include "chrome/common/chrome_switches.h" |
43 #include "chrome/common/extensions/extension.h" | 43 #include "chrome/common/extensions/extension.h" |
44 #include "chrome/common/json_pref_store.h" | 44 #include "chrome/common/json_pref_store.h" |
45 #include "chrome/common/pref_names.h" | 45 #include "chrome/common/pref_names.h" |
46 #include "chrome/common/render_messages.h" | 46 #include "chrome/common/render_messages.h" |
47 #include "content/public/browser/browser_thread.h" | 47 #include "content/public/browser/browser_thread.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // Profile member from a thread other than the UI thread, so we need to | 95 // Profile member from a thread other than the UI thread, so we need to |
96 // prevent a race. | 96 // prevent a race. |
97 #if defined(OS_CHROMEOS) | 97 #if defined(OS_CHROMEOS) |
98 GetRequestContext(); | 98 GetRequestContext(); |
99 #endif // defined(OS_CHROMEOS) | 99 #endif // defined(OS_CHROMEOS) |
100 | 100 |
101 InitHostZoomMap(); | 101 InitHostZoomMap(); |
102 | 102 |
103 // Make the chrome//extension-icon/ resource available. | 103 // Make the chrome//extension-icon/ resource available. |
104 ExtensionIconSource* icon_source = new ExtensionIconSource(profile_); | 104 ExtensionIconSource* icon_source = new ExtensionIconSource(profile_); |
105 GetChromeURLDataManager()->AddDataSource(icon_source); | 105 ChromeURLDataManager::AddDataSource(this, icon_source); |
106 | 106 |
107 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( | 107 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( |
108 PluginPrefs::GetForProfile(this), io_data_.GetResourceContextNoInit()); | 108 PluginPrefs::GetForProfile(this), io_data_.GetResourceContextNoInit()); |
109 | 109 |
110 BrowserThread::PostTask( | 110 BrowserThread::PostTask( |
111 BrowserThread::IO, FROM_HERE, | 111 BrowserThread::IO, FROM_HERE, |
112 base::Bind(&NotifyOTRProfileCreatedOnIOThread, profile_, this)); | 112 base::Bind(&NotifyOTRProfileCreatedOnIOThread, profile_, this)); |
113 } | 113 } |
114 | 114 |
115 OffTheRecordProfileImpl::~OffTheRecordProfileImpl() { | 115 OffTheRecordProfileImpl::~OffTheRecordProfileImpl() { |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 void OffTheRecordProfileImpl::SetupChromeOSEnterpriseExtensionObserver() { | 403 void OffTheRecordProfileImpl::SetupChromeOSEnterpriseExtensionObserver() { |
404 profile_->SetupChromeOSEnterpriseExtensionObserver(); | 404 profile_->SetupChromeOSEnterpriseExtensionObserver(); |
405 } | 405 } |
406 | 406 |
407 void OffTheRecordProfileImpl::InitChromeOSPreferences() { | 407 void OffTheRecordProfileImpl::InitChromeOSPreferences() { |
408 // The incognito profile shouldn't have Chrome OS's preferences. | 408 // The incognito profile shouldn't have Chrome OS's preferences. |
409 // The preferences are associated with the regular user profile. | 409 // The preferences are associated with the regular user profile. |
410 } | 410 } |
411 #endif // defined(OS_CHROMEOS) | 411 #endif // defined(OS_CHROMEOS) |
412 | 412 |
413 ChromeURLDataManager* OffTheRecordProfileImpl::GetChromeURLDataManager() { | |
414 if (!chrome_url_data_manager_.get()) | |
415 chrome_url_data_manager_.reset(new ChromeURLDataManager( | |
416 io_data_.GetChromeURLDataManagerBackendGetter())); | |
417 return chrome_url_data_manager_.get(); | |
418 } | |
419 | |
420 #if defined(OS_CHROMEOS) | 413 #if defined(OS_CHROMEOS) |
421 void OffTheRecordProfileImpl::ChangeAppLocale(const std::string& locale, | 414 void OffTheRecordProfileImpl::ChangeAppLocale(const std::string& locale, |
422 AppLocaleChangedVia) { | 415 AppLocaleChangedVia) { |
423 } | 416 } |
424 | 417 |
425 void OffTheRecordProfileImpl::OnLogin() { | 418 void OffTheRecordProfileImpl::OnLogin() { |
426 } | 419 } |
427 #endif // defined(OS_CHROMEOS) | 420 #endif // defined(OS_CHROMEOS) |
428 | 421 |
429 PrefProxyConfigTracker* OffTheRecordProfileImpl::GetProxyConfigTracker() { | 422 PrefProxyConfigTracker* OffTheRecordProfileImpl::GetProxyConfigTracker() { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 OffTheRecordProfileImpl* profile = NULL; | 482 OffTheRecordProfileImpl* profile = NULL; |
490 #if defined(OS_CHROMEOS) | 483 #if defined(OS_CHROMEOS) |
491 if (Profile::IsGuestSession()) | 484 if (Profile::IsGuestSession()) |
492 profile = new GuestSessionProfile(this); | 485 profile = new GuestSessionProfile(this); |
493 #endif | 486 #endif |
494 if (!profile) | 487 if (!profile) |
495 profile = new OffTheRecordProfileImpl(this); | 488 profile = new OffTheRecordProfileImpl(this); |
496 profile->Init(); | 489 profile->Init(); |
497 return profile; | 490 return profile; |
498 } | 491 } |
| 492 |
| 493 base::Callback<ChromeURLDataManagerBackend*(void)> |
| 494 OffTheRecordProfileImpl::GetChromeURLDataManagerBackendGetter() const { |
| 495 return io_data_.GetChromeURLDataManagerBackendGetter(); |
| 496 } |
OLD | NEW |