OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 2153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2164 GetSelectionBounds(&start_rect, &end_rect); | 2164 GetSelectionBounds(&start_rect, &end_rect); |
2165 gfx::Point start_point(start_rect.x(), | 2165 gfx::Point start_point(start_rect.x(), |
2166 start_rect.bottom()); | 2166 start_rect.bottom()); |
2167 gfx::Point end_point(end_rect.right(), | 2167 gfx::Point end_point(end_rect.right(), |
2168 end_rect.bottom()); | 2168 end_rect.bottom()); |
2169 params.selection_start = GetScrollOffset().Add(start_point); | 2169 params.selection_start = GetScrollOffset().Add(start_point); |
2170 params.selection_end = GetScrollOffset().Add(end_point); | 2170 params.selection_end = GetScrollOffset().Add(end_point); |
2171 #endif | 2171 #endif |
2172 | 2172 |
2173 Send(new ViewHostMsg_ContextMenu(routing_id_, params)); | 2173 Send(new ViewHostMsg_ContextMenu(routing_id_, params)); |
| 2174 |
| 2175 FOR_EACH_OBSERVER( |
| 2176 RenderViewObserver, observers_, DidRequestShowContextMenu(frame, data)); |
2174 } | 2177 } |
2175 | 2178 |
2176 void RenderViewImpl::setStatusText(const WebString& text) { | 2179 void RenderViewImpl::setStatusText(const WebString& text) { |
2177 } | 2180 } |
2178 | 2181 |
2179 void RenderViewImpl::UpdateTargetURL(const GURL& url, | 2182 void RenderViewImpl::UpdateTargetURL(const GURL& url, |
2180 const GURL& fallback_url) { | 2183 const GURL& fallback_url) { |
2181 GURL latest_url = url.is_empty() ? fallback_url : url; | 2184 GURL latest_url = url.is_empty() ? fallback_url : url; |
2182 if (latest_url == target_url_) | 2185 if (latest_url == target_url_) |
2183 return; | 2186 return; |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2626 void RenderViewImpl::loadURLExternally( | 2629 void RenderViewImpl::loadURLExternally( |
2627 WebFrame* frame, const WebURLRequest& request, | 2630 WebFrame* frame, const WebURLRequest& request, |
2628 WebNavigationPolicy policy) { | 2631 WebNavigationPolicy policy) { |
2629 loadURLExternally(frame, request, policy, WebString()); | 2632 loadURLExternally(frame, request, policy, WebString()); |
2630 } | 2633 } |
2631 | 2634 |
2632 void RenderViewImpl::Repaint(const gfx::Size& size) { | 2635 void RenderViewImpl::Repaint(const gfx::Size& size) { |
2633 OnMsgRepaint(size); | 2636 OnMsgRepaint(size); |
2634 } | 2637 } |
2635 | 2638 |
| 2639 void RenderViewImpl::SetEditCommandForNextKeyEvent(const std::string& name, |
| 2640 const std::string& value) { |
| 2641 EditCommands edit_commands; |
| 2642 edit_commands.push_back(EditCommand(name, value)); |
| 2643 OnSetEditCommandsForNextKeyEvent(edit_commands); |
| 2644 } |
| 2645 |
| 2646 void RenderViewImpl::ClearEditCommands() { |
| 2647 edit_commands_.clear(); |
| 2648 } |
| 2649 |
2636 void RenderViewImpl::loadURLExternally( | 2650 void RenderViewImpl::loadURLExternally( |
2637 WebFrame* frame, const WebURLRequest& request, | 2651 WebFrame* frame, const WebURLRequest& request, |
2638 WebNavigationPolicy policy, | 2652 WebNavigationPolicy policy, |
2639 const WebString& suggested_name) { | 2653 const WebString& suggested_name) { |
2640 Referrer referrer( | 2654 Referrer referrer( |
2641 GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))), | 2655 GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))), |
2642 GetReferrerPolicyFromRequest(frame, request)); | 2656 GetReferrerPolicyFromRequest(frame, request)); |
2643 if (policy == WebKit::WebNavigationPolicyDownload) { | 2657 if (policy == WebKit::WebNavigationPolicyDownload) { |
2644 Send(new ViewHostMsg_DownloadUrl(routing_id_, request.url(), referrer, | 2658 Send(new ViewHostMsg_DownloadUrl(routing_id_, request.url(), referrer, |
2645 suggested_name)); | 2659 suggested_name)); |
(...skipping 2966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5612 } | 5626 } |
5613 | 5627 |
5614 void RenderViewImpl::Close() { | 5628 void RenderViewImpl::Close() { |
5615 // We need to grab a pointer to the doomed WebView before we destroy it. | 5629 // We need to grab a pointer to the doomed WebView before we destroy it. |
5616 WebView* doomed = webview(); | 5630 WebView* doomed = webview(); |
5617 RenderWidget::Close(); | 5631 RenderWidget::Close(); |
5618 g_view_map.Get().erase(doomed); | 5632 g_view_map.Get().erase(doomed); |
5619 } | 5633 } |
5620 | 5634 |
5621 void RenderViewImpl::DidHandleKeyEvent() { | 5635 void RenderViewImpl::DidHandleKeyEvent() { |
5622 edit_commands_.clear(); | 5636 ClearEditCommands(); |
5623 } | 5637 } |
5624 | 5638 |
5625 bool RenderViewImpl::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { | 5639 bool RenderViewImpl::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { |
5626 pepper_delegate_.WillHandleMouseEvent(); | 5640 pepper_delegate_.WillHandleMouseEvent(); |
5627 | 5641 |
5628 // If the mouse is locked, only the current owner of the mouse lock can | 5642 // If the mouse is locked, only the current owner of the mouse lock can |
5629 // process mouse events. | 5643 // process mouse events. |
5630 return mouse_lock_dispatcher_->WillHandleMouseEvent(event); | 5644 return mouse_lock_dispatcher_->WillHandleMouseEvent(event); |
5631 } | 5645 } |
5632 | 5646 |
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6317 } | 6331 } |
6318 #endif | 6332 #endif |
6319 | 6333 |
6320 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( | 6334 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( |
6321 TransportDIB::Handle dib_handle) { | 6335 TransportDIB::Handle dib_handle) { |
6322 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); | 6336 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); |
6323 RenderProcess::current()->ReleaseTransportDIB(dib); | 6337 RenderProcess::current()->ReleaseTransportDIB(dib); |
6324 } | 6338 } |
6325 | 6339 |
6326 } // namespace content | 6340 } // namespace content |
OLD | NEW |