| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/renderer/render_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 wakelock_dispatcher_(nullptr), | 787 wakelock_dispatcher_(nullptr), |
| 788 geolocation_dispatcher_(NULL), | 788 geolocation_dispatcher_(NULL), |
| 789 push_messaging_dispatcher_(NULL), | 789 push_messaging_dispatcher_(NULL), |
| 790 presentation_dispatcher_(NULL), | 790 presentation_dispatcher_(NULL), |
| 791 screen_orientation_dispatcher_(NULL), | 791 screen_orientation_dispatcher_(NULL), |
| 792 manifest_manager_(NULL), | 792 manifest_manager_(NULL), |
| 793 accessibility_mode_(AccessibilityModeOff), | 793 accessibility_mode_(AccessibilityModeOff), |
| 794 renderer_accessibility_(NULL), | 794 renderer_accessibility_(NULL), |
| 795 media_player_delegate_(NULL), | 795 media_player_delegate_(NULL), |
| 796 is_using_lofi_(false), | 796 is_using_lofi_(false), |
| 797 is_pasting_(false), |
| 797 weak_factory_(this) { | 798 weak_factory_(this) { |
| 798 std::pair<RoutingIDFrameMap::iterator, bool> result = | 799 std::pair<RoutingIDFrameMap::iterator, bool> result = |
| 799 g_routing_id_frame_map.Get().insert(std::make_pair(routing_id_, this)); | 800 g_routing_id_frame_map.Get().insert(std::make_pair(routing_id_, this)); |
| 800 CHECK(result.second) << "Inserting a duplicate item."; | 801 CHECK(result.second) << "Inserting a duplicate item."; |
| 801 | 802 |
| 802 // ChildThreadImpl may be null in some tests, in which case we roll our own | 803 // ChildThreadImpl may be null in some tests, in which case we roll our own |
| 803 // ServiceRegistry. | 804 // ServiceRegistry. |
| 804 if (ChildThreadImpl::current()) { | 805 if (ChildThreadImpl::current()) { |
| 805 service_registry_ = ChildThreadImpl::current()->service_registry() | 806 service_registry_ = ChildThreadImpl::current()->service_registry() |
| 806 ->CreateServiceRegistryForRoute(routing_id_); | 807 ->CreateServiceRegistryForRoute(routing_id_); |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1447 | 1448 |
| 1448 void RenderFrameImpl::OnCopy() { | 1449 void RenderFrameImpl::OnCopy() { |
| 1449 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); | 1450 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); |
| 1450 WebNode current_node = context_menu_node_.isNull() ? | 1451 WebNode current_node = context_menu_node_.isNull() ? |
| 1451 GetFocusedElement() : context_menu_node_; | 1452 GetFocusedElement() : context_menu_node_; |
| 1452 frame_->executeCommand(WebString::fromUTF8("Copy"), current_node); | 1453 frame_->executeCommand(WebString::fromUTF8("Copy"), current_node); |
| 1453 } | 1454 } |
| 1454 | 1455 |
| 1455 void RenderFrameImpl::OnPaste() { | 1456 void RenderFrameImpl::OnPaste() { |
| 1456 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); | 1457 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); |
| 1458 base::AutoReset<bool> handling_paste(&is_pasting_, true); |
| 1457 frame_->executeCommand(WebString::fromUTF8("Paste"), GetFocusedElement()); | 1459 frame_->executeCommand(WebString::fromUTF8("Paste"), GetFocusedElement()); |
| 1458 } | 1460 } |
| 1459 | 1461 |
| 1460 void RenderFrameImpl::OnPasteAndMatchStyle() { | 1462 void RenderFrameImpl::OnPasteAndMatchStyle() { |
| 1461 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); | 1463 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); |
| 1462 frame_->executeCommand( | 1464 frame_->executeCommand( |
| 1463 WebString::fromUTF8("PasteAndMatchStyle"), GetFocusedElement()); | 1465 WebString::fromUTF8("PasteAndMatchStyle"), GetFocusedElement()); |
| 1464 } | 1466 } |
| 1465 | 1467 |
| 1466 #if defined(OS_MACOSX) | 1468 #if defined(OS_MACOSX) |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1711 } | 1713 } |
| 1712 | 1714 |
| 1713 void RenderFrameImpl::OnExecuteNoValueEditCommand(const std::string& name) { | 1715 void RenderFrameImpl::OnExecuteNoValueEditCommand(const std::string& name) { |
| 1714 frame_->executeCommand(WebString::fromUTF8(name), GetFocusedElement()); | 1716 frame_->executeCommand(WebString::fromUTF8(name), GetFocusedElement()); |
| 1715 } | 1717 } |
| 1716 | 1718 |
| 1717 void RenderFrameImpl::OnExtendSelectionAndDelete(int before, int after) { | 1719 void RenderFrameImpl::OnExtendSelectionAndDelete(int before, int after) { |
| 1718 if (!GetRenderWidget()->ShouldHandleImeEvent()) | 1720 if (!GetRenderWidget()->ShouldHandleImeEvent()) |
| 1719 return; | 1721 return; |
| 1720 | 1722 |
| 1721 DCHECK(!WebUserGestureIndicator::isProcessingUserGesture()); | |
| 1722 | |
| 1723 ImeEventGuard guard(GetRenderWidget()); | 1723 ImeEventGuard guard(GetRenderWidget()); |
| 1724 blink::WebScopedUserGesture gesture_indicator; | |
| 1725 frame_->extendSelectionAndDelete(before, after); | 1724 frame_->extendSelectionAndDelete(before, after); |
| 1726 } | 1725 } |
| 1727 | 1726 |
| 1728 void RenderFrameImpl::OnSetAccessibilityMode(AccessibilityMode new_mode) { | 1727 void RenderFrameImpl::OnSetAccessibilityMode(AccessibilityMode new_mode) { |
| 1729 if (accessibility_mode_ == new_mode) | 1728 if (accessibility_mode_ == new_mode) |
| 1730 return; | 1729 return; |
| 1731 accessibility_mode_ = new_mode; | 1730 accessibility_mode_ = new_mode; |
| 1732 if (renderer_accessibility_) { | 1731 if (renderer_accessibility_) { |
| 1733 // Note: this isn't called automatically by the destructor because | 1732 // Note: this isn't called automatically by the destructor because |
| 1734 // there'd be no point in calling it in frame teardown, only if there's | 1733 // there'd be no point in calling it in frame teardown, only if there's |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2120 void RenderFrameImpl::AddMessageToConsole(ConsoleMessageLevel level, | 2119 void RenderFrameImpl::AddMessageToConsole(ConsoleMessageLevel level, |
| 2121 const std::string& message) { | 2120 const std::string& message) { |
| 2122 if (devtools_agent_) | 2121 if (devtools_agent_) |
| 2123 devtools_agent_->AddMessageToConsole(level, message); | 2122 devtools_agent_->AddMessageToConsole(level, message); |
| 2124 } | 2123 } |
| 2125 | 2124 |
| 2126 bool RenderFrameImpl::IsUsingLoFi() const { | 2125 bool RenderFrameImpl::IsUsingLoFi() const { |
| 2127 return is_using_lofi_; | 2126 return is_using_lofi_; |
| 2128 } | 2127 } |
| 2129 | 2128 |
| 2129 bool RenderFrameImpl::IsPasting() const { |
| 2130 return is_pasting_; |
| 2131 } |
| 2132 |
| 2130 // blink::WebFrameClient implementation ---------------------------------------- | 2133 // blink::WebFrameClient implementation ---------------------------------------- |
| 2131 | 2134 |
| 2132 blink::WebPlugin* RenderFrameImpl::createPlugin( | 2135 blink::WebPlugin* RenderFrameImpl::createPlugin( |
| 2133 blink::WebLocalFrame* frame, | 2136 blink::WebLocalFrame* frame, |
| 2134 const blink::WebPluginParams& params) { | 2137 const blink::WebPluginParams& params) { |
| 2135 DCHECK_EQ(frame_, frame); | 2138 DCHECK_EQ(frame_, frame); |
| 2136 blink::WebPlugin* plugin = NULL; | 2139 blink::WebPlugin* plugin = NULL; |
| 2137 if (GetContentClient()->renderer()->OverrideCreatePlugin( | 2140 if (GetContentClient()->renderer()->OverrideCreatePlugin( |
| 2138 this, frame, params, &plugin)) { | 2141 this, frame, params, &plugin)) { |
| 2139 return plugin; | 2142 return plugin; |
| (...skipping 3274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5414 media::ConvertToSwitchOutputDeviceCB(web_callbacks); | 5417 media::ConvertToSwitchOutputDeviceCB(web_callbacks); |
| 5415 scoped_refptr<media::AudioOutputDevice> device = | 5418 scoped_refptr<media::AudioOutputDevice> device = |
| 5416 AudioDeviceFactory::NewOutputDevice(routing_id_, 0, sink_id.utf8(), | 5419 AudioDeviceFactory::NewOutputDevice(routing_id_, 0, sink_id.utf8(), |
| 5417 security_origin); | 5420 security_origin); |
| 5418 media::OutputDeviceStatus status = device->GetDeviceStatus(); | 5421 media::OutputDeviceStatus status = device->GetDeviceStatus(); |
| 5419 device->Stop(); | 5422 device->Stop(); |
| 5420 callback.Run(status); | 5423 callback.Run(status); |
| 5421 } | 5424 } |
| 5422 | 5425 |
| 5423 } // namespace content | 5426 } // namespace content |
| OLD | NEW |