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

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

Issue 6289009: [Mac] Implement the system dictionary popup by implementing NSTextInput methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Clang Created 9 years, 7 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
« no previous file with comments | « content/content_common.gypi ('k') | content/renderer/render_widget.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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.h" 5 #include "content/renderer/render_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after
1425 return true; 1425 return true;
1426 #else 1426 #else
1427 return false; 1427 return false;
1428 #endif 1428 #endif
1429 } 1429 }
1430 1430
1431 void RenderView::didChangeSelection(bool is_empty_selection) { 1431 void RenderView::didChangeSelection(bool is_empty_selection) {
1432 #if defined(OS_POSIX) 1432 #if defined(OS_POSIX)
1433 if (!handling_input_event_) 1433 if (!handling_input_event_)
1434 return; 1434 return;
1435 // TODO(estade): investigate incremental updates to the selection so that we 1435
1436 // don't send the entire selection over IPC every time. 1436 if (is_empty_selection) {
1437 if (!is_empty_selection) { 1437 last_selection_.clear();
1438 } else {
1438 // Sometimes we get repeated didChangeSelection calls from webkit when 1439 // Sometimes we get repeated didChangeSelection calls from webkit when
1439 // the selection hasn't actually changed. We don't want to report these 1440 // the selection hasn't actually changed. We don't want to report these
1440 // because it will cause us to continually claim the X clipboard. 1441 // because it will cause us to continually claim the X clipboard.
1441 const std::string& this_selection = 1442 WebFrame* frame = webview()->focusedFrame();
1442 webview()->focusedFrame()->selectionAsText().utf8(); 1443 const std::string& this_selection = frame->selectionAsText().utf8();
1443 if (this_selection == last_selection_) 1444 if (this_selection == last_selection_)
1444 return; 1445 return;
1446 last_selection_ = this_selection;
1447 }
1445 1448
1446 Send(new ViewHostMsg_SelectionChanged(routing_id_, 1449 ui::Range range(ui::Range::InvalidRange());
1447 this_selection)); 1450 size_t location, length;
1448 last_selection_ = this_selection; 1451 if (webview()->caretOrSelectionRange(&location, &length)) {
1449 } else { 1452 range.set_start(location);
1450 last_selection_.clear(); 1453 range.set_end(location + length);
1451 Send(new ViewHostMsg_SelectionChanged(routing_id_,
1452 last_selection_));
1453 } 1454 }
1455 Send(new ViewHostMsg_SelectionChanged(routing_id_, last_selection_, range));
1454 #endif // defined(OS_POSIX) 1456 #endif // defined(OS_POSIX)
1455 } 1457 }
1456 1458
1457 void RenderView::didExecuteCommand(const WebString& command_name) { 1459 void RenderView::didExecuteCommand(const WebString& command_name) {
1458 const std::string& name = UTF16ToUTF8(command_name); 1460 const std::string& name = UTF16ToUTF8(command_name);
1459 if (StartsWithASCII(name, "Move", true) || 1461 if (StartsWithASCII(name, "Move", true) ||
1460 StartsWithASCII(name, "Insert", true) || 1462 StartsWithASCII(name, "Insert", true) ||
1461 StartsWithASCII(name, "Delete", true)) 1463 StartsWithASCII(name, "Delete", true))
1462 return; 1464 return;
1463 webkit_glue::UserMetricsRecordAction(name); 1465 webkit_glue::UserMetricsRecordAction(name);
(...skipping 2759 matching lines...) Expand 10 before | Expand all | Expand 10 after
4223 const webkit_glue::CustomContextMenuContext& custom_context) { 4225 const webkit_glue::CustomContextMenuContext& custom_context) {
4224 if (custom_context.is_pepper_menu) 4226 if (custom_context.is_pepper_menu)
4225 pepper_delegate_.OnContextMenuClosed(custom_context); 4227 pepper_delegate_.OnContextMenuClosed(custom_context);
4226 else 4228 else
4227 context_menu_node_.reset(); 4229 context_menu_node_.reset();
4228 } 4230 }
4229 4231
4230 void RenderView::OnNetworkStateChanged(bool online) { 4232 void RenderView::OnNetworkStateChanged(bool online) {
4231 WebNetworkStateNotifier::setOnLine(online); 4233 WebNetworkStateNotifier::setOnLine(online);
4232 } 4234 }
OLDNEW
« no previous file with comments | « content/content_common.gypi ('k') | content/renderer/render_widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698