Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: content/browser/renderer_host/render_view_host_impl.cc

Issue 130773004: Start moving context menu code to RenderFrame. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/browser/renderer_host/render_view_host_impl.h" 5 #include "content/browser/renderer_host/render_view_host_impl.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnRequestMove) 1231 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnRequestMove)
1232 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStartLoading, OnDidStartLoading) 1232 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStartLoading, OnDidStartLoading)
1233 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStopLoading, OnDidStopLoading) 1233 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStopLoading, OnDidStopLoading)
1234 IPC_MESSAGE_HANDLER(ViewHostMsg_DidChangeLoadProgress, 1234 IPC_MESSAGE_HANDLER(ViewHostMsg_DidChangeLoadProgress,
1235 OnDidChangeLoadProgress) 1235 OnDidChangeLoadProgress)
1236 IPC_MESSAGE_HANDLER(ViewHostMsg_DidDisownOpener, OnDidDisownOpener) 1236 IPC_MESSAGE_HANDLER(ViewHostMsg_DidDisownOpener, OnDidDisownOpener)
1237 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentAvailableInMainFrame, 1237 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentAvailableInMainFrame,
1238 OnDocumentAvailableInMainFrame) 1238 OnDocumentAvailableInMainFrame)
1239 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentOnLoadCompletedInMainFrame, 1239 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentOnLoadCompletedInMainFrame,
1240 OnDocumentOnLoadCompletedInMainFrame) 1240 OnDocumentOnLoadCompletedInMainFrame)
1241 IPC_MESSAGE_HANDLER(ViewHostMsg_ContextMenu, OnContextMenu)
1242 IPC_MESSAGE_HANDLER(ViewHostMsg_ToggleFullscreen, OnToggleFullscreen) 1241 IPC_MESSAGE_HANDLER(ViewHostMsg_ToggleFullscreen, OnToggleFullscreen)
1243 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenURL, OnOpenURL) 1242 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenURL, OnOpenURL)
1244 IPC_MESSAGE_HANDLER(ViewHostMsg_DidContentsPreferredSizeChange, 1243 IPC_MESSAGE_HANDLER(ViewHostMsg_DidContentsPreferredSizeChange,
1245 OnDidContentsPreferredSizeChange) 1244 OnDidContentsPreferredSizeChange)
1246 IPC_MESSAGE_HANDLER(ViewHostMsg_DidChangeScrollOffset, 1245 IPC_MESSAGE_HANDLER(ViewHostMsg_DidChangeScrollOffset,
1247 OnDidChangeScrollOffset) 1246 OnDidChangeScrollOffset)
1248 IPC_MESSAGE_HANDLER(ViewHostMsg_DidChangeScrollbarsForMainFrame, 1247 IPC_MESSAGE_HANDLER(ViewHostMsg_DidChangeScrollbarsForMainFrame,
1249 OnDidChangeScrollbarsForMainFrame) 1248 OnDidChangeScrollbarsForMainFrame)
1250 IPC_MESSAGE_HANDLER(ViewHostMsg_DidChangeScrollOffsetPinningForMainFrame, 1249 IPC_MESSAGE_HANDLER(ViewHostMsg_DidChangeScrollOffsetPinningForMainFrame,
1251 OnDidChangeScrollOffsetPinningForMainFrame) 1250 OnDidChangeScrollOffsetPinningForMainFrame)
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
1602 1601
1603 void RenderViewHostImpl::OnDocumentAvailableInMainFrame() { 1602 void RenderViewHostImpl::OnDocumentAvailableInMainFrame() {
1604 delegate_->DocumentAvailableInMainFrame(this); 1603 delegate_->DocumentAvailableInMainFrame(this);
1605 } 1604 }
1606 1605
1607 void RenderViewHostImpl::OnDocumentOnLoadCompletedInMainFrame( 1606 void RenderViewHostImpl::OnDocumentOnLoadCompletedInMainFrame(
1608 int32 page_id) { 1607 int32 page_id) {
1609 delegate_->DocumentOnLoadCompletedInMainFrame(this, page_id); 1608 delegate_->DocumentOnLoadCompletedInMainFrame(this, page_id);
1610 } 1609 }
1611 1610
1612 void RenderViewHostImpl::OnContextMenu(const ContextMenuParams& params) {
1613 // Validate the URLs in |params|. If the renderer can't request the URLs
1614 // directly, don't show them in the context menu.
1615 ContextMenuParams validated_params(params);
1616 RenderProcessHost* process = GetProcess();
1617
1618 // We don't validate |unfiltered_link_url| so that this field can be used
1619 // when users want to copy the original link URL.
1620 process->FilterURL(true, &validated_params.link_url);
1621 process->FilterURL(true, &validated_params.src_url);
1622 process->FilterURL(false, &validated_params.page_url);
1623 process->FilterURL(true, &validated_params.frame_url);
1624
1625 delegate_->ShowContextMenu(validated_params);
1626 }
1627
1628 void RenderViewHostImpl::OnToggleFullscreen(bool enter_fullscreen) { 1611 void RenderViewHostImpl::OnToggleFullscreen(bool enter_fullscreen) {
1629 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1612 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1630 delegate_->ToggleFullscreenMode(enter_fullscreen); 1613 delegate_->ToggleFullscreenMode(enter_fullscreen);
1631 // We need to notify the contents that its fullscreen state has changed. This 1614 // We need to notify the contents that its fullscreen state has changed. This
1632 // is done as part of the resize message. 1615 // is done as part of the resize message.
1633 WasResized(); 1616 WasResized();
1634 } 1617 }
1635 1618
1636 void RenderViewHostImpl::OnOpenURL( 1619 void RenderViewHostImpl::OnOpenURL(
1637 const ViewHostMsg_OpenURL_Params& params) { 1620 const ViewHostMsg_OpenURL_Params& params) {
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
2055 const gfx::Size& max_size) { 2038 const gfx::Size& max_size) {
2056 SetShouldAutoResize(true); 2039 SetShouldAutoResize(true);
2057 Send(new ViewMsg_EnableAutoResize(GetRoutingID(), min_size, max_size)); 2040 Send(new ViewMsg_EnableAutoResize(GetRoutingID(), min_size, max_size));
2058 } 2041 }
2059 2042
2060 void RenderViewHostImpl::DisableAutoResize(const gfx::Size& new_size) { 2043 void RenderViewHostImpl::DisableAutoResize(const gfx::Size& new_size) {
2061 SetShouldAutoResize(false); 2044 SetShouldAutoResize(false);
2062 Send(new ViewMsg_DisableAutoResize(GetRoutingID(), new_size)); 2045 Send(new ViewMsg_DisableAutoResize(GetRoutingID(), new_size));
2063 } 2046 }
2064 2047
2065 void RenderViewHostImpl::ExecuteCustomContextMenuCommand(
2066 int action, const CustomContextMenuContext& context) {
2067 Send(new ViewMsg_CustomContextMenuAction(GetRoutingID(), context, action));
2068 }
2069
2070 void RenderViewHostImpl::NotifyContextMenuClosed(
2071 const CustomContextMenuContext& context) {
2072 Send(new ViewMsg_ContextMenuClosed(GetRoutingID(), context));
2073 }
2074
2075 void RenderViewHostImpl::CopyImageAt(int x, int y) { 2048 void RenderViewHostImpl::CopyImageAt(int x, int y) {
2076 Send(new ViewMsg_CopyImageAt(GetRoutingID(), x, y)); 2049 Send(new ViewMsg_CopyImageAt(GetRoutingID(), x, y));
2077 } 2050 }
2078 2051
2079 void RenderViewHostImpl::ExecuteMediaPlayerActionAtLocation( 2052 void RenderViewHostImpl::ExecuteMediaPlayerActionAtLocation(
2080 const gfx::Point& location, const blink::WebMediaPlayerAction& action) { 2053 const gfx::Point& location, const blink::WebMediaPlayerAction& action) {
2081 Send(new ViewMsg_MediaPlayerActionAt(GetRoutingID(), location, action)); 2054 Send(new ViewMsg_MediaPlayerActionAt(GetRoutingID(), location, action));
2082 } 2055 }
2083 2056
2084 void RenderViewHostImpl::ExecutePluginActionAtLocation( 2057 void RenderViewHostImpl::ExecutePluginActionAtLocation(
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
2264 void RenderViewHostImpl::AttachToFrameTree() { 2237 void RenderViewHostImpl::AttachToFrameTree() {
2265 FrameTree* frame_tree = delegate_->GetFrameTree(); 2238 FrameTree* frame_tree = delegate_->GetFrameTree();
2266 2239
2267 frame_tree->ResetForMainFrameSwap(); 2240 frame_tree->ResetForMainFrameSwap();
2268 if (main_frame_id() != FrameTreeNode::kInvalidFrameId) { 2241 if (main_frame_id() != FrameTreeNode::kInvalidFrameId) {
2269 frame_tree->OnFirstNavigationAfterSwap(main_frame_id()); 2242 frame_tree->OnFirstNavigationAfterSwap(main_frame_id());
2270 } 2243 }
2271 } 2244 }
2272 2245
2273 } // namespace content 2246 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698