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/renderer/extensions/extension_dispatcher.h" | 5 #include "chrome/renderer/extensions/extension_dispatcher.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/common/child_process_logging.h" | 8 #include "chrome/common/child_process_logging.h" |
9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
11 #include "chrome/common/extensions/extension_messages.h" | 11 #include "chrome/common/extensions/extension_messages.h" |
12 #include "chrome/common/extensions/extension_permission_set.h" | 12 #include "chrome/common/extensions/extension_permission_set.h" |
13 #include "chrome/common/url_constants.h" | 13 #include "chrome/common/url_constants.h" |
14 #include "chrome/renderer/extensions/chrome_app_bindings.h" | 14 #include "chrome/renderer/extensions/chrome_app_bindings.h" |
| 15 #include "chrome/renderer/extensions/chrome_webstore_bindings.h" |
15 #include "chrome/renderer/extensions/event_bindings.h" | 16 #include "chrome/renderer/extensions/event_bindings.h" |
16 #include "chrome/renderer/extensions/extension_groups.h" | 17 #include "chrome/renderer/extensions/extension_groups.h" |
17 #include "chrome/renderer/extensions/extension_process_bindings.h" | 18 #include "chrome/renderer/extensions/extension_process_bindings.h" |
18 #include "chrome/renderer/extensions/js_only_v8_extensions.h" | 19 #include "chrome/renderer/extensions/js_only_v8_extensions.h" |
19 #include "chrome/renderer/extensions/renderer_extension_bindings.h" | 20 #include "chrome/renderer/extensions/renderer_extension_bindings.h" |
20 #include "chrome/renderer/extensions/user_script_slave.h" | 21 #include "chrome/renderer/extensions/user_script_slave.h" |
21 #include "content/renderer/render_thread.h" | 22 #include "content/renderer/render_thread.h" |
22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" | 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" |
23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h" | 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // For extensions, we want to ensure we call the IdleHandler every so often, | 79 // For extensions, we want to ensure we call the IdleHandler every so often, |
79 // even if the extension keeps up activity. | 80 // even if the extension keeps up activity. |
80 if (is_extension_process_) { | 81 if (is_extension_process_) { |
81 forced_idle_timer_.Start( | 82 forced_idle_timer_.Start( |
82 base::TimeDelta::FromSeconds(kMaxExtensionIdleHandlerDelayS), | 83 base::TimeDelta::FromSeconds(kMaxExtensionIdleHandlerDelayS), |
83 RenderThread::current(), &RenderThread::IdleHandler); | 84 RenderThread::current(), &RenderThread::IdleHandler); |
84 } | 85 } |
85 | 86 |
86 RegisterExtension(extensions_v8::ChromeAppExtension::Get(this), false); | 87 RegisterExtension(extensions_v8::ChromeAppExtension::Get(this), false); |
87 | 88 |
| 89 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 90 switches::kEnableInlineWebstoreInstall)) { |
| 91 RegisterExtension(extensions_v8::ChromeWebstoreExtension::Get(), false); |
| 92 } |
| 93 |
88 // Add v8 extensions related to chrome extensions. | 94 // Add v8 extensions related to chrome extensions. |
89 RegisterExtension(ExtensionProcessBindings::Get(this), true); | 95 RegisterExtension(ExtensionProcessBindings::Get(this), true); |
90 RegisterExtension(JsonSchemaJsV8Extension::Get(), true); | 96 RegisterExtension(JsonSchemaJsV8Extension::Get(), true); |
91 RegisterExtension(EventBindings::Get(this), true); | 97 RegisterExtension(EventBindings::Get(this), true); |
92 RegisterExtension(RendererExtensionBindings::Get(this), true); | 98 RegisterExtension(RendererExtensionBindings::Get(this), true); |
93 RegisterExtension(ExtensionApiTestV8Extension::Get(), true); | 99 RegisterExtension(ExtensionApiTestV8Extension::Get(), true); |
94 | 100 |
95 // Initialize host permissions for any extensions that were activated before | 101 // Initialize host permissions for any extensions that were activated before |
96 // WebKit was initialized. | 102 // WebKit was initialized. |
97 for (std::set<std::string>::iterator iter = active_extension_ids_.begin(); | 103 for (std::set<std::string>::iterator iter = active_extension_ids_.begin(); |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 child_process_logging::SetActiveExtensions(active_extensions); | 331 child_process_logging::SetActiveExtensions(active_extensions); |
326 } | 332 } |
327 | 333 |
328 void ExtensionDispatcher::RegisterExtension(v8::Extension* extension, | 334 void ExtensionDispatcher::RegisterExtension(v8::Extension* extension, |
329 bool restrict_to_extensions) { | 335 bool restrict_to_extensions) { |
330 if (restrict_to_extensions) | 336 if (restrict_to_extensions) |
331 restricted_v8_extensions_.insert(extension->name()); | 337 restricted_v8_extensions_.insert(extension->name()); |
332 | 338 |
333 RenderThread::current()->RegisterExtension(extension); | 339 RenderThread::current()->RegisterExtension(extension); |
334 } | 340 } |
OLD | NEW |