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

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 183923030: Almost finish moving context_menu_node_ from RenderViewImpl to RenderFrameImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: sync to get android fix Created 6 years, 9 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/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/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 1077
1078 ObserverListBase<RenderViewObserver>::Iterator it(observers_); 1078 ObserverListBase<RenderViewObserver>::Iterator it(observers_);
1079 RenderViewObserver* observer; 1079 RenderViewObserver* observer;
1080 while ((observer = it.GetNext()) != NULL) 1080 while ((observer = it.GetNext()) != NULL)
1081 if (observer->OnMessageReceived(message)) 1081 if (observer->OnMessageReceived(message))
1082 return true; 1082 return true;
1083 1083
1084 bool handled = true; 1084 bool handled = true;
1085 bool msg_is_ok = true; 1085 bool msg_is_ok = true;
1086 IPC_BEGIN_MESSAGE_MAP_EX(RenderViewImpl, message, msg_is_ok) 1086 IPC_BEGIN_MESSAGE_MAP_EX(RenderViewImpl, message, msg_is_ok)
1087 IPC_MESSAGE_HANDLER(InputMsg_Copy, OnCopy)
1088 IPC_MESSAGE_HANDLER(InputMsg_Cut, OnCut)
1089 IPC_MESSAGE_HANDLER(InputMsg_Delete, OnDelete) 1087 IPC_MESSAGE_HANDLER(InputMsg_Delete, OnDelete)
1090 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) 1088 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand)
1091 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) 1089 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret)
1092 IPC_MESSAGE_HANDLER(InputMsg_Paste, OnPaste)
1093 IPC_MESSAGE_HANDLER(InputMsg_PasteAndMatchStyle, OnPasteAndMatchStyle) 1090 IPC_MESSAGE_HANDLER(InputMsg_PasteAndMatchStyle, OnPasteAndMatchStyle)
1094 IPC_MESSAGE_HANDLER(InputMsg_Redo, OnRedo) 1091 IPC_MESSAGE_HANDLER(InputMsg_Redo, OnRedo)
1095 IPC_MESSAGE_HANDLER(InputMsg_Replace, OnReplace) 1092 IPC_MESSAGE_HANDLER(InputMsg_Replace, OnReplace)
1096 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling) 1093 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling)
1097 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, 1094 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect,
1098 OnScrollFocusedEditableNodeIntoRect) 1095 OnScrollFocusedEditableNodeIntoRect)
1099 IPC_MESSAGE_HANDLER(InputMsg_SelectAll, OnSelectAll) 1096 IPC_MESSAGE_HANDLER(InputMsg_SelectAll, OnSelectAll)
1100 IPC_MESSAGE_HANDLER(InputMsg_SelectRange, OnSelectRange) 1097 IPC_MESSAGE_HANDLER(InputMsg_SelectRange, OnSelectRange)
1101 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, 1098 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent,
1102 OnSetEditCommandsForNextKeyEvent) 1099 OnSetEditCommandsForNextKeyEvent)
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 void RenderViewImpl::OnUpdateTargetURLAck() { 1277 void RenderViewImpl::OnUpdateTargetURLAck() {
1281 // Check if there is a targeturl waiting to be sent. 1278 // Check if there is a targeturl waiting to be sent.
1282 if (target_url_status_ == TARGET_PENDING) { 1279 if (target_url_status_ == TARGET_PENDING) {
1283 Send(new ViewHostMsg_UpdateTargetURL(routing_id_, page_id_, 1280 Send(new ViewHostMsg_UpdateTargetURL(routing_id_, page_id_,
1284 pending_target_url_)); 1281 pending_target_url_));
1285 } 1282 }
1286 1283
1287 target_url_status_ = TARGET_NONE; 1284 target_url_status_ = TARGET_NONE;
1288 } 1285 }
1289 1286
1290 void RenderViewImpl::OnCopy() {
1291 if (!webview())
1292 return;
1293
1294 base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
1295 WebNode current_node = context_menu_node_.isNull() ?
1296 GetFocusedElement() : context_menu_node_;
1297 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Copy"),
1298 current_node);
1299 }
1300
1301 void RenderViewImpl::OnCut() {
1302 if (!webview())
1303 return;
1304
1305 base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
1306 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Cut"),
1307 GetFocusedElement());
1308 }
1309
1310 void RenderViewImpl::OnDelete() { 1287 void RenderViewImpl::OnDelete() {
1311 if (!webview()) 1288 if (!webview())
1312 return; 1289 return;
1313 1290
1314 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Delete"), 1291 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Delete"),
1315 GetFocusedElement()); 1292 GetFocusedElement());
1316 } 1293 }
1317 1294
1318 void RenderViewImpl::OnExecuteEditCommand(const std::string& name, 1295 void RenderViewImpl::OnExecuteEditCommand(const std::string& name,
1319 const std::string& value) { 1296 const std::string& value) {
1320 if (!webview() || !webview()->focusedFrame()) 1297 if (!webview() || !webview()->focusedFrame())
1321 return; 1298 return;
1322 1299
1323 webview()->focusedFrame()->executeCommand( 1300 webview()->focusedFrame()->executeCommand(
1324 WebString::fromUTF8(name), WebString::fromUTF8(value)); 1301 WebString::fromUTF8(name), WebString::fromUTF8(value));
1325 } 1302 }
1326 1303
1327 void RenderViewImpl::OnMoveCaret(const gfx::Point& point) { 1304 void RenderViewImpl::OnMoveCaret(const gfx::Point& point) {
1328 if (!webview()) 1305 if (!webview())
1329 return; 1306 return;
1330 1307
1331 Send(new ViewHostMsg_MoveCaret_ACK(routing_id_)); 1308 Send(new ViewHostMsg_MoveCaret_ACK(routing_id_));
1332 1309
1333 webview()->focusedFrame()->moveCaretSelection(point); 1310 webview()->focusedFrame()->moveCaretSelection(point);
1334 } 1311 }
1335 1312
1336 void RenderViewImpl::OnPaste() {
1337 if (!webview())
1338 return;
1339
1340 base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
1341 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Paste"),
1342 GetFocusedElement());
1343 }
1344
1345 void RenderViewImpl::OnPasteAndMatchStyle() { 1313 void RenderViewImpl::OnPasteAndMatchStyle() {
1346 if (!webview()) 1314 if (!webview())
1347 return; 1315 return;
1348 1316
1349 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); 1317 base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
1350 webview()->focusedFrame()->executeCommand( 1318 webview()->focusedFrame()->executeCommand(
1351 WebString::fromUTF8("PasteAndMatchStyle"), GetFocusedElement()); 1319 WebString::fromUTF8("PasteAndMatchStyle"), GetFocusedElement());
1352 } 1320 }
1353 1321
1354 void RenderViewImpl::OnRedo() { 1322 void RenderViewImpl::OnRedo() {
(...skipping 3834 matching lines...) Expand 10 before | Expand all | Expand 10 after
5189 for (size_t i = 0; i < icon_urls.size(); i++) { 5157 for (size_t i = 0; i < icon_urls.size(); i++) {
5190 WebURL url = icon_urls[i].iconURL(); 5158 WebURL url = icon_urls[i].iconURL();
5191 if (!url.isEmpty()) 5159 if (!url.isEmpty())
5192 urls.push_back(FaviconURL(url, 5160 urls.push_back(FaviconURL(url,
5193 ToFaviconType(icon_urls[i].iconType()))); 5161 ToFaviconType(icon_urls[i].iconType())));
5194 } 5162 }
5195 SendUpdateFaviconURL(urls); 5163 SendUpdateFaviconURL(urls);
5196 } 5164 }
5197 5165
5198 } // namespace content 5166 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | content/shell/browser/shell_web_contents_view_delegate_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698