| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 } // namespace | 206 } // namespace |
| 207 | 207 |
| 208 // Note that we can't use Blink public APIs in the constructor becase Blink | 208 // Note that we can't use Blink public APIs in the constructor becase Blink |
| 209 // is not initialized at the point we create Dispatcher. | 209 // is not initialized at the point we create Dispatcher. |
| 210 Dispatcher::Dispatcher(DispatcherDelegate* delegate) | 210 Dispatcher::Dispatcher(DispatcherDelegate* delegate) |
| 211 : delegate_(delegate), | 211 : delegate_(delegate), |
| 212 content_watcher_(new ContentWatcher()), | 212 content_watcher_(new ContentWatcher()), |
| 213 source_map_(&ResourceBundle::GetSharedInstance()), | 213 source_map_(&ResourceBundle::GetSharedInstance()), |
| 214 v8_schema_registry_(new V8SchemaRegistry), | 214 v8_schema_registry_(new V8SchemaRegistry), |
| 215 user_script_set_manager_observer_(this), | 215 user_script_set_manager_observer_(this), |
| 216 webrequest_used_(false), | |
| 217 activity_logging_enabled_(false) { | 216 activity_logging_enabled_(false) { |
| 218 const base::CommandLine& command_line = | 217 const base::CommandLine& command_line = |
| 219 *(base::CommandLine::ForCurrentProcess()); | 218 *(base::CommandLine::ForCurrentProcess()); |
| 220 set_idle_notifications_ = | 219 set_idle_notifications_ = |
| 221 command_line.HasSwitch(switches::kExtensionProcess) || | 220 command_line.HasSwitch(switches::kExtensionProcess) || |
| 222 command_line.HasSwitch(::switches::kSingleProcess); | 221 command_line.HasSwitch(::switches::kSingleProcess); |
| 223 | 222 |
| 224 if (set_idle_notifications_) { | 223 if (set_idle_notifications_) { |
| 225 RenderThread::Get()->SetIdleNotificationDelayInMs( | 224 RenderThread::Get()->SetIdleNotificationDelayInMs( |
| 226 kInitialExtensionIdleHandlerDelayMs); | 225 kInitialExtensionIdleHandlerDelayMs); |
| (...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 OnSetWebViewPartitionID) | 930 OnSetWebViewPartitionID) |
| 932 IPC_MESSAGE_HANDLER(ExtensionMsg_ShouldSuspend, OnShouldSuspend) | 931 IPC_MESSAGE_HANDLER(ExtensionMsg_ShouldSuspend, OnShouldSuspend) |
| 933 IPC_MESSAGE_HANDLER(ExtensionMsg_Suspend, OnSuspend) | 932 IPC_MESSAGE_HANDLER(ExtensionMsg_Suspend, OnSuspend) |
| 934 IPC_MESSAGE_HANDLER(ExtensionMsg_TransferBlobs, OnTransferBlobs) | 933 IPC_MESSAGE_HANDLER(ExtensionMsg_TransferBlobs, OnTransferBlobs) |
| 935 IPC_MESSAGE_HANDLER(ExtensionMsg_Unloaded, OnUnloaded) | 934 IPC_MESSAGE_HANDLER(ExtensionMsg_Unloaded, OnUnloaded) |
| 936 IPC_MESSAGE_HANDLER(ExtensionMsg_UpdatePermissions, OnUpdatePermissions) | 935 IPC_MESSAGE_HANDLER(ExtensionMsg_UpdatePermissions, OnUpdatePermissions) |
| 937 IPC_MESSAGE_HANDLER(ExtensionMsg_UpdateTabSpecificPermissions, | 936 IPC_MESSAGE_HANDLER(ExtensionMsg_UpdateTabSpecificPermissions, |
| 938 OnUpdateTabSpecificPermissions) | 937 OnUpdateTabSpecificPermissions) |
| 939 IPC_MESSAGE_HANDLER(ExtensionMsg_ClearTabSpecificPermissions, | 938 IPC_MESSAGE_HANDLER(ExtensionMsg_ClearTabSpecificPermissions, |
| 940 OnClearTabSpecificPermissions) | 939 OnClearTabSpecificPermissions) |
| 941 IPC_MESSAGE_HANDLER(ExtensionMsg_UsingWebRequestAPI, OnUsingWebRequestAPI) | |
| 942 IPC_MESSAGE_HANDLER(ExtensionMsg_SetActivityLoggingEnabled, | 940 IPC_MESSAGE_HANDLER(ExtensionMsg_SetActivityLoggingEnabled, |
| 943 OnSetActivityLoggingEnabled) | 941 OnSetActivityLoggingEnabled) |
| 944 IPC_MESSAGE_FORWARD(ExtensionMsg_WatchPages, | 942 IPC_MESSAGE_FORWARD(ExtensionMsg_WatchPages, |
| 945 content_watcher_.get(), | 943 content_watcher_.get(), |
| 946 ContentWatcher::OnWatchPages) | 944 ContentWatcher::OnWatchPages) |
| 947 IPC_MESSAGE_UNHANDLED(handled = false) | 945 IPC_MESSAGE_UNHANDLED(handled = false) |
| 948 IPC_END_MESSAGE_MAP() | 946 IPC_END_MESSAGE_MAP() |
| 949 | 947 |
| 950 return handled; | 948 return handled; |
| 951 } | 949 } |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1249 if (update_origin_whitelist) { | 1247 if (update_origin_whitelist) { |
| 1250 UpdateOriginPermissions( | 1248 UpdateOriginPermissions( |
| 1251 extension->url(), | 1249 extension->url(), |
| 1252 old_effective, | 1250 old_effective, |
| 1253 extension->permissions_data()->GetEffectiveHostPermissions()); | 1251 extension->permissions_data()->GetEffectiveHostPermissions()); |
| 1254 } | 1252 } |
| 1255 } | 1253 } |
| 1256 } | 1254 } |
| 1257 } | 1255 } |
| 1258 | 1256 |
| 1259 void Dispatcher::OnUsingWebRequestAPI(bool webrequest_used) { | |
| 1260 webrequest_used_ = webrequest_used; | |
| 1261 } | |
| 1262 | |
| 1263 void Dispatcher::OnSetActivityLoggingEnabled(bool enabled) { | 1257 void Dispatcher::OnSetActivityLoggingEnabled(bool enabled) { |
| 1264 activity_logging_enabled_ = enabled; | 1258 activity_logging_enabled_ = enabled; |
| 1265 if (enabled) { | 1259 if (enabled) { |
| 1266 for (const std::string& id : active_extension_ids_) | 1260 for (const std::string& id : active_extension_ids_) |
| 1267 DOMActivityLogger::AttachToWorld(DOMActivityLogger::kMainWorldId, id); | 1261 DOMActivityLogger::AttachToWorld(DOMActivityLogger::kMainWorldId, id); |
| 1268 } | 1262 } |
| 1269 script_injection_manager_->set_activity_logging_enabled(enabled); | 1263 script_injection_manager_->set_activity_logging_enabled(enabled); |
| 1270 user_script_set_manager_->set_activity_logging_enabled(enabled); | 1264 user_script_set_manager_->set_activity_logging_enabled(enabled); |
| 1271 } | 1265 } |
| 1272 | 1266 |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1655 // The "guestViewDeny" module must always be loaded last. It registers | 1649 // The "guestViewDeny" module must always be loaded last. It registers |
| 1656 // error-providing custom elements for the GuestView types that are not | 1650 // error-providing custom elements for the GuestView types that are not |
| 1657 // available, and thus all of those types must have been checked and loaded | 1651 // available, and thus all of those types must have been checked and loaded |
| 1658 // (or not loaded) beforehand. | 1652 // (or not loaded) beforehand. |
| 1659 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { | 1653 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { |
| 1660 module_system->Require("guestViewDeny"); | 1654 module_system->Require("guestViewDeny"); |
| 1661 } | 1655 } |
| 1662 } | 1656 } |
| 1663 | 1657 |
| 1664 } // namespace extensions | 1658 } // namespace extensions |
| OLD | NEW |