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

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

Issue 6356004: If the user selects text in the current tab, and types CTRL-F,... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 11 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 | « chrome/browser/ui/find_bar/find_bar_controller.cc ('k') | no next file » | 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 "chrome/renderer/render_view.h" 5 #include "chrome/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 2233 matching lines...) Expand 10 before | Expand all | Expand 10 after
2244 2244
2245 bool RenderView::isSelectTrailingWhitespaceEnabled() { 2245 bool RenderView::isSelectTrailingWhitespaceEnabled() {
2246 #if defined(OS_WIN) 2246 #if defined(OS_WIN)
2247 return true; 2247 return true;
2248 #else 2248 #else
2249 return false; 2249 return false;
2250 #endif 2250 #endif
2251 } 2251 }
2252 2252
2253 void RenderView::didChangeSelection(bool is_empty_selection) { 2253 void RenderView::didChangeSelection(bool is_empty_selection) {
2254 #if defined(OS_POSIX)
2255 if (!handling_input_event_) 2254 if (!handling_input_event_)
2256 return; 2255 return;
2257 // TODO(estade): investigate incremental updates to the selection so that we 2256 // TODO(estade): investigate incremental updates to the selection so that we
2258 // don't send the entire selection over IPC every time. 2257 // don't send the entire selection over IPC every time.
2259 if (!is_empty_selection) { 2258 if (!is_empty_selection) {
2260 // Sometimes we get repeated didChangeSelection calls from webkit when 2259 // Sometimes we get repeated didChangeSelection calls from webkit when
2261 // the selection hasn't actually changed. We don't want to report these 2260 // the selection hasn't actually changed. We don't want to report these
2262 // because it will cause us to continually claim the X clipboard. 2261 // because it will cause us to continually claim the X clipboard.
2263 const std::string& this_selection = 2262 const std::string& this_selection =
2264 webview()->focusedFrame()->selectionAsText().utf8(); 2263 webview()->focusedFrame()->selectionAsText().utf8();
2265 if (this_selection == last_selection_) 2264 if (this_selection == last_selection_)
2266 return; 2265 return;
2267 2266
2268 Send(new ViewHostMsg_SelectionChanged(routing_id_, 2267 Send(new ViewHostMsg_SelectionChanged(routing_id_,
2269 this_selection)); 2268 this_selection));
2270 last_selection_ = this_selection; 2269 last_selection_ = this_selection;
2271 } else { 2270 } else {
2272 last_selection_.clear(); 2271 last_selection_.clear();
2273 Send(new ViewHostMsg_SelectionChanged(routing_id_, 2272 Send(new ViewHostMsg_SelectionChanged(routing_id_,
2274 last_selection_)); 2273 last_selection_));
2275 } 2274 }
2276 #endif // defined(OS_POSIX)
2277 } 2275 }
2278 2276
2279 void RenderView::didExecuteCommand(const WebString& command_name) { 2277 void RenderView::didExecuteCommand(const WebString& command_name) {
2280 const std::string& name = UTF16ToUTF8(command_name); 2278 const std::string& name = UTF16ToUTF8(command_name);
2281 if (StartsWithASCII(name, "Move", true) || 2279 if (StartsWithASCII(name, "Move", true) ||
2282 StartsWithASCII(name, "Insert", true) || 2280 StartsWithASCII(name, "Insert", true) ||
2283 StartsWithASCII(name, "Delete", true)) 2281 StartsWithASCII(name, "Delete", true))
2284 return; 2282 return;
2285 UserMetricsRecordAction(name); 2283 UserMetricsRecordAction(name);
2286 } 2284 }
(...skipping 3427 matching lines...) Expand 10 before | Expand all | Expand 10 after
5714 if (cmd == kJavaScriptStressTestSetStressRunType) { 5712 if (cmd == kJavaScriptStressTestSetStressRunType) {
5715 v8::Testing::SetStressRunType(static_cast<v8::Testing::StressType>(param)); 5713 v8::Testing::SetStressRunType(static_cast<v8::Testing::StressType>(param));
5716 } else if (cmd == kJavaScriptStressTestPrepareStressRun) { 5714 } else if (cmd == kJavaScriptStressTestPrepareStressRun) {
5717 v8::Testing::PrepareStressRun(param); 5715 v8::Testing::PrepareStressRun(param);
5718 } 5716 }
5719 } 5717 }
5720 5718
5721 void RenderView::OnContextMenuClosed() { 5719 void RenderView::OnContextMenuClosed() {
5722 context_menu_node_.reset(); 5720 context_menu_node_.reset();
5723 } 5721 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/find_bar/find_bar_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698