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" |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.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_util.h" | 16 #include "base/string_util.h" |
17 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 17 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
18 #include "chrome/browser/autofill/personal_data_manager.h" | 18 #include "chrome/browser/autofill/personal_data_manager.h" |
19 #include "chrome/browser/background/background_contents_service_factory.h" | 19 #include "chrome/browser/background/background_contents_service_factory.h" |
20 #include "chrome/browser/background/background_mode_manager.h" | 20 #include "chrome/browser/background/background_mode_manager.h" |
21 #include "chrome/browser/bookmarks/bookmark_model.h" | 21 #include "chrome/browser/bookmarks/bookmark_model.h" |
22 #include "chrome/browser/browser_process.h" | 22 #include "chrome/browser/browser_process.h" |
23 #include "chrome/browser/browsing_data_remover.h" | 23 #include "chrome/browser/browsing_data_remover.h" |
| 24 #include "chrome/browser/chrome_plugin_service_filter.h" |
24 #include "chrome/browser/content_settings/host_content_settings_map.h" | 25 #include "chrome/browser/content_settings/host_content_settings_map.h" |
25 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 26 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
26 #include "chrome/browser/defaults.h" | 27 #include "chrome/browser/defaults.h" |
27 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 28 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
28 #include "chrome/browser/extensions/extension_devtools_manager.h" | 29 #include "chrome/browser/extensions/extension_devtools_manager.h" |
29 #include "chrome/browser/extensions/extension_error_reporter.h" | 30 #include "chrome/browser/extensions/extension_error_reporter.h" |
30 #include "chrome/browser/extensions/extension_event_router.h" | 31 #include "chrome/browser/extensions/extension_event_router.h" |
31 #include "chrome/browser/extensions/extension_info_map.h" | 32 #include "chrome/browser/extensions/extension_info_map.h" |
32 #include "chrome/browser/extensions/extension_message_service.h" | 33 #include "chrome/browser/extensions/extension_message_service.h" |
33 #include "chrome/browser/extensions/extension_pref_store.h" | 34 #include "chrome/browser/extensions/extension_pref_store.h" |
34 #include "chrome/browser/extensions/extension_process_manager.h" | 35 #include "chrome/browser/extensions/extension_process_manager.h" |
35 #include "chrome/browser/extensions/extension_service.h" | 36 #include "chrome/browser/extensions/extension_service.h" |
36 #include "chrome/browser/extensions/extension_settings.h" | 37 #include "chrome/browser/extensions/extension_settings.h" |
37 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 38 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
38 #include "chrome/browser/extensions/user_script_master.h" | 39 #include "chrome/browser/extensions/user_script_master.h" |
39 #include "chrome/browser/favicon/favicon_service.h" | 40 #include "chrome/browser/favicon/favicon_service.h" |
40 #include "chrome/browser/geolocation/chrome_geolocation_permission_context.h" | 41 #include "chrome/browser/geolocation/chrome_geolocation_permission_context.h" |
41 #include "chrome/browser/history/history.h" | 42 #include "chrome/browser/history/history.h" |
42 #include "chrome/browser/history/shortcuts_backend.h" | 43 #include "chrome/browser/history/shortcuts_backend.h" |
43 #include "chrome/browser/history/top_sites.h" | 44 #include "chrome/browser/history/top_sites.h" |
44 #include "chrome/browser/instant/instant_controller.h" | 45 #include "chrome/browser/instant/instant_controller.h" |
45 #include "chrome/browser/metrics/metrics_service.h" | 46 #include "chrome/browser/metrics/metrics_service.h" |
46 #include "chrome/browser/net/chrome_url_request_context.h" | 47 #include "chrome/browser/net/chrome_url_request_context.h" |
47 #include "chrome/browser/net/gaia/token_service.h" | 48 #include "chrome/browser/net/gaia/token_service.h" |
48 #include "chrome/browser/net/net_pref_observer.h" | 49 #include "chrome/browser/net/net_pref_observer.h" |
49 #include "chrome/browser/net/pref_proxy_config_service.h" | 50 #include "chrome/browser/net/pref_proxy_config_service.h" |
50 #include "chrome/browser/net/ssl_config_service_manager.h" | 51 #include "chrome/browser/net/ssl_config_service_manager.h" |
51 #include "chrome/browser/password_manager/password_store_default.h" | 52 #include "chrome/browser/password_manager/password_store_default.h" |
| 53 #include "chrome/browser/plugin_prefs.h" |
52 #include "chrome/browser/policy/configuration_policy_pref_store.h" | 54 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
53 #include "chrome/browser/prefs/browser_prefs.h" | 55 #include "chrome/browser/prefs/browser_prefs.h" |
54 #include "chrome/browser/prefs/pref_value_store.h" | 56 #include "chrome/browser/prefs/pref_value_store.h" |
55 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 57 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
56 #include "chrome/browser/prerender/prerender_manager.h" | 58 #include "chrome/browser/prerender/prerender_manager.h" |
57 #include "chrome/browser/profiles/profile_dependency_manager.h" | 59 #include "chrome/browser/profiles/profile_dependency_manager.h" |
58 #include "chrome/browser/profiles/profile_manager.h" | 60 #include "chrome/browser/profiles/profile_manager.h" |
59 #include "chrome/browser/search_engines/template_url_fetcher.h" | 61 #include "chrome/browser/search_engines/template_url_fetcher.h" |
60 #include "chrome/browser/search_engines/template_url_service.h" | 62 #include "chrome/browser/search_engines/template_url_service.h" |
61 #include "chrome/browser/sessions/session_service_factory.h" | 63 #include "chrome/browser/sessions/session_service_factory.h" |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 extensions_cookie_path.Append(chrome::kExtensionsCookieFilename); | 433 extensions_cookie_path.Append(chrome::kExtensionsCookieFilename); |
432 | 434 |
433 FilePath app_path = GetPath().Append(chrome::kIsolatedAppStateDirname); | 435 FilePath app_path = GetPath().Append(chrome::kIsolatedAppStateDirname); |
434 | 436 |
435 // Make sure we initialize the ProfileIOData after everything else has been | 437 // Make sure we initialize the ProfileIOData after everything else has been |
436 // initialized that we might be reading from the IO thread. | 438 // initialized that we might be reading from the IO thread. |
437 io_data_.Init(cookie_path, origin_bound_cert_path, cache_path, | 439 io_data_.Init(cookie_path, origin_bound_cert_path, cache_path, |
438 cache_max_size, media_cache_path, media_cache_max_size, | 440 cache_max_size, media_cache_path, media_cache_max_size, |
439 extensions_cookie_path, app_path); | 441 extensions_cookie_path, app_path); |
440 | 442 |
| 443 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( |
| 444 PluginPrefs::GetForProfile(this), &GetResourceContext()); |
| 445 |
441 // Creation has been finished. | 446 // Creation has been finished. |
442 if (delegate_) | 447 if (delegate_) |
443 delegate_->OnProfileCreated(this, true); | 448 delegate_->OnProfileCreated(this, true); |
444 | 449 |
445 NotificationService::current()->Notify( | 450 NotificationService::current()->Notify( |
446 chrome::NOTIFICATION_PROFILE_CREATED, | 451 chrome::NOTIFICATION_PROFILE_CREATED, |
447 Source<Profile>(this), | 452 Source<Profile>(this), |
448 NotificationService::NoDetails()); | 453 NotificationService::NoDetails()); |
449 } | 454 } |
450 | 455 |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 StopCreateSessionServiceTimer(); | 685 StopCreateSessionServiceTimer(); |
681 | 686 |
682 // Remove pref observers | 687 // Remove pref observers |
683 pref_change_registrar_.RemoveAll(); | 688 pref_change_registrar_.RemoveAll(); |
684 | 689 |
685 // The sync service needs to be deleted before the services it calls. | 690 // The sync service needs to be deleted before the services it calls. |
686 // TODO(stevet): Make ProfileSyncService into a PKS and let the PDM take care | 691 // TODO(stevet): Make ProfileSyncService into a PKS and let the PDM take care |
687 // of the cleanup below. | 692 // of the cleanup below. |
688 sync_service_.reset(); | 693 sync_service_.reset(); |
689 | 694 |
| 695 ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext( |
| 696 &GetResourceContext()); |
| 697 |
690 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); | 698 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); |
691 | 699 |
692 if (db_tracker_) { | 700 if (db_tracker_) { |
693 BrowserThread::PostTask( | 701 BrowserThread::PostTask( |
694 BrowserThread::FILE, FROM_HERE, | 702 BrowserThread::FILE, FROM_HERE, |
695 NewRunnableMethod( | 703 NewRunnableMethod( |
696 db_tracker_.get(), | 704 db_tracker_.get(), |
697 &webkit_database::DatabaseTracker::Shutdown)); | 705 &webkit_database::DatabaseTracker::Shutdown)); |
698 } | 706 } |
699 | 707 |
(...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1728 #endif | 1736 #endif |
1729 } | 1737 } |
1730 return prerender_manager_.get(); | 1738 return prerender_manager_.get(); |
1731 } | 1739 } |
1732 | 1740 |
1733 SpellCheckProfile* ProfileImpl::GetSpellCheckProfile() { | 1741 SpellCheckProfile* ProfileImpl::GetSpellCheckProfile() { |
1734 if (!spellcheck_profile_.get()) | 1742 if (!spellcheck_profile_.get()) |
1735 spellcheck_profile_.reset(new SpellCheckProfile()); | 1743 spellcheck_profile_.reset(new SpellCheckProfile()); |
1736 return spellcheck_profile_.get(); | 1744 return spellcheck_profile_.get(); |
1737 } | 1745 } |
OLD | NEW |