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 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 kEventDispatchFunction, &args)); | 636 kEventDispatchFunction, &args)); |
637 } | 637 } |
638 | 638 |
639 void Dispatcher::InvokeModuleSystemMethod(content::RenderFrame* render_frame, | 639 void Dispatcher::InvokeModuleSystemMethod(content::RenderFrame* render_frame, |
640 const std::string& extension_id, | 640 const std::string& extension_id, |
641 const std::string& module_name, | 641 const std::string& module_name, |
642 const std::string& function_name, | 642 const std::string& function_name, |
643 const base::ListValue& args, | 643 const base::ListValue& args, |
644 bool user_gesture) { | 644 bool user_gesture) { |
645 std::unique_ptr<WebScopedUserGesture> web_user_gesture; | 645 std::unique_ptr<WebScopedUserGesture> web_user_gesture; |
646 if (user_gesture) | 646 if (user_gesture) { |
647 web_user_gesture.reset(new WebScopedUserGesture); | 647 blink::WebLocalFrame* web_frame = |
| 648 render_frame ? render_frame->GetWebFrame() : nullptr; |
| 649 web_user_gesture.reset(new WebScopedUserGesture(web_frame)); |
| 650 } |
648 | 651 |
649 script_context_set_->ForEach( | 652 script_context_set_->ForEach( |
650 extension_id, render_frame, | 653 extension_id, render_frame, |
651 base::Bind(&CallModuleMethod, module_name, function_name, &args)); | 654 base::Bind(&CallModuleMethod, module_name, function_name, &args)); |
652 | 655 |
653 // Reset the idle handler each time there's any activity like event or message | 656 // Reset the idle handler each time there's any activity like event or message |
654 // dispatch, for which Invoke is the chokepoint. | 657 // dispatch, for which Invoke is the chokepoint. |
655 if (set_idle_notifications_) { | 658 if (set_idle_notifications_) { |
656 RenderThread::Get()->ScheduleIdleHandler( | 659 RenderThread::Get()->ScheduleIdleHandler( |
657 kInitialExtensionIdleHandlerDelayMs); | 660 kInitialExtensionIdleHandlerDelayMs); |
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1652 // The "guestViewDeny" module must always be loaded last. It registers | 1655 // The "guestViewDeny" module must always be loaded last. It registers |
1653 // error-providing custom elements for the GuestView types that are not | 1656 // error-providing custom elements for the GuestView types that are not |
1654 // available, and thus all of those types must have been checked and loaded | 1657 // available, and thus all of those types must have been checked and loaded |
1655 // (or not loaded) beforehand. | 1658 // (or not loaded) beforehand. |
1656 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { | 1659 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { |
1657 module_system->Require("guestViewDeny"); | 1660 module_system->Require("guestViewDeny"); |
1658 } | 1661 } |
1659 } | 1662 } |
1660 | 1663 |
1661 } // namespace extensions | 1664 } // namespace extensions |
OLD | NEW |