OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extension_web_contents_observer.h" | 5 #include "chrome/browser/extensions/extension_web_contents_observer.h" |
6 | 6 |
7 #include "chrome/browser/extensions/api/messaging/message_service.h" | 7 #include "chrome/browser/extensions/api/messaging/message_service.h" |
8 #include "chrome/browser/extensions/error_console/error_console.h" | 8 #include "chrome/browser/extensions/error_console/error_console.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/extensions/extension_system.h" | |
11 #include "chrome/common/extensions/api/messaging/message.h" | 10 #include "chrome/common/extensions/api/messaging/message.h" |
12 #include "chrome/common/extensions/extension_messages.h" | 11 #include "chrome/common/extensions/extension_messages.h" |
13 #include "chrome/common/render_messages.h" | 12 #include "chrome/common/render_messages.h" |
14 #include "chrome/common/url_constants.h" | 13 #include "chrome/common/url_constants.h" |
15 #include "content/public/browser/child_process_security_policy.h" | 14 #include "content/public/browser/child_process_security_policy.h" |
16 #include "content/public/browser/render_process_host.h" | 15 #include "content/public/browser/render_process_host.h" |
17 #include "content/public/browser/render_view_host.h" | 16 #include "content/public/browser/render_view_host.h" |
18 #include "content/public/browser/site_instance.h" | 17 #include "content/public/browser/site_instance.h" |
19 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
20 #include "extensions/browser/extension_registry.h" | 19 #include "extensions/browser/extension_registry.h" |
| 20 #include "extensions/browser/extension_system.h" |
21 #include "extensions/browser/view_type_utils.h" | 21 #include "extensions/browser/view_type_utils.h" |
22 #include "extensions/common/constants.h" | 22 #include "extensions/common/constants.h" |
23 #include "extensions/common/extension_urls.h" | 23 #include "extensions/common/extension_urls.h" |
24 | 24 |
25 DEFINE_WEB_CONTENTS_USER_DATA_KEY(extensions::ExtensionWebContentsObserver); | 25 DEFINE_WEB_CONTENTS_USER_DATA_KEY(extensions::ExtensionWebContentsObserver); |
26 | 26 |
27 namespace extensions { | 27 namespace extensions { |
28 | 28 |
29 ExtensionWebContentsObserver::ExtensionWebContentsObserver( | 29 ExtensionWebContentsObserver::ExtensionWebContentsObserver( |
30 content::WebContents* web_contents) | 30 content::WebContents* web_contents) |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 return NULL; | 148 return NULL; |
149 | 149 |
150 std::string extension_id = site.host(); | 150 std::string extension_id = site.host(); |
151 ExtensionRegistry* registry = ExtensionRegistry::Get(browser_context_); | 151 ExtensionRegistry* registry = ExtensionRegistry::Get(browser_context_); |
152 | 152 |
153 // Reload the extension if it has crashed. | 153 // Reload the extension if it has crashed. |
154 // TODO(yoz): This reload doesn't happen synchronously for unpacked | 154 // TODO(yoz): This reload doesn't happen synchronously for unpacked |
155 // extensions. It seems to be fast enough, but there is a race. | 155 // extensions. It seems to be fast enough, but there is a race. |
156 // We should delay loading until the extension has reloaded. | 156 // We should delay loading until the extension has reloaded. |
157 if (registry->GetExtensionById(extension_id, ExtensionRegistry::TERMINATED)) { | 157 if (registry->GetExtensionById(extension_id, ExtensionRegistry::TERMINATED)) { |
158 ExtensionSystem::GetForBrowserContext(browser_context_)-> | 158 ExtensionSystem::Get(browser_context_)-> |
159 extension_service()->ReloadExtension(extension_id); | 159 extension_service()->ReloadExtension(extension_id); |
160 } | 160 } |
161 | 161 |
162 // May be null if the extension doesn't exist, for example if somebody typos | 162 // May be null if the extension doesn't exist, for example if somebody typos |
163 // a chrome-extension:// URL. | 163 // a chrome-extension:// URL. |
164 return registry->enabled_extensions().GetByID(extension_id); | 164 return registry->enabled_extensions().GetByID(extension_id); |
165 } | 165 } |
166 | 166 |
167 } // namespace extensions | 167 } // namespace extensions |
OLD | NEW |