Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Side by Side Diff: chrome/browser/profiles/profile_impl.cc

Issue 10795056: Remove last references to profile->GetHistory() and profile->GetBookmarkModel() (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/profiles/profile_impl.h ('k') | chrome/test/base/profile_mock.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/profile_impl.h" 5 #include "chrome/browser/profiles/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/environment.h" 10 #include "base/environment.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_number_conversions.h" 15 #include "base/string_number_conversions.h"
16 #include "base/string_tokenizer.h" 16 #include "base/string_tokenizer.h"
17 #include "base/string_util.h" 17 #include "base/string_util.h"
18 #include "base/stringprintf.h" 18 #include "base/stringprintf.h"
19 #include "base/utf_string_conversions.h" 19 #include "base/utf_string_conversions.h"
20 #include "base/version.h" 20 #include "base/version.h"
21 #include "chrome/browser/autocomplete/autocomplete_classifier.h" 21 #include "chrome/browser/autocomplete/autocomplete_classifier.h"
22 #include "chrome/browser/background/background_contents_service_factory.h" 22 #include "chrome/browser/background/background_contents_service_factory.h"
23 #include "chrome/browser/background/background_mode_manager.h" 23 #include "chrome/browser/background/background_mode_manager.h"
24 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
25 #include "chrome/browser/browser_process.h" 24 #include "chrome/browser/browser_process.h"
26 #include "chrome/browser/chrome_plugin_service_filter.h" 25 #include "chrome/browser/chrome_plugin_service_filter.h"
27 #include "chrome/browser/content_settings/cookie_settings.h" 26 #include "chrome/browser/content_settings/cookie_settings.h"
28 #include "chrome/browser/content_settings/host_content_settings_map.h" 27 #include "chrome/browser/content_settings/host_content_settings_map.h"
29 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" 28 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
30 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" 29 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
31 #include "chrome/browser/download/chrome_download_manager_delegate.h" 30 #include "chrome/browser/download/chrome_download_manager_delegate.h"
32 #include "chrome/browser/download/download_service.h" 31 #include "chrome/browser/download/download_service.h"
33 #include "chrome/browser/download/download_service_factory.h" 32 #include "chrome/browser/download/download_service_factory.h"
34 #include "chrome/browser/extensions/event_router.h" 33 #include "chrome/browser/extensions/event_router.h"
35 #include "chrome/browser/extensions/extension_pref_store.h" 34 #include "chrome/browser/extensions/extension_pref_store.h"
36 #include "chrome/browser/extensions/extension_pref_value_map.h" 35 #include "chrome/browser/extensions/extension_pref_value_map.h"
37 #include "chrome/browser/extensions/extension_pref_value_map_factory.h" 36 #include "chrome/browser/extensions/extension_pref_value_map_factory.h"
38 #include "chrome/browser/extensions/extension_process_manager.h" 37 #include "chrome/browser/extensions/extension_process_manager.h"
39 #include "chrome/browser/extensions/extension_service.h" 38 #include "chrome/browser/extensions/extension_service.h"
40 #include "chrome/browser/extensions/extension_special_storage_policy.h" 39 #include "chrome/browser/extensions/extension_special_storage_policy.h"
41 #include "chrome/browser/extensions/extension_system.h" 40 #include "chrome/browser/extensions/extension_system.h"
42 #include "chrome/browser/extensions/user_script_master.h" 41 #include "chrome/browser/extensions/user_script_master.h"
43 #include "chrome/browser/favicon/favicon_service.h" 42 #include "chrome/browser/favicon/favicon_service.h"
44 #include "chrome/browser/geolocation/chrome_geolocation_permission_context.h" 43 #include "chrome/browser/geolocation/chrome_geolocation_permission_context.h"
45 #include "chrome/browser/history/history.h"
46 #include "chrome/browser/history/history_service_factory.h"
47 #include "chrome/browser/history/shortcuts_backend.h" 44 #include "chrome/browser/history/shortcuts_backend.h"
48 #include "chrome/browser/history/top_sites.h" 45 #include "chrome/browser/history/top_sites.h"
49 #include "chrome/browser/instant/instant_controller.h" 46 #include "chrome/browser/instant/instant_controller.h"
50 #include "chrome/browser/metrics/metrics_service.h" 47 #include "chrome/browser/metrics/metrics_service.h"
51 #include "chrome/browser/net/chrome_url_request_context.h" 48 #include "chrome/browser/net/chrome_url_request_context.h"
52 #include "chrome/browser/net/net_pref_observer.h" 49 #include "chrome/browser/net/net_pref_observer.h"
53 #include "chrome/browser/net/predictor.h" 50 #include "chrome/browser/net/predictor.h"
54 #include "chrome/browser/net/proxy_service_factory.h" 51 #include "chrome/browser/net/proxy_service_factory.h"
55 #include "chrome/browser/net/ssl_config_service_manager.h" 52 #include "chrome/browser/net/ssl_config_service_manager.h"
56 #include "chrome/browser/net/url_fixer_upper.h" 53 #include "chrome/browser/net/url_fixer_upper.h"
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 if (off_the_record_profile_.get()) { 504 if (off_the_record_profile_.get()) {
508 ProfileDestroyer::DestroyOffTheRecordProfileNow( 505 ProfileDestroyer::DestroyOffTheRecordProfileNow(
509 off_the_record_profile_.get()); 506 off_the_record_profile_.get());
510 } else { 507 } else {
511 ExtensionPrefValueMapFactory::GetForProfile(this)-> 508 ExtensionPrefValueMapFactory::GetForProfile(this)->
512 ClearAllIncognitoSessionOnlyPreferences(); 509 ClearAllIncognitoSessionOnlyPreferences();
513 } 510 }
514 511
515 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); 512 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this);
516 513
517 // The HistoryService maintains threads for background processing. Its
518 // possible each thread still has tasks on it that have increased the ref
519 // count of the service. In such a situation, when we decrement the refcount,
520 // it won't be 0, and the threads/databases aren't properly shut down. By
521 // explicitly calling Cleanup/Shutdown we ensure the databases are properly
522 // closed.
523
524 if (top_sites_.get()) 514 if (top_sites_.get())
525 top_sites_->Shutdown(); 515 top_sites_->Shutdown();
526 516
527 // FaviconService depends on HistoryServce so make sure we delete 517 // FaviconService depends on HistoryServce so make sure we delete
528 // HistoryService first. 518 // HistoryService first.
529 favicon_service_.reset(); 519 favicon_service_.reset();
530 520
531 if (pref_proxy_config_tracker_.get()) 521 if (pref_proxy_config_tracker_.get())
532 pref_proxy_config_tracker_->DetachFromPrefService(); 522 pref_proxy_config_tracker_->DetachFromPrefService();
533 523
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 } 764 }
775 765
776 GAIAInfoUpdateService* ProfileImpl::GetGAIAInfoUpdateService() { 766 GAIAInfoUpdateService* ProfileImpl::GetGAIAInfoUpdateService() {
777 if (!gaia_info_update_service_.get() && 767 if (!gaia_info_update_service_.get() &&
778 GAIAInfoUpdateService::ShouldUseGAIAProfileInfo(this)) { 768 GAIAInfoUpdateService::ShouldUseGAIAProfileInfo(this)) {
779 gaia_info_update_service_.reset(new GAIAInfoUpdateService(this)); 769 gaia_info_update_service_.reset(new GAIAInfoUpdateService(this));
780 } 770 }
781 return gaia_info_update_service_.get(); 771 return gaia_info_update_service_.get();
782 } 772 }
783 773
784 HistoryService* ProfileImpl::GetHistoryService(ServiceAccessType sat) {
785 return HistoryServiceFactory::GetForProfile(this, sat).get();
786 }
787
788 HistoryService* ProfileImpl::GetHistoryServiceWithoutCreating() {
789 return HistoryServiceFactory::GetForProfileWithoutCreating(this).get();
790 }
791
792 DownloadManagerDelegate* ProfileImpl::GetDownloadManagerDelegate() { 774 DownloadManagerDelegate* ProfileImpl::GetDownloadManagerDelegate() {
793 return DownloadServiceFactory::GetForProfile(this)-> 775 return DownloadServiceFactory::GetForProfile(this)->
794 GetDownloadManagerDelegate(); 776 GetDownloadManagerDelegate();
795 } 777 }
796 778
797 bool ProfileImpl::DidLastSessionExitCleanly() { 779 bool ProfileImpl::DidLastSessionExitCleanly() {
798 // last_session_exited_cleanly_ is set when the preferences are loaded. Force 780 // last_session_exited_cleanly_ is set when the preferences are loaded. Force
799 // it to be set by asking for the prefs. 781 // it to be set by asking for the prefs.
800 GetPrefs(); 782 GetPrefs();
801 return last_session_exited_cleanly_; 783 return last_session_exited_cleanly_;
802 } 784 }
803 785
804 quota::SpecialStoragePolicy* ProfileImpl::GetSpecialStoragePolicy() { 786 quota::SpecialStoragePolicy* ProfileImpl::GetSpecialStoragePolicy() {
805 return GetExtensionSpecialStoragePolicy(); 787 return GetExtensionSpecialStoragePolicy();
806 } 788 }
807 789
808 BookmarkModel* ProfileImpl::GetBookmarkModel() {
809 return BookmarkModelFactory::GetForProfile(this);
810 }
811
812 ProtocolHandlerRegistry* ProfileImpl::GetProtocolHandlerRegistry() { 790 ProtocolHandlerRegistry* ProfileImpl::GetProtocolHandlerRegistry() {
813 // TODO(smckay): Update all existing callers to use 791 // TODO(smckay): Update all existing callers to use
814 // ProtocolHandlerRegistryFactory. Once that's done, this method 792 // ProtocolHandlerRegistryFactory. Once that's done, this method
815 // can be nuked from Profile and ProfileImpl. 793 // can be nuked from Profile and ProfileImpl.
816 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 794 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
817 return ProtocolHandlerRegistryFactory::GetForProfile(this); 795 return ProtocolHandlerRegistryFactory::GetForProfile(this);
818 } 796 }
819 797
820 bool ProfileImpl::IsSameProfile(Profile* profile) { 798 bool ProfileImpl::IsSameProfile(Profile* profile) {
821 if (profile == static_cast<Profile*>(this)) 799 if (profile == static_cast<Profile*>(this))
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 if (!path.empty()) 1081 if (!path.empty())
1104 *cache_path = path; 1082 *cache_path = path;
1105 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : 1083 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) :
1106 prefs_->GetInteger(prefs::kDiskCacheSize); 1084 prefs_->GetInteger(prefs::kDiskCacheSize);
1107 } 1085 }
1108 1086
1109 base::Callback<ChromeURLDataManagerBackend*(void)> 1087 base::Callback<ChromeURLDataManagerBackend*(void)>
1110 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { 1088 ProfileImpl::GetChromeURLDataManagerBackendGetter() const {
1111 return io_data_.GetChromeURLDataManagerBackendGetter(); 1089 return io_data_.GetChromeURLDataManagerBackendGetter();
1112 } 1090 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_impl.h ('k') | chrome/test/base/profile_mock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698