OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/extensions/extensions_service.h" | 5 #include "chrome/browser/extensions/extensions_service.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/chrome_thread.h" | 12 #include "chrome/browser/chrome_thread.h" |
13 #include "chrome/browser/extensions/crx_installer.h" | 13 #include "chrome/browser/extensions/crx_installer.h" |
14 #include "chrome/browser/extensions/extension_browser_event_router.h" | 14 #include "chrome/browser/extensions/extension_browser_event_router.h" |
15 #include "chrome/browser/extensions/extension_dom_ui.h" | 15 #include "chrome/browser/extensions/extension_dom_ui.h" |
16 #include "chrome/browser/extensions/extension_file_util.h" | 16 #include "chrome/browser/extensions/extension_file_util.h" |
| 17 #include "chrome/browser/extensions/extension_history_api.h" |
17 #include "chrome/browser/extensions/extension_updater.h" | 18 #include "chrome/browser/extensions/extension_updater.h" |
18 #include "chrome/browser/extensions/external_extension_provider.h" | 19 #include "chrome/browser/extensions/external_extension_provider.h" |
19 #include "chrome/browser/extensions/external_pref_extension_provider.h" | 20 #include "chrome/browser/extensions/external_pref_extension_provider.h" |
20 #include "chrome/browser/profile.h" | 21 #include "chrome/browser/profile.h" |
21 #include "chrome/browser/net/chrome_url_request_context.h" | 22 #include "chrome/browser/net/chrome_url_request_context.h" |
22 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
23 #include "chrome/common/extensions/extension.h" | 24 #include "chrome/common/extensions/extension.h" |
24 #include "chrome/common/extensions/extension_error_reporter.h" | 25 #include "chrome/common/extensions/extension_error_reporter.h" |
25 #include "chrome/common/notification_service.h" | 26 #include "chrome/common/notification_service.h" |
26 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 } | 121 } |
121 | 122 |
122 void ExtensionsService::Init() { | 123 void ExtensionsService::Init() { |
123 DCHECK(!ready_); | 124 DCHECK(!ready_); |
124 DCHECK_EQ(extensions_.size(), 0u); | 125 DCHECK_EQ(extensions_.size(), 0u); |
125 | 126 |
126 // Hack: we need to ensure the ResourceDispatcherHost is ready before we load | 127 // Hack: we need to ensure the ResourceDispatcherHost is ready before we load |
127 // the first extension, because its members listen for loaded notifications. | 128 // the first extension, because its members listen for loaded notifications. |
128 g_browser_process->resource_dispatcher_host(); | 129 g_browser_process->resource_dispatcher_host(); |
129 | 130 |
| 131 // Start up the extension event routers. |
| 132 ExtensionHistoryEventRouter::GetInstance()->ObserveProfile(profile_); |
| 133 |
130 LoadAllExtensions(); | 134 LoadAllExtensions(); |
131 | 135 |
132 // TODO(erikkay) this should probably be deferred to a future point | 136 // TODO(erikkay) this should probably be deferred to a future point |
133 // rather than running immediately at startup. | 137 // rather than running immediately at startup. |
134 CheckForExternalUpdates(); | 138 CheckForExternalUpdates(); |
135 | 139 |
136 // TODO(erikkay) this should probably be deferred as well. | 140 // TODO(erikkay) this should probably be deferred as well. |
137 GarbageCollectExtensions(); | 141 GarbageCollectExtensions(); |
138 } | 142 } |
139 | 143 |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 linked_ptr<ExternalExtensionProvider>(test_provider); | 819 linked_ptr<ExternalExtensionProvider>(test_provider); |
816 } | 820 } |
817 | 821 |
818 void ExtensionsServiceBackend::OnExternalExtensionFound( | 822 void ExtensionsServiceBackend::OnExternalExtensionFound( |
819 const std::string& id, const Version* version, const FilePath& path, | 823 const std::string& id, const Version* version, const FilePath& path, |
820 Extension::Location location) { | 824 Extension::Location location) { |
821 frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(frontend_, | 825 frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(frontend_, |
822 &ExtensionsService::OnExternalExtensionFound, id, version->GetString(), | 826 &ExtensionsService::OnExternalExtensionFound, id, version->GetString(), |
823 path, location)); | 827 path, location)); |
824 } | 828 } |
OLD | NEW |