Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/renderer/dispatcher.h" | 5 #include "extensions/renderer/dispatcher.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/alias.h" | 10 #include "base/debug/alias.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 192 *(base::CommandLine::ForCurrentProcess()); | 192 *(base::CommandLine::ForCurrentProcess()); |
| 193 set_idle_notifications_ = | 193 set_idle_notifications_ = |
| 194 command_line.HasSwitch(switches::kExtensionProcess) || | 194 command_line.HasSwitch(switches::kExtensionProcess) || |
| 195 command_line.HasSwitch(::switches::kSingleProcess); | 195 command_line.HasSwitch(::switches::kSingleProcess); |
| 196 | 196 |
| 197 if (set_idle_notifications_) { | 197 if (set_idle_notifications_) { |
| 198 RenderThread::Get()->SetIdleNotificationDelayInMs( | 198 RenderThread::Get()->SetIdleNotificationDelayInMs( |
| 199 kInitialExtensionIdleHandlerDelayMs); | 199 kInitialExtensionIdleHandlerDelayMs); |
| 200 } | 200 } |
| 201 | 201 |
| 202 RenderThread::Get()->RegisterExtension(SafeBuiltins::CreateV8Extension()); | |
|
not at google - send to devlin
2015/07/10 16:26:11
Put this behind an |is_webkit_initialized_| flag?
bashi
2015/07/14 00:00:24
That won't install SafeBuiltins because |is_webkit
not at google - send to devlin
2015/07/14 23:31:54
Oh, right.
| |
| 203 | |
| 204 script_context_set_.reset( | 202 script_context_set_.reset( |
| 205 new ScriptContextSet(&extensions_, &active_extension_ids_)); | 203 new ScriptContextSet(&extensions_, &active_extension_ids_)); |
| 206 user_script_set_manager_.reset(new UserScriptSetManager(&extensions_)); | 204 user_script_set_manager_.reset(new UserScriptSetManager(&extensions_)); |
| 207 script_injection_manager_.reset( | 205 script_injection_manager_.reset( |
| 208 new ScriptInjectionManager(&extensions_, user_script_set_manager_.get())); | 206 new ScriptInjectionManager(&extensions_, user_script_set_manager_.get())); |
| 209 user_script_set_manager_observer_.Add(user_script_set_manager_.get()); | 207 user_script_set_manager_observer_.Add(user_script_set_manager_.get()); |
| 210 request_sender_.reset(new RequestSender(this)); | 208 request_sender_.reset(new RequestSender(this)); |
| 211 PopulateSourceMap(); | 209 PopulateSourceMap(); |
| 212 } | 210 } |
| 213 | 211 |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 737 IPC_MESSAGE_FORWARD(ExtensionMsg_WatchPages, | 735 IPC_MESSAGE_FORWARD(ExtensionMsg_WatchPages, |
| 738 content_watcher_.get(), | 736 content_watcher_.get(), |
| 739 ContentWatcher::OnWatchPages) | 737 ContentWatcher::OnWatchPages) |
| 740 IPC_MESSAGE_UNHANDLED(handled = false) | 738 IPC_MESSAGE_UNHANDLED(handled = false) |
| 741 IPC_END_MESSAGE_MAP() | 739 IPC_END_MESSAGE_MAP() |
| 742 | 740 |
| 743 return handled; | 741 return handled; |
| 744 } | 742 } |
| 745 | 743 |
| 746 void Dispatcher::WebKitInitialized() { | 744 void Dispatcher::WebKitInitialized() { |
| 745 RenderThread::Get()->RegisterExtension(SafeBuiltins::CreateV8Extension()); | |
| 746 | |
| 747 // For extensions, we want to ensure we call the IdleHandler every so often, | 747 // For extensions, we want to ensure we call the IdleHandler every so often, |
| 748 // even if the extension keeps up activity. | 748 // even if the extension keeps up activity. |
| 749 if (set_idle_notifications_) { | 749 if (set_idle_notifications_) { |
| 750 forced_idle_timer_.reset(new base::RepeatingTimer<content::RenderThread>); | 750 forced_idle_timer_.reset(new base::RepeatingTimer<content::RenderThread>); |
| 751 forced_idle_timer_->Start( | 751 forced_idle_timer_->Start( |
| 752 FROM_HERE, | 752 FROM_HERE, |
| 753 base::TimeDelta::FromMilliseconds(kMaxExtensionIdleHandlerDelayMs), | 753 base::TimeDelta::FromMilliseconds(kMaxExtensionIdleHandlerDelayMs), |
| 754 RenderThread::Get(), | 754 RenderThread::Get(), |
| 755 &RenderThread::IdleHandler); | 755 &RenderThread::IdleHandler); |
| 756 } | 756 } |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1442 // The "guestViewDeny" module must always be loaded last. It registers | 1442 // The "guestViewDeny" module must always be loaded last. It registers |
| 1443 // error-providing custom elements for the GuestView types that are not | 1443 // error-providing custom elements for the GuestView types that are not |
| 1444 // available, and thus all of those types must have been checked and loaded | 1444 // available, and thus all of those types must have been checked and loaded |
| 1445 // (or not loaded) beforehand. | 1445 // (or not loaded) beforehand. |
| 1446 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { | 1446 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { |
| 1447 module_system->Require("guestViewDeny"); | 1447 module_system->Require("guestViewDeny"); |
| 1448 } | 1448 } |
| 1449 } | 1449 } |
| 1450 | 1450 |
| 1451 } // namespace extensions | 1451 } // namespace extensions |
| OLD | NEW |