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" |
(...skipping 23 matching lines...) Expand all Loading... |
34 static const int64 kMaxExtensionIdleHandlerDelayS = 5*60 /* seconds */; | 34 static const int64 kMaxExtensionIdleHandlerDelayS = 5*60 /* seconds */; |
35 } | 35 } |
36 | 36 |
37 using WebKit::WebDataSource; | 37 using WebKit::WebDataSource; |
38 using WebKit::WebFrame; | 38 using WebKit::WebFrame; |
39 using WebKit::WebSecurityPolicy; | 39 using WebKit::WebSecurityPolicy; |
40 using WebKit::WebString; | 40 using WebKit::WebString; |
41 | 41 |
42 ExtensionDispatcher::ExtensionDispatcher() | 42 ExtensionDispatcher::ExtensionDispatcher() |
43 : is_webkit_initialized_(false) { | 43 : is_webkit_initialized_(false) { |
44 std::string type_str = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 44 const CommandLine& command_line = *(CommandLine::ForCurrentProcess()); |
45 switches::kProcessType); | 45 is_extension_process_ = |
46 is_extension_process_ = type_str == switches::kExtensionProcess || | 46 command_line.HasSwitch(switches::kExtensionProcess) || |
47 CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess); | 47 command_line.HasSwitch(switches::kSingleProcess); |
48 | 48 |
49 if (is_extension_process_) { | 49 if (is_extension_process_) { |
50 RenderThread::current()->set_idle_notification_delay_in_s( | 50 RenderThread::current()->set_idle_notification_delay_in_s( |
51 kInitialExtensionIdleHandlerDelayS); | 51 kInitialExtensionIdleHandlerDelayS); |
52 } | 52 } |
53 | 53 |
54 user_script_slave_.reset(new UserScriptSlave(&extensions_)); | 54 user_script_slave_.reset(new UserScriptSlave(&extensions_)); |
55 } | 55 } |
56 | 56 |
57 ExtensionDispatcher::~ExtensionDispatcher() { | 57 ExtensionDispatcher::~ExtensionDispatcher() { |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 child_process_logging::SetActiveExtensions(active_extensions); | 339 child_process_logging::SetActiveExtensions(active_extensions); |
340 } | 340 } |
341 | 341 |
342 void ExtensionDispatcher::RegisterExtension(v8::Extension* extension, | 342 void ExtensionDispatcher::RegisterExtension(v8::Extension* extension, |
343 bool restrict_to_extensions) { | 343 bool restrict_to_extensions) { |
344 if (restrict_to_extensions) | 344 if (restrict_to_extensions) |
345 restricted_v8_extensions_.insert(extension->name()); | 345 restricted_v8_extensions_.insert(extension->name()); |
346 | 346 |
347 RenderThread::current()->RegisterExtension(extension); | 347 RenderThread::current()->RegisterExtension(extension); |
348 } | 348 } |
OLD | NEW |