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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 #include "third_party/WebKit/public/web/WebDocument.h" | 92 #include "third_party/WebKit/public/web/WebDocument.h" |
93 #include "third_party/WebKit/public/web/WebFrame.h" | 93 #include "third_party/WebKit/public/web/WebFrame.h" |
94 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 94 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
95 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" | 95 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" |
96 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" | 96 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" |
97 #include "third_party/WebKit/public/web/WebView.h" | 97 #include "third_party/WebKit/public/web/WebView.h" |
98 #include "third_party/mojo/src/mojo/public/js/constants.h" | 98 #include "third_party/mojo/src/mojo/public/js/constants.h" |
99 #include "ui/base/layout.h" | 99 #include "ui/base/layout.h" |
100 #include "ui/base/resource/resource_bundle.h" | 100 #include "ui/base/resource/resource_bundle.h" |
101 #include "v8/include/v8.h" | 101 #include "v8/include/v8.h" |
| 102 #include "extensions/common/guest_view/guest_view_messages.h" |
| 103 #include "extensions/renderer/guest_view/extensions_guest_view_container.h" |
102 | 104 |
103 using base::UserMetricsAction; | 105 using base::UserMetricsAction; |
104 using blink::WebDataSource; | 106 using blink::WebDataSource; |
105 using blink::WebDocument; | 107 using blink::WebDocument; |
106 using blink::WebFrame; | 108 using blink::WebFrame; |
107 using blink::WebScopedUserGesture; | 109 using blink::WebScopedUserGesture; |
108 using blink::WebSecurityPolicy; | 110 using blink::WebSecurityPolicy; |
109 using blink::WebString; | 111 using blink::WebString; |
110 using blink::WebVector; | 112 using blink::WebVector; |
111 using blink::WebView; | 113 using blink::WebView; |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 IPC_MESSAGE_HANDLER(ExtensionMsg_ShouldSuspend, OnShouldSuspend) | 808 IPC_MESSAGE_HANDLER(ExtensionMsg_ShouldSuspend, OnShouldSuspend) |
807 IPC_MESSAGE_HANDLER(ExtensionMsg_Suspend, OnSuspend) | 809 IPC_MESSAGE_HANDLER(ExtensionMsg_Suspend, OnSuspend) |
808 IPC_MESSAGE_HANDLER(ExtensionMsg_TransferBlobs, OnTransferBlobs) | 810 IPC_MESSAGE_HANDLER(ExtensionMsg_TransferBlobs, OnTransferBlobs) |
809 IPC_MESSAGE_HANDLER(ExtensionMsg_Unloaded, OnUnloaded) | 811 IPC_MESSAGE_HANDLER(ExtensionMsg_Unloaded, OnUnloaded) |
810 IPC_MESSAGE_HANDLER(ExtensionMsg_UpdatePermissions, OnUpdatePermissions) | 812 IPC_MESSAGE_HANDLER(ExtensionMsg_UpdatePermissions, OnUpdatePermissions) |
811 IPC_MESSAGE_HANDLER(ExtensionMsg_UpdateTabSpecificPermissions, | 813 IPC_MESSAGE_HANDLER(ExtensionMsg_UpdateTabSpecificPermissions, |
812 OnUpdateTabSpecificPermissions) | 814 OnUpdateTabSpecificPermissions) |
813 IPC_MESSAGE_HANDLER(ExtensionMsg_ClearTabSpecificPermissions, | 815 IPC_MESSAGE_HANDLER(ExtensionMsg_ClearTabSpecificPermissions, |
814 OnClearTabSpecificPermissions) | 816 OnClearTabSpecificPermissions) |
815 IPC_MESSAGE_HANDLER(ExtensionMsg_UsingWebRequestAPI, OnUsingWebRequestAPI) | 817 IPC_MESSAGE_HANDLER(ExtensionMsg_UsingWebRequestAPI, OnUsingWebRequestAPI) |
| 818 IPC_MESSAGE_HANDLER_GENERIC(GuestViewMsg_ContentWindowReady, |
| 819 OnGuestContentWindowReady(message)) |
816 IPC_MESSAGE_FORWARD(ExtensionMsg_WatchPages, | 820 IPC_MESSAGE_FORWARD(ExtensionMsg_WatchPages, |
817 content_watcher_.get(), | 821 content_watcher_.get(), |
818 ContentWatcher::OnWatchPages) | 822 ContentWatcher::OnWatchPages) |
819 IPC_MESSAGE_UNHANDLED(handled = false) | 823 IPC_MESSAGE_UNHANDLED(handled = false) |
820 IPC_END_MESSAGE_MAP() | 824 IPC_END_MESSAGE_MAP() |
821 | 825 |
822 return handled; | 826 return handled; |
823 } | 827 } |
824 | 828 |
825 void Dispatcher::WebKitInitialized() { | 829 void Dispatcher::WebKitInitialized() { |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1135 extension->permissions_data()->GetEffectiveHostPermissions()); | 1139 extension->permissions_data()->GetEffectiveHostPermissions()); |
1136 } | 1140 } |
1137 } | 1141 } |
1138 } | 1142 } |
1139 } | 1143 } |
1140 | 1144 |
1141 void Dispatcher::OnUsingWebRequestAPI(bool webrequest_used) { | 1145 void Dispatcher::OnUsingWebRequestAPI(bool webrequest_used) { |
1142 webrequest_used_ = webrequest_used; | 1146 webrequest_used_ = webrequest_used; |
1143 } | 1147 } |
1144 | 1148 |
| 1149 void Dispatcher::OnGuestContentWindowReady(const IPC::Message& message) { |
| 1150 GuestViewMsg_ContentWindowReady::Param param; |
| 1151 bool read_status = GuestViewMsg_ContentWindowReady::Read(&message, ¶m); |
| 1152 DCHECK(read_status); |
| 1153 int element_instance_id = get<0>(param); |
| 1154 ExtensionsGuestViewContainer* container = |
| 1155 ExtensionsGuestViewContainer::FromID( |
| 1156 element_instance_id); |
| 1157 DCHECK(container); |
| 1158 container->OnMessageReceived(message); |
| 1159 } |
| 1160 |
1145 void Dispatcher::OnUserScriptsUpdated( | 1161 void Dispatcher::OnUserScriptsUpdated( |
1146 const std::set<std::string>& changed_extensions, | 1162 const std::set<std::string>& changed_extensions, |
1147 const std::vector<UserScript*>& scripts) { | 1163 const std::vector<UserScript*>& scripts) { |
1148 UpdateActiveExtensions(); | 1164 UpdateActiveExtensions(); |
1149 } | 1165 } |
1150 | 1166 |
1151 void Dispatcher::UpdateActiveExtensions() { | 1167 void Dispatcher::UpdateActiveExtensions() { |
1152 std::set<std::string> active_extensions = active_extension_ids_; | 1168 std::set<std::string> active_extensions = active_extension_ids_; |
1153 user_script_set_manager_->GetAllActiveExtensionIds(&active_extensions); | 1169 user_script_set_manager_->GetAllActiveExtensionIds(&active_extensions); |
1154 delegate_->OnActiveExtensionsUpdated(active_extensions); | 1170 delegate_->OnActiveExtensionsUpdated(active_extensions); |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1544 return v8::Handle<v8::Object>(); | 1560 return v8::Handle<v8::Object>(); |
1545 | 1561 |
1546 if (bind_name) | 1562 if (bind_name) |
1547 *bind_name = split.back(); | 1563 *bind_name = split.back(); |
1548 | 1564 |
1549 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) | 1565 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) |
1550 : bind_object; | 1566 : bind_object; |
1551 } | 1567 } |
1552 | 1568 |
1553 } // namespace extensions | 1569 } // namespace extensions |
OLD | NEW |