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

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

Issue 273223002: views: Make view::Views::GetPreferredSize() const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More compile fix for ToT Created 6 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 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"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 return kViewClassName; 99 return kViewClassName;
100 } 100 }
101 101
102 views::View* DecoratedTextfield::GetEventHandlerForRect(const gfx::Rect& rect) { 102 views::View* DecoratedTextfield::GetEventHandlerForRect(const gfx::Rect& rect) {
103 views::View* handler = views::Textfield::GetEventHandlerForRect(rect); 103 views::View* handler = views::Textfield::GetEventHandlerForRect(rect);
104 if (handler->GetClassName() == TooltipIcon::kViewClassName) 104 if (handler->GetClassName() == TooltipIcon::kViewClassName)
105 return handler; 105 return handler;
106 return this; 106 return this;
107 } 107 }
108 108
109 gfx::Size DecoratedTextfield::GetPreferredSize() { 109 gfx::Size DecoratedTextfield::GetPreferredSize() const {
110 static const int height = 110 static const int height =
111 views::LabelButton(NULL, base::string16()).GetPreferredSize().height(); 111 views::LabelButton(NULL, base::string16()).GetPreferredSize().height();
112 const gfx::Size size = views::Textfield::GetPreferredSize(); 112 const gfx::Size size = views::Textfield::GetPreferredSize();
113 return gfx::Size(size.width(), std::max(size.height(), height)); 113 return gfx::Size(size.width(), std::max(size.height(), height));
114 } 114 }
115 115
116 void DecoratedTextfield::Layout() { 116 void DecoratedTextfield::Layout() {
117 views::Textfield::Layout(); 117 views::Textfield::Layout();
118 118
119 if (icon_view_ && icon_view_->visible()) { 119 if (icon_view_ && icon_view_->visible()) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 159 }
160 160
161 void DecoratedTextfield::IconChanged() { 161 void DecoratedTextfield::IconChanged() {
162 // Don't show the icon if nothing else is showing. 162 // Don't show the icon if nothing else is showing.
163 icon_view_->SetVisible(editable_ || !text().empty()); 163 icon_view_->SetVisible(editable_ || !text().empty());
164 UpdateBorder(); 164 UpdateBorder();
165 Layout(); 165 Layout();
166 } 166 }
167 167
168 } // namespace autofill 168 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698