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

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_view_views.cc

Issue 10412009: Enable disabled omnibox tests on aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 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
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 "chrome/browser/ui/views/omnibox/omnibox_view_views.h" 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h"
6 6
7 #include "base/property_bag.h" 7 #include "base/property_bag.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 } 524 }
525 525
526 bool OmniboxViewViews::DeleteAtEndPressed() { 526 bool OmniboxViewViews::DeleteAtEndPressed() {
527 return delete_at_end_pressed_; 527 return delete_at_end_pressed_;
528 } 528 }
529 529
530 void OmniboxViewViews::GetSelectionBounds(string16::size_type* start, 530 void OmniboxViewViews::GetSelectionBounds(string16::size_type* start,
531 string16::size_type* end) const { 531 string16::size_type* end) const {
532 ui::Range range; 532 ui::Range range;
533 textfield_->GetSelectedRange(&range); 533 textfield_->GetSelectedRange(&range);
534 *start = static_cast<size_t>(range.end()); 534 if (range.is_empty()) {
535 *end = static_cast<size_t>(range.start()); 535 // Omnibox API expects that selection bounds is at cursor position
536 // if there is no selection.
537 *start = textfield_->GetCursorPosition();
538 *end = textfield_->GetCursorPosition();
539 } else {
540 *start = static_cast<size_t>(range.end());
541 *end = static_cast<size_t>(range.start());
542 }
536 } 543 }
537 544
538 void OmniboxViewViews::SelectAll(bool reversed) { 545 void OmniboxViewViews::SelectAll(bool reversed) {
539 if (reversed) 546 if (reversed)
540 textfield_->SelectRange(ui::Range(GetTextLength(), 0)); 547 textfield_->SelectRange(ui::Range(GetTextLength(), 0));
541 else 548 else
542 textfield_->SelectRange(ui::Range(0, GetTextLength())); 549 textfield_->SelectRange(ui::Range(0, GetTextLength()));
543 } 550 }
544 551
545 void OmniboxViewViews::RevertAll() { 552 void OmniboxViewViews::RevertAll() {
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 OmniboxViewViews* omnibox_view = new OmniboxViewViews(controller, 899 OmniboxViewViews* omnibox_view = new OmniboxViewViews(controller,
893 toolbar_model, 900 toolbar_model,
894 profile, 901 profile,
895 command_updater, 902 command_updater,
896 popup_window_mode, 903 popup_window_mode,
897 location_bar); 904 location_bar);
898 omnibox_view->Init(); 905 omnibox_view->Init();
899 return omnibox_view; 906 return omnibox_view;
900 } 907 }
901 #endif 908 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_view_browsertest.cc ('k') | ui/views/controls/textfield/native_textfield_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698