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/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 IPC_BEGIN_MESSAGE_MAP_EX(RenderFrameImpl, msg, msg_is_ok) | 533 IPC_BEGIN_MESSAGE_MAP_EX(RenderFrameImpl, msg, msg_is_ok) |
534 IPC_MESSAGE_HANDLER(FrameMsg_Navigate, OnNavigate) | 534 IPC_MESSAGE_HANDLER(FrameMsg_Navigate, OnNavigate) |
535 IPC_MESSAGE_HANDLER(FrameMsg_SwapOut, OnSwapOut) | 535 IPC_MESSAGE_HANDLER(FrameMsg_SwapOut, OnSwapOut) |
536 IPC_MESSAGE_HANDLER(FrameMsg_BuffersSwapped, OnBuffersSwapped) | 536 IPC_MESSAGE_HANDLER(FrameMsg_BuffersSwapped, OnBuffersSwapped) |
537 IPC_MESSAGE_HANDLER_GENERIC(FrameMsg_CompositorFrameSwapped, | 537 IPC_MESSAGE_HANDLER_GENERIC(FrameMsg_CompositorFrameSwapped, |
538 OnCompositorFrameSwapped(msg)) | 538 OnCompositorFrameSwapped(msg)) |
539 IPC_MESSAGE_HANDLER(FrameMsg_ChildFrameProcessGone, OnChildFrameProcessGone) | 539 IPC_MESSAGE_HANDLER(FrameMsg_ChildFrameProcessGone, OnChildFrameProcessGone) |
540 IPC_MESSAGE_HANDLER(FrameMsg_ContextMenuClosed, OnContextMenuClosed) | 540 IPC_MESSAGE_HANDLER(FrameMsg_ContextMenuClosed, OnContextMenuClosed) |
541 IPC_MESSAGE_HANDLER(FrameMsg_CustomContextMenuAction, | 541 IPC_MESSAGE_HANDLER(FrameMsg_CustomContextMenuAction, |
542 OnCustomContextMenuAction) | 542 OnCustomContextMenuAction) |
| 543 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest) |
543 IPC_END_MESSAGE_MAP_EX() | 544 IPC_END_MESSAGE_MAP_EX() |
544 | 545 |
545 if (!msg_is_ok) { | 546 if (!msg_is_ok) { |
546 // The message had a handler, but its deserialization failed. | 547 // The message had a handler, but its deserialization failed. |
547 // Kill the renderer to avoid potential spoofing attacks. | 548 // Kill the renderer to avoid potential spoofing attacks. |
548 CHECK(false) << "Unable to deserialize message in RenderFrameImpl."; | 549 CHECK(false) << "Unable to deserialize message in RenderFrameImpl."; |
549 } | 550 } |
550 | 551 |
551 return handled; | 552 return handled; |
552 } | 553 } |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 ContextMenuClient* client = | 832 ContextMenuClient* client = |
832 pending_context_menus_.Lookup(custom_context.request_id); | 833 pending_context_menus_.Lookup(custom_context.request_id); |
833 if (client) | 834 if (client) |
834 client->OnMenuAction(custom_context.request_id, action); | 835 client->OnMenuAction(custom_context.request_id, action); |
835 } else { | 836 } else { |
836 // Internal request, forward to WebKit. | 837 // Internal request, forward to WebKit. |
837 render_view_->webview()->performCustomContextMenuAction(action); | 838 render_view_->webview()->performCustomContextMenuAction(action); |
838 } | 839 } |
839 } | 840 } |
840 | 841 |
| 842 void RenderFrameImpl::OnCSSInsertRequest(const std::string& css) { |
| 843 frame_->document().insertStyleSheet(WebString::fromUTF8(css)); |
| 844 } |
| 845 |
841 bool RenderFrameImpl::ShouldUpdateSelectionTextFromContextMenuParams( | 846 bool RenderFrameImpl::ShouldUpdateSelectionTextFromContextMenuParams( |
842 const base::string16& selection_text, | 847 const base::string16& selection_text, |
843 size_t selection_text_offset, | 848 size_t selection_text_offset, |
844 const gfx::Range& selection_range, | 849 const gfx::Range& selection_range, |
845 const ContextMenuParams& params) { | 850 const ContextMenuParams& params) { |
846 base::string16 trimmed_selection_text; | 851 base::string16 trimmed_selection_text; |
847 if (!selection_text.empty() && !selection_range.is_empty()) { | 852 if (!selection_text.empty() && !selection_range.is_empty()) { |
848 const int start = selection_range.GetMin() - selection_text_offset; | 853 const int start = selection_range.GetMin() - selection_text_offset; |
849 const size_t length = selection_range.length(); | 854 const size_t length = selection_range.length(); |
850 if (start >= 0 && start + length <= selection_text.length()) { | 855 if (start >= 0 && start + length <= selection_text.length()) { |
(...skipping 1725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2576 policy == blink::WebNavigationPolicyNewForegroundTab || | 2581 policy == blink::WebNavigationPolicyNewForegroundTab || |
2577 policy == blink::WebNavigationPolicyNewWindow || | 2582 policy == blink::WebNavigationPolicyNewWindow || |
2578 policy == blink::WebNavigationPolicyNewPopup) { | 2583 policy == blink::WebNavigationPolicyNewPopup) { |
2579 WebUserGestureIndicator::consumeUserGesture(); | 2584 WebUserGestureIndicator::consumeUserGesture(); |
2580 } | 2585 } |
2581 | 2586 |
2582 Send(new FrameHostMsg_OpenURL(routing_id_, params)); | 2587 Send(new FrameHostMsg_OpenURL(routing_id_, params)); |
2583 } | 2588 } |
2584 | 2589 |
2585 } // namespace content | 2590 } // namespace content |
OLD | NEW |