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/environment.h" | 8 #include "base/environment.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
14 #include "base/singleton.h" | |
tony
2011/02/07 20:51:45
Do you need this?
koz (OOO until 15th September)
2011/02/13 22:33:48
Nope, not anymore. Cheers.
Done.
| |
14 #include "base/string_number_conversions.h" | 15 #include "base/string_number_conversions.h" |
15 #include "base/string_util.h" | 16 #include "base/string_util.h" |
16 #include "chrome/browser/appcache/chrome_appcache_service.h" | 17 #include "chrome/browser/appcache/chrome_appcache_service.h" |
17 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 18 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
18 #include "chrome/browser/autofill/personal_data_manager.h" | 19 #include "chrome/browser/autofill/personal_data_manager.h" |
19 #include "chrome/browser/background_contents_service.h" | 20 #include "chrome/browser/background_contents_service.h" |
20 #include "chrome/browser/background_mode_manager.h" | 21 #include "chrome/browser/background_mode_manager.h" |
21 #include "chrome/browser/bookmarks/bookmark_model.h" | 22 #include "chrome/browser/bookmarks/bookmark_model.h" |
22 #include "chrome/browser/browser_list.h" | 23 #include "chrome/browser/browser_list.h" |
23 #include "chrome/browser/browser_process.h" | 24 #include "chrome/browser/browser_process.h" |
24 #include "chrome/browser/browser_signin.h" | 25 #include "chrome/browser/browser_signin.h" |
25 #include "chrome/browser/browser_thread.h" | 26 #include "chrome/browser/browser_thread.h" |
26 #include "chrome/browser/chrome_blob_storage_context.h" | 27 #include "chrome/browser/chrome_blob_storage_context.h" |
27 #include "chrome/browser/content_settings/host_content_settings_map.h" | 28 #include "chrome/browser/content_settings/host_content_settings_map.h" |
29 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | |
28 #include "chrome/browser/defaults.h" | 30 #include "chrome/browser/defaults.h" |
29 #include "chrome/browser/dom_ui/ntp_resource_cache.h" | 31 #include "chrome/browser/dom_ui/ntp_resource_cache.h" |
30 #include "chrome/browser/download/download_manager.h" | 32 #include "chrome/browser/download/download_manager.h" |
31 #include "chrome/browser/extensions/default_apps.h" | 33 #include "chrome/browser/extensions/default_apps.h" |
32 #include "chrome/browser/extensions/extension_devtools_manager.h" | 34 #include "chrome/browser/extensions/extension_devtools_manager.h" |
33 #include "chrome/browser/extensions/extension_error_reporter.h" | 35 #include "chrome/browser/extensions/extension_error_reporter.h" |
34 #include "chrome/browser/extensions/extension_event_router.h" | 36 #include "chrome/browser/extensions/extension_event_router.h" |
35 #include "chrome/browser/extensions/extension_info_map.h" | 37 #include "chrome/browser/extensions/extension_info_map.h" |
36 #include "chrome/browser/extensions/extension_io_event_router.h" | 38 #include "chrome/browser/extensions/extension_io_event_router.h" |
37 #include "chrome/browser/extensions/extension_message_service.h" | 39 #include "chrome/browser/extensions/extension_message_service.h" |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
479 } | 481 } |
480 | 482 |
481 void ProfileImpl::InitWebResources() { | 483 void ProfileImpl::InitWebResources() { |
482 if (web_resource_service_) | 484 if (web_resource_service_) |
483 return; | 485 return; |
484 | 486 |
485 web_resource_service_ = new WebResourceService(this); | 487 web_resource_service_ = new WebResourceService(this); |
486 web_resource_service_->StartAfterDelay(); | 488 web_resource_service_->StartAfterDelay(); |
487 } | 489 } |
488 | 490 |
491 void ProfileImpl::InitRegisteredProtocolHandlers() { | |
492 if (protocol_handler_registry_) | |
493 return; | |
494 protocol_handler_registry_ = new ProtocolHandlerRegistry(this); | |
495 protocol_handler_registry_->Load(); | |
496 } | |
497 | |
489 NTPResourceCache* ProfileImpl::GetNTPResourceCache() { | 498 NTPResourceCache* ProfileImpl::GetNTPResourceCache() { |
490 if (!ntp_resource_cache_.get()) | 499 if (!ntp_resource_cache_.get()) |
491 ntp_resource_cache_.reset(new NTPResourceCache(this)); | 500 ntp_resource_cache_.reset(new NTPResourceCache(this)); |
492 return ntp_resource_cache_.get(); | 501 return ntp_resource_cache_.get(); |
493 } | 502 } |
494 | 503 |
495 FilePath ProfileImpl::last_selected_directory() { | 504 FilePath ProfileImpl::last_selected_directory() { |
496 return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory); | 505 return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory); |
497 } | 506 } |
498 | 507 |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1135 } | 1144 } |
1136 | 1145 |
1137 BookmarkModel* ProfileImpl::GetBookmarkModel() { | 1146 BookmarkModel* ProfileImpl::GetBookmarkModel() { |
1138 if (!bookmark_bar_model_.get()) { | 1147 if (!bookmark_bar_model_.get()) { |
1139 bookmark_bar_model_.reset(new BookmarkModel(this)); | 1148 bookmark_bar_model_.reset(new BookmarkModel(this)); |
1140 bookmark_bar_model_->Load(); | 1149 bookmark_bar_model_->Load(); |
1141 } | 1150 } |
1142 return bookmark_bar_model_.get(); | 1151 return bookmark_bar_model_.get(); |
1143 } | 1152 } |
1144 | 1153 |
1154 ProtocolHandlerRegistry* ProfileImpl::GetProtocolHandlerRegistry() { | |
1155 return protocol_handler_registry_.get(); | |
1156 } | |
1157 | |
1145 bool ProfileImpl::IsSameProfile(Profile* profile) { | 1158 bool ProfileImpl::IsSameProfile(Profile* profile) { |
1146 if (profile == static_cast<Profile*>(this)) | 1159 if (profile == static_cast<Profile*>(this)) |
1147 return true; | 1160 return true; |
1148 Profile* otr_profile = off_the_record_profile_.get(); | 1161 Profile* otr_profile = off_the_record_profile_.get(); |
1149 return otr_profile && profile == otr_profile; | 1162 return otr_profile && profile == otr_profile; |
1150 } | 1163 } |
1151 | 1164 |
1152 Time ProfileImpl::GetStartTime() const { | 1165 Time ProfileImpl::GetStartTime() const { |
1153 return start_time_; | 1166 return start_time_; |
1154 } | 1167 } |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1491 } | 1504 } |
1492 | 1505 |
1493 PrerenderManager* ProfileImpl::GetPrerenderManager() { | 1506 PrerenderManager* ProfileImpl::GetPrerenderManager() { |
1494 CommandLine* cl = CommandLine::ForCurrentProcess(); | 1507 CommandLine* cl = CommandLine::ForCurrentProcess(); |
1495 if (!cl->HasSwitch(switches::kEnablePagePrerender)) | 1508 if (!cl->HasSwitch(switches::kEnablePagePrerender)) |
1496 return NULL; | 1509 return NULL; |
1497 if (!prerender_manager_) | 1510 if (!prerender_manager_) |
1498 prerender_manager_ = new PrerenderManager(this); | 1511 prerender_manager_ = new PrerenderManager(this); |
1499 return prerender_manager_; | 1512 return prerender_manager_; |
1500 } | 1513 } |
OLD | NEW |