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

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

Issue 10693160: Add and specify Views::Textfield::SelectAll |reversed| flag, etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove redundant comments. Created 8 years, 5 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/views/login_view.cc ('k') | ui/gfx/render_text.h » ('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) 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/logging.h" 7 #include "base/logging.h"
8 #include "base/property_bag.h" 8 #include "base/property_bag.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 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 // if there is no selection. 607 // if there is no selection.
608 *start = textfield_->GetCursorPosition(); 608 *start = textfield_->GetCursorPosition();
609 *end = textfield_->GetCursorPosition(); 609 *end = textfield_->GetCursorPosition();
610 } else { 610 } else {
611 *start = static_cast<size_t>(range.end()); 611 *start = static_cast<size_t>(range.end());
612 *end = static_cast<size_t>(range.start()); 612 *end = static_cast<size_t>(range.start());
613 } 613 }
614 } 614 }
615 615
616 void OmniboxViewViews::SelectAll(bool reversed) { 616 void OmniboxViewViews::SelectAll(bool reversed) {
617 if (reversed) 617 textfield_->SelectAll(reversed);
618 textfield_->SelectRange(ui::Range(GetTextLength(), 0));
619 else
620 textfield_->SelectRange(ui::Range(0, GetTextLength()));
621 } 618 }
622 619
623 void OmniboxViewViews::RevertAll() { 620 void OmniboxViewViews::RevertAll() {
624 ClosePopup(); 621 ClosePopup();
625 model_->Revert(); 622 model_->Revert();
626 TextChanged(); 623 TextChanged();
627 } 624 }
628 625
629 void OmniboxViewViews::UpdatePopup() { 626 void OmniboxViewViews::UpdatePopup() {
630 model_->SetInputInProgress(true); 627 model_->SetInputInProgress(true);
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 const ui::Range& range) { 942 const ui::Range& range) {
946 if (text != GetText()) 943 if (text != GetText())
947 textfield_->SetText(text); 944 textfield_->SetText(text);
948 textfield_->SelectRange(range); 945 textfield_->SelectRange(range);
949 } 946 }
950 947
951 string16 OmniboxViewViews::GetSelectedText() const { 948 string16 OmniboxViewViews::GetSelectedText() const {
952 // TODO(oshima): Support instant, IME. 949 // TODO(oshima): Support instant, IME.
953 return textfield_->GetSelectedText(); 950 return textfield_->GetSelectedText();
954 } 951 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/login_view.cc ('k') | ui/gfx/render_text.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698