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

Side by Side Diff: chrome/browser/autocomplete/autocomplete_edit.cc

Issue 10791: Added select all text functionality after pressing ESC ... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 12 years 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 | « no previous file | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/browser/autocomplete/autocomplete_edit.h" 5 #include "chrome/browser/autocomplete/autocomplete_edit.h"
6 6
7 #include <locale> 7 #include <locale>
8 8
9 #include "base/base_drag_source.h" 9 #include "base/base_drag_source.h"
10 #include "base/clipboard.h" 10 #include "base/clipboard.h"
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 // Like typing, killing focus "accepts" the temporary text as the user 354 // Like typing, killing focus "accepts" the temporary text as the user
355 // text, because it makes little sense to have temporary text when the 355 // text, because it makes little sense to have temporary text when the
356 // popup is closed. 356 // popup is closed.
357 InternalSetUserText(UserTextFromDisplayText(view_->GetText())); 357 InternalSetUserText(UserTextFromDisplayText(view_->GetText()));
358 has_temporary_text_ = false; 358 has_temporary_text_ = false;
359 } 359 }
360 360
361 bool AutocompleteEditModel::OnEscapeKeyPressed() { 361 bool AutocompleteEditModel::OnEscapeKeyPressed() {
362 // Only do something when there is input in progress -- otherwise, if focus 362 // Only do something when there is input in progress -- otherwise, if focus
363 // happens to be in the location bar, users can't still hit <esc> to stop a 363 // happens to be in the location bar, users can't still hit <esc> to stop a
364 // load. 364 // load. Then select the whole line.
Peter Kasting 2008/11/27 23:36:20 Nit: Don't put this comment here. Instead put an
365 if (!user_input_in_progress_) 365 if (!user_input_in_progress_) {
366 view_->SelectAll(true);
366 return false; 367 return false;
368 }
367 369
368 if (!has_temporary_text_ || 370 if (!has_temporary_text_ ||
369 (popup_->URLsForCurrentSelection(NULL, NULL, NULL) == original_url_)) { 371 (popup_->URLsForCurrentSelection(NULL, NULL, NULL) == original_url_)) {
370 // The popup isn't open or the selection in it is still the default 372 // The popup isn't open or the selection in it is still the default
371 // selection, so revert the box all the way back to its unedited state. 373 // selection, so revert the box all the way back to its unedited state.
372 view_->RevertAll(); 374 view_->RevertAll();
373 return true; 375 return true;
374 } 376 }
375 377
376 // The user typed something, then selected a different item. Restore the 378 // The user typed something, then selected a different item. Restore the
(...skipping 2064 matching lines...) Expand 10 before | Expand all | Expand 10 after
2441 } 2443 }
2442 2444
2443 void AutocompleteEditView::RepaintDropHighlight(int position) { 2445 void AutocompleteEditView::RepaintDropHighlight(int position) {
2444 if ((position != -1) && (position <= GetTextLength())) { 2446 if ((position != -1) && (position <= GetTextLength())) {
2445 const POINT min_loc(PosFromChar(position)); 2447 const POINT min_loc(PosFromChar(position));
2446 const RECT highlight_bounds = {min_loc.x - 1, font_y_adjustment_, 2448 const RECT highlight_bounds = {min_loc.x - 1, font_y_adjustment_,
2447 min_loc.x + 2, font_ascent_ + font_descent_ + font_y_adjustment_}; 2449 min_loc.x + 2, font_ascent_ + font_descent_ + font_y_adjustment_};
2448 InvalidateRect(&highlight_bounds, false); 2450 InvalidateRect(&highlight_bounds, false);
2449 } 2451 }
2450 } 2452 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698