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_impl.h" | 5 #include "chrome/browser/profiles/profile_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/environment.h" | 9 #include "base/environment.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 #include "content/browser/appcache/chrome_appcache_service.h" | 94 #include "content/browser/appcache/chrome_appcache_service.h" |
95 #include "content/browser/browser_thread.h" | 95 #include "content/browser/browser_thread.h" |
96 #include "content/browser/chrome_blob_storage_context.h" | 96 #include "content/browser/chrome_blob_storage_context.h" |
97 #include "content/browser/file_system/browser_file_system_helper.h" | 97 #include "content/browser/file_system/browser_file_system_helper.h" |
98 #include "content/browser/host_zoom_map.h" | 98 #include "content/browser/host_zoom_map.h" |
99 #include "content/browser/in_process_webkit/webkit_context.h" | 99 #include "content/browser/in_process_webkit/webkit_context.h" |
100 #include "content/browser/renderer_host/render_process_host.h" | 100 #include "content/browser/renderer_host/render_process_host.h" |
101 #include "content/browser/speech/speech_input_manager.h" | 101 #include "content/browser/speech/speech_input_manager.h" |
102 #include "content/browser/ssl/ssl_host_state.h" | 102 #include "content/browser/ssl/ssl_host_state.h" |
103 #include "content/browser/user_metrics.h" | 103 #include "content/browser/user_metrics.h" |
104 #include "content/common/notification_service.h" | 104 #include "content/public/browser/notification_service.h" |
105 #include "grit/browser_resources.h" | 105 #include "grit/browser_resources.h" |
106 #include "grit/locale_settings.h" | 106 #include "grit/locale_settings.h" |
107 #include "net/base/transport_security_state.h" | 107 #include "net/base/transport_security_state.h" |
108 #include "net/http/http_server_properties.h" | 108 #include "net/http/http_server_properties.h" |
109 #include "ui/base/resource/resource_bundle.h" | 109 #include "ui/base/resource/resource_bundle.h" |
110 #include "webkit/database/database_tracker.h" | 110 #include "webkit/database/database_tracker.h" |
111 #include "webkit/quota/quota_manager.h" | 111 #include "webkit/quota/quota_manager.h" |
112 | 112 |
113 #if defined(OS_WIN) | 113 #if defined(OS_WIN) |
114 #include "chrome/browser/instant/promo_counter.h" | 114 #include "chrome/browser/instant/promo_counter.h" |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 g_browser_process->local_state(), | 419 g_browser_process->local_state(), |
420 g_browser_process->io_thread()); | 420 g_browser_process->io_thread()); |
421 | 421 |
422 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( | 422 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( |
423 PluginPrefs::GetForProfile(this), &GetResourceContext()); | 423 PluginPrefs::GetForProfile(this), &GetResourceContext()); |
424 | 424 |
425 // Creation has been finished. | 425 // Creation has been finished. |
426 if (delegate_) | 426 if (delegate_) |
427 delegate_->OnProfileCreated(this, true); | 427 delegate_->OnProfileCreated(this, true); |
428 | 428 |
429 NotificationService::current()->Notify( | 429 content::NotificationService::current()->Notify( |
430 chrome::NOTIFICATION_PROFILE_CREATED, | 430 chrome::NOTIFICATION_PROFILE_CREATED, |
431 content::Source<Profile>(this), | 431 content::Source<Profile>(this), |
432 NotificationService::NoDetails()); | 432 content::NotificationService::NoDetails()); |
433 } | 433 } |
434 | 434 |
435 void ProfileImpl::InitExtensions(bool extensions_enabled) { | 435 void ProfileImpl::InitExtensions(bool extensions_enabled) { |
436 if (user_script_master_ || extension_service_.get()) | 436 if (user_script_master_ || extension_service_.get()) |
437 return; // Already initialized. | 437 return; // Already initialized. |
438 | 438 |
439 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 439 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
440 if (command_line->HasSwitch( | 440 if (command_line->HasSwitch( |
441 switches::kEnableExtensionTimelineApi)) { | 441 switches::kEnableExtensionTimelineApi)) { |
442 extension_devtools_manager_ = new ExtensionDevToolsManager(this); | 442 extension_devtools_manager_ = new ExtensionDevToolsManager(this); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 | 624 |
625 FilePath ProfileImpl::last_selected_directory() { | 625 FilePath ProfileImpl::last_selected_directory() { |
626 return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory); | 626 return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory); |
627 } | 627 } |
628 | 628 |
629 void ProfileImpl::set_last_selected_directory(const FilePath& path) { | 629 void ProfileImpl::set_last_selected_directory(const FilePath& path) { |
630 GetPrefs()->SetFilePath(prefs::kSelectFileLastDirectory, path); | 630 GetPrefs()->SetFilePath(prefs::kSelectFileLastDirectory, path); |
631 } | 631 } |
632 | 632 |
633 ProfileImpl::~ProfileImpl() { | 633 ProfileImpl::~ProfileImpl() { |
634 NotificationService::current()->Notify( | 634 content::NotificationService::current()->Notify( |
635 chrome::NOTIFICATION_PROFILE_DESTROYED, | 635 chrome::NOTIFICATION_PROFILE_DESTROYED, |
636 content::Source<Profile>(this), | 636 content::Source<Profile>(this), |
637 NotificationService::NoDetails()); | 637 content::NotificationService::NoDetails()); |
638 | 638 |
639 if (appcache_service_ && clear_local_state_on_exit_) { | 639 if (appcache_service_ && clear_local_state_on_exit_) { |
640 BrowserThread::PostTask( | 640 BrowserThread::PostTask( |
641 BrowserThread::IO, FROM_HERE, | 641 BrowserThread::IO, FROM_HERE, |
642 NewRunnableMethod( | 642 NewRunnableMethod( |
643 appcache_service_.get(), | 643 appcache_service_.get(), |
644 &appcache::AppCacheService::set_clear_local_state_on_exit, | 644 &appcache::AppCacheService::set_clear_local_state_on_exit, |
645 true)); | 645 true)); |
646 } | 646 } |
647 | 647 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 | 745 |
746 bool ProfileImpl::IsOffTheRecord() { | 746 bool ProfileImpl::IsOffTheRecord() { |
747 return false; | 747 return false; |
748 } | 748 } |
749 | 749 |
750 Profile* ProfileImpl::GetOffTheRecordProfile() { | 750 Profile* ProfileImpl::GetOffTheRecordProfile() { |
751 if (!off_the_record_profile_.get()) { | 751 if (!off_the_record_profile_.get()) { |
752 scoped_ptr<Profile> p(CreateOffTheRecordProfile()); | 752 scoped_ptr<Profile> p(CreateOffTheRecordProfile()); |
753 off_the_record_profile_.swap(p); | 753 off_the_record_profile_.swap(p); |
754 | 754 |
755 NotificationService::current()->Notify( | 755 content::NotificationService::current()->Notify( |
756 chrome::NOTIFICATION_PROFILE_CREATED, | 756 chrome::NOTIFICATION_PROFILE_CREATED, |
757 content::Source<Profile>(off_the_record_profile_.get()), | 757 content::Source<Profile>(off_the_record_profile_.get()), |
758 NotificationService::NoDetails()); | 758 content::NotificationService::NoDetails()); |
759 } | 759 } |
760 return off_the_record_profile_.get(); | 760 return off_the_record_profile_.get(); |
761 } | 761 } |
762 | 762 |
763 void ProfileImpl::DestroyOffTheRecordProfile() { | 763 void ProfileImpl::DestroyOffTheRecordProfile() { |
764 off_the_record_profile_.reset(); | 764 off_the_record_profile_.reset(); |
765 extension_pref_value_map_->ClearAllIncognitoSessionOnlyPreferences(); | 765 extension_pref_value_map_->ClearAllIncognitoSessionOnlyPreferences(); |
766 } | 766 } |
767 | 767 |
768 bool ProfileImpl::HasOffTheRecordProfile() { | 768 bool ProfileImpl::HasOffTheRecordProfile() { |
(...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1677 | 1677 |
1678 void ProfileImpl::ClearNetworkingHistorySince(base::Time time) { | 1678 void ProfileImpl::ClearNetworkingHistorySince(base::Time time) { |
1679 io_data_.ClearNetworkingHistorySince(time); | 1679 io_data_.ClearNetworkingHistorySince(time); |
1680 } | 1680 } |
1681 | 1681 |
1682 SpellCheckProfile* ProfileImpl::GetSpellCheckProfile() { | 1682 SpellCheckProfile* ProfileImpl::GetSpellCheckProfile() { |
1683 if (!spellcheck_profile_.get()) | 1683 if (!spellcheck_profile_.get()) |
1684 spellcheck_profile_.reset(new SpellCheckProfile()); | 1684 spellcheck_profile_.reset(new SpellCheckProfile()); |
1685 return spellcheck_profile_.get(); | 1685 return spellcheck_profile_.get(); |
1686 } | 1686 } |
OLD | NEW |