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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 #include "third_party/WebKit/public/web/WebFrame.h" | 90 #include "third_party/WebKit/public/web/WebFrame.h" |
91 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 91 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
92 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 92 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
93 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" | 93 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" |
94 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" | 94 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" |
95 #include "third_party/WebKit/public/web/WebView.h" | 95 #include "third_party/WebKit/public/web/WebView.h" |
96 #include "third_party/mojo/src/mojo/public/js/constants.h" | 96 #include "third_party/mojo/src/mojo/public/js/constants.h" |
97 #include "ui/base/layout.h" | 97 #include "ui/base/layout.h" |
98 #include "ui/base/resource/resource_bundle.h" | 98 #include "ui/base/resource/resource_bundle.h" |
99 #include "v8/include/v8.h" | 99 #include "v8/include/v8.h" |
| 100 #include "extensions/common/guest_view/guest_view_messages.h" |
| 101 #include "extensions/renderer/guest_view/extensions_guest_view_container.h" |
100 | 102 |
101 using base::UserMetricsAction; | 103 using base::UserMetricsAction; |
102 using blink::WebDataSource; | 104 using blink::WebDataSource; |
103 using blink::WebDocument; | 105 using blink::WebDocument; |
104 using blink::WebScopedUserGesture; | 106 using blink::WebScopedUserGesture; |
105 using blink::WebSecurityPolicy; | 107 using blink::WebSecurityPolicy; |
106 using blink::WebString; | 108 using blink::WebString; |
107 using blink::WebVector; | 109 using blink::WebVector; |
108 using blink::WebView; | 110 using blink::WebView; |
109 using content::RenderThread; | 111 using content::RenderThread; |
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 IPC_MESSAGE_HANDLER(ExtensionMsg_ShouldSuspend, OnShouldSuspend) | 733 IPC_MESSAGE_HANDLER(ExtensionMsg_ShouldSuspend, OnShouldSuspend) |
732 IPC_MESSAGE_HANDLER(ExtensionMsg_Suspend, OnSuspend) | 734 IPC_MESSAGE_HANDLER(ExtensionMsg_Suspend, OnSuspend) |
733 IPC_MESSAGE_HANDLER(ExtensionMsg_TransferBlobs, OnTransferBlobs) | 735 IPC_MESSAGE_HANDLER(ExtensionMsg_TransferBlobs, OnTransferBlobs) |
734 IPC_MESSAGE_HANDLER(ExtensionMsg_Unloaded, OnUnloaded) | 736 IPC_MESSAGE_HANDLER(ExtensionMsg_Unloaded, OnUnloaded) |
735 IPC_MESSAGE_HANDLER(ExtensionMsg_UpdatePermissions, OnUpdatePermissions) | 737 IPC_MESSAGE_HANDLER(ExtensionMsg_UpdatePermissions, OnUpdatePermissions) |
736 IPC_MESSAGE_HANDLER(ExtensionMsg_UpdateTabSpecificPermissions, | 738 IPC_MESSAGE_HANDLER(ExtensionMsg_UpdateTabSpecificPermissions, |
737 OnUpdateTabSpecificPermissions) | 739 OnUpdateTabSpecificPermissions) |
738 IPC_MESSAGE_HANDLER(ExtensionMsg_ClearTabSpecificPermissions, | 740 IPC_MESSAGE_HANDLER(ExtensionMsg_ClearTabSpecificPermissions, |
739 OnClearTabSpecificPermissions) | 741 OnClearTabSpecificPermissions) |
740 IPC_MESSAGE_HANDLER(ExtensionMsg_UsingWebRequestAPI, OnUsingWebRequestAPI) | 742 IPC_MESSAGE_HANDLER(ExtensionMsg_UsingWebRequestAPI, OnUsingWebRequestAPI) |
| 743 IPC_MESSAGE_HANDLER_GENERIC(GuestViewMsg_ContentWindowReady, |
| 744 OnGuestContentWindowReady(message)) |
741 IPC_MESSAGE_FORWARD(ExtensionMsg_WatchPages, | 745 IPC_MESSAGE_FORWARD(ExtensionMsg_WatchPages, |
742 content_watcher_.get(), | 746 content_watcher_.get(), |
743 ContentWatcher::OnWatchPages) | 747 ContentWatcher::OnWatchPages) |
744 IPC_MESSAGE_UNHANDLED(handled = false) | 748 IPC_MESSAGE_UNHANDLED(handled = false) |
745 IPC_END_MESSAGE_MAP() | 749 IPC_END_MESSAGE_MAP() |
746 | 750 |
747 return handled; | 751 return handled; |
748 } | 752 } |
749 | 753 |
750 void Dispatcher::WebKitInitialized() { | 754 void Dispatcher::WebKitInitialized() { |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 extension->permissions_data()->GetEffectiveHostPermissions()); | 1059 extension->permissions_data()->GetEffectiveHostPermissions()); |
1056 } | 1060 } |
1057 } | 1061 } |
1058 } | 1062 } |
1059 } | 1063 } |
1060 | 1064 |
1061 void Dispatcher::OnUsingWebRequestAPI(bool webrequest_used) { | 1065 void Dispatcher::OnUsingWebRequestAPI(bool webrequest_used) { |
1062 webrequest_used_ = webrequest_used; | 1066 webrequest_used_ = webrequest_used; |
1063 } | 1067 } |
1064 | 1068 |
| 1069 void Dispatcher::OnGuestContentWindowReady(const IPC::Message& message) { |
| 1070 GuestViewMsg_ContentWindowReady::Param param; |
| 1071 bool read_status = GuestViewMsg_ContentWindowReady::Read(&message, ¶m); |
| 1072 DCHECK(read_status); |
| 1073 int element_instance_id = get<0>(param); |
| 1074 ExtensionsGuestViewContainer* container = |
| 1075 ExtensionsGuestViewContainer::FromID( |
| 1076 element_instance_id); |
| 1077 DCHECK(container); |
| 1078 container->OnMessageReceived(message); |
| 1079 } |
| 1080 |
1065 void Dispatcher::OnUserScriptsUpdated(const std::set<HostID>& changed_hosts, | 1081 void Dispatcher::OnUserScriptsUpdated(const std::set<HostID>& changed_hosts, |
1066 const std::vector<UserScript*>& scripts) { | 1082 const std::vector<UserScript*>& scripts) { |
1067 UpdateActiveExtensions(); | 1083 UpdateActiveExtensions(); |
1068 } | 1084 } |
1069 | 1085 |
1070 void Dispatcher::UpdateActiveExtensions() { | 1086 void Dispatcher::UpdateActiveExtensions() { |
1071 std::set<std::string> active_extensions = active_extension_ids_; | 1087 std::set<std::string> active_extensions = active_extension_ids_; |
1072 user_script_set_manager_->GetAllActiveExtensionIds(&active_extensions); | 1088 user_script_set_manager_->GetAllActiveExtensionIds(&active_extensions); |
1073 delegate_->OnActiveExtensionsUpdated(active_extensions); | 1089 delegate_->OnActiveExtensionsUpdated(active_extensions); |
1074 } | 1090 } |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1439 // The "guestViewDeny" module must always be loaded last. It registers | 1455 // The "guestViewDeny" module must always be loaded last. It registers |
1440 // error-providing custom elements for the GuestView types that are not | 1456 // error-providing custom elements for the GuestView types that are not |
1441 // available, and thus all of those types must have been checked and loaded | 1457 // available, and thus all of those types must have been checked and loaded |
1442 // (or not loaded) beforehand. | 1458 // (or not loaded) beforehand. |
1443 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { | 1459 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { |
1444 module_system->Require("guestViewDeny"); | 1460 module_system->Require("guestViewDeny"); |
1445 } | 1461 } |
1446 } | 1462 } |
1447 | 1463 |
1448 } // namespace extensions | 1464 } // namespace extensions |
OLD | NEW |