| 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 is_extension_process_ = |
| 45 switches::kProcessType); | 45 CommandLine::ForCurrentProcess()->HasSwitch(switches::kExtensionProcess); |
| 46 is_extension_process_ = type_str == switches::kExtensionProcess || | |
| 47 CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess); | 46 CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess); |
| 48 | 47 |
| 49 if (is_extension_process_) { | 48 if (is_extension_process_) { |
| 50 RenderThread::current()->set_idle_notification_delay_in_s( | 49 RenderThread::current()->set_idle_notification_delay_in_s( |
| 51 kInitialExtensionIdleHandlerDelayS); | 50 kInitialExtensionIdleHandlerDelayS); |
| 52 } | 51 } |
| 53 | 52 |
| 54 user_script_slave_.reset(new UserScriptSlave(&extensions_)); | 53 user_script_slave_.reset(new UserScriptSlave(&extensions_)); |
| 55 } | 54 } |
| 56 | 55 |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 child_process_logging::SetActiveExtensions(active_extensions); | 338 child_process_logging::SetActiveExtensions(active_extensions); |
| 340 } | 339 } |
| 341 | 340 |
| 342 void ExtensionDispatcher::RegisterExtension(v8::Extension* extension, | 341 void ExtensionDispatcher::RegisterExtension(v8::Extension* extension, |
| 343 bool restrict_to_extensions) { | 342 bool restrict_to_extensions) { |
| 344 if (restrict_to_extensions) | 343 if (restrict_to_extensions) |
| 345 restricted_v8_extensions_.insert(extension->name()); | 344 restricted_v8_extensions_.insert(extension->name()); |
| 346 | 345 |
| 347 RenderThread::current()->RegisterExtension(extension); | 346 RenderThread::current()->RegisterExtension(extension); |
| 348 } | 347 } |
| OLD | NEW |