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

Side by Side Diff: chrome/browser/ui/views/autofill/decorated_textfield.cc

Issue 120503005: Merge NativeTextfieldViews into views::Textfield. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename GetText to text. Created 6 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/autofill/decorated_textfield.h" 5 #include "chrome/browser/ui/views/autofill/decorated_textfield.h"
6 6
7 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" 7 #include "chrome/browser/ui/autofill/autofill_dialog_types.h"
8 #include "chrome/browser/ui/views/autofill/tooltip_icon.h" 8 #include "chrome/browser/ui/views/autofill/tooltip_icon.h"
9 #include "ui/gfx/canvas.h" 9 #include "ui/gfx/canvas.h"
10 #include "ui/views/background.h" 10 #include "ui/views/background.h"
11 #include "ui/views/controls/button/label_button.h" 11 #include "ui/views/controls/button/label_button.h"
12 #include "ui/views/controls/focusable_border.h" 12 #include "ui/views/controls/focusable_border.h"
13 #include "ui/views/controls/textfield/native_textfield_views.h"
14 #include "ui/views/controls/textfield/textfield_controller.h" 13 #include "ui/views/controls/textfield/textfield_controller.h"
15 14
16 namespace { 15 namespace {
17 16
18 // Padding around icons inside DecoratedTextfields. 17 // Padding around icons inside DecoratedTextfields.
19 const int kTextfieldIconPadding = 3; 18 const int kTextfieldIconPadding = 3;
20 19
21 } // namespace 20 } // namespace
22 21
23 namespace autofill { 22 namespace autofill {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 } 117 }
119 118
120 const char* DecoratedTextfield::GetClassName() const { 119 const char* DecoratedTextfield::GetClassName() const {
121 return kViewClassName; 120 return kViewClassName;
122 } 121 }
123 122
124 views::View* DecoratedTextfield::GetEventHandlerForRect(const gfx::Rect& rect) { 123 views::View* DecoratedTextfield::GetEventHandlerForRect(const gfx::Rect& rect) {
125 views::View* handler = views::Textfield::GetEventHandlerForRect(rect); 124 views::View* handler = views::Textfield::GetEventHandlerForRect(rect);
126 if (handler->GetClassName() == TooltipIcon::kViewClassName) 125 if (handler->GetClassName() == TooltipIcon::kViewClassName)
127 return handler; 126 return handler;
128 return textfield_view_; 127 return this;
129 } 128 }
130 129
131 void DecoratedTextfield::OnFocus() { 130 void DecoratedTextfield::OnFocus() {
132 views::Textfield::OnFocus(); 131 views::Textfield::OnFocus();
133 SchedulePaint(); 132 SchedulePaint();
134 } 133 }
135 134
136 void DecoratedTextfield::OnBlur() { 135 void DecoratedTextfield::OnBlur() {
137 views::Textfield::OnBlur(); 136 views::Textfield::OnBlur();
138 SchedulePaint(); 137 SchedulePaint();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 icon_view_->GetPreferredSize().width() + 2 * kTextfieldIconPadding : 0; 176 icon_view_->GetPreferredSize().width() + 2 * kTextfieldIconPadding : 0;
178 177
179 bool is_rtl = base::i18n::IsRTL(); 178 bool is_rtl = base::i18n::IsRTL();
180 SetHorizontalMargins(is_rtl ? icon_space : 0, is_rtl ? 0 : icon_space); 179 SetHorizontalMargins(is_rtl ? icon_space : 0, is_rtl ? 0 : icon_space);
181 180
182 Layout(); 181 Layout();
183 SchedulePaint(); 182 SchedulePaint();
184 } 183 }
185 184
186 } // namespace autofill 185 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698