| 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 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2633 void RenderViewImpl::loadURLExternally( | 2636 void RenderViewImpl::loadURLExternally( |
| 2634 WebFrame* frame, const WebURLRequest& request, | 2637 WebFrame* frame, const WebURLRequest& request, |
| 2635 WebNavigationPolicy policy) { | 2638 WebNavigationPolicy policy) { |
| 2636 loadURLExternally(frame, request, policy, WebString()); | 2639 loadURLExternally(frame, request, policy, WebString()); |
| 2637 } | 2640 } |
| 2638 | 2641 |
| 2639 void RenderViewImpl::Repaint(const gfx::Size& size) { | 2642 void RenderViewImpl::Repaint(const gfx::Size& size) { |
| 2640 OnMsgRepaint(size); | 2643 OnMsgRepaint(size); |
| 2641 } | 2644 } |
| 2642 | 2645 |
| 2646 void RenderViewImpl::SetEditCommandForNextKeyEvent(const std::string& name, |
| 2647 const std::string& value) { |
| 2648 EditCommands edit_commands; |
| 2649 edit_commands.push_back(EditCommand(name, value)); |
| 2650 OnSetEditCommandsForNextKeyEvent(edit_commands); |
| 2651 } |
| 2652 |
| 2653 void RenderViewImpl::ClearEditCommands() { |
| 2654 edit_commands_.clear(); |
| 2655 } |
| 2656 |
| 2643 void RenderViewImpl::loadURLExternally( | 2657 void RenderViewImpl::loadURLExternally( |
| 2644 WebFrame* frame, const WebURLRequest& request, | 2658 WebFrame* frame, const WebURLRequest& request, |
| 2645 WebNavigationPolicy policy, | 2659 WebNavigationPolicy policy, |
| 2646 const WebString& suggested_name) { | 2660 const WebString& suggested_name) { |
| 2647 Referrer referrer( | 2661 Referrer referrer( |
| 2648 GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))), | 2662 GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))), |
| 2649 GetReferrerPolicyFromRequest(frame, request)); | 2663 GetReferrerPolicyFromRequest(frame, request)); |
| 2650 if (policy == WebKit::WebNavigationPolicyDownload) { | 2664 if (policy == WebKit::WebNavigationPolicyDownload) { |
| 2651 Send(new ViewHostMsg_DownloadUrl(routing_id_, request.url(), referrer, | 2665 Send(new ViewHostMsg_DownloadUrl(routing_id_, request.url(), referrer, |
| 2652 suggested_name)); | 2666 suggested_name)); |
| (...skipping 2966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5619 } | 5633 } |
| 5620 | 5634 |
| 5621 void RenderViewImpl::Close() { | 5635 void RenderViewImpl::Close() { |
| 5622 // We need to grab a pointer to the doomed WebView before we destroy it. | 5636 // We need to grab a pointer to the doomed WebView before we destroy it. |
| 5623 WebView* doomed = webview(); | 5637 WebView* doomed = webview(); |
| 5624 RenderWidget::Close(); | 5638 RenderWidget::Close(); |
| 5625 g_view_map.Get().erase(doomed); | 5639 g_view_map.Get().erase(doomed); |
| 5626 } | 5640 } |
| 5627 | 5641 |
| 5628 void RenderViewImpl::DidHandleKeyEvent() { | 5642 void RenderViewImpl::DidHandleKeyEvent() { |
| 5629 edit_commands_.clear(); | 5643 ClearEditCommands(); |
| 5630 } | 5644 } |
| 5631 | 5645 |
| 5632 bool RenderViewImpl::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { | 5646 bool RenderViewImpl::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { |
| 5633 pepper_delegate_.WillHandleMouseEvent(); | 5647 pepper_delegate_.WillHandleMouseEvent(); |
| 5634 | 5648 |
| 5635 // If the mouse is locked, only the current owner of the mouse lock can | 5649 // If the mouse is locked, only the current owner of the mouse lock can |
| 5636 // process mouse events. | 5650 // process mouse events. |
| 5637 return mouse_lock_dispatcher_->WillHandleMouseEvent(event); | 5651 return mouse_lock_dispatcher_->WillHandleMouseEvent(event); |
| 5638 } | 5652 } |
| 5639 | 5653 |
| (...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6328 } | 6342 } |
| 6329 #endif | 6343 #endif |
| 6330 | 6344 |
| 6331 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( | 6345 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( |
| 6332 TransportDIB::Handle dib_handle) { | 6346 TransportDIB::Handle dib_handle) { |
| 6333 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); | 6347 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); |
| 6334 RenderProcess::current()->ReleaseTransportDIB(dib); | 6348 RenderProcess::current()->ReleaseTransportDIB(dib); |
| 6335 } | 6349 } |
| 6336 | 6350 |
| 6337 } // namespace content | 6351 } // namespace content |
| OLD | NEW |