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

Side by Side Diff: chrome/browser/ui/views/autofill/info_bubble.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/info_bubble.h" 5 #include "chrome/browser/ui/views/autofill/info_bubble.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "ui/gfx/point.h" 8 #include "ui/gfx/point.h"
9 #include "ui/gfx/rect.h" 9 #include "ui/gfx/rect.h"
10 #include "ui/gfx/size.h" 10 #include "ui/gfx/size.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 views::NonClientFrameView* InfoBubble::CreateNonClientFrameView( 120 views::NonClientFrameView* InfoBubble::CreateNonClientFrameView(
121 views::Widget* widget) { 121 views::Widget* widget) {
122 DCHECK(!frame_); 122 DCHECK(!frame_);
123 frame_ = new InfoBubbleFrame(margins()); 123 frame_ = new InfoBubbleFrame(margins());
124 frame_->set_available_bounds(anchor_widget()->GetWindowBoundsInScreen()); 124 frame_->set_available_bounds(anchor_widget()->GetWindowBoundsInScreen());
125 frame_->SetBubbleBorder(scoped_ptr<views::BubbleBorder>( 125 frame_->SetBubbleBorder(scoped_ptr<views::BubbleBorder>(
126 new views::BubbleBorder(arrow(), shadow(), color()))); 126 new views::BubbleBorder(arrow(), shadow(), color())));
127 return frame_; 127 return frame_;
128 } 128 }
129 129
130 gfx::Size InfoBubble::GetPreferredSize() { 130 gfx::Size InfoBubble::GetPreferredSize() const {
131 int pref_width = preferred_width_; 131 int pref_width = preferred_width_;
132 pref_width -= frame_->GetInsets().width(); 132 pref_width -= frame_->GetInsets().width();
133 pref_width -= 2 * kBubbleBorderVisibleWidth; 133 pref_width -= 2 * kBubbleBorderVisibleWidth;
134 return gfx::Size(pref_width, GetHeightForWidth(pref_width)); 134 return gfx::Size(pref_width, GetHeightForWidth(pref_width));
135 } 135 }
136 136
137 void InfoBubble::OnWidgetDestroyed(views::Widget* widget) { 137 void InfoBubble::OnWidgetDestroyed(views::Widget* widget) {
138 if (widget == widget_) 138 if (widget == widget_)
139 widget_ = NULL; 139 widget_ = NULL;
140 } 140 }
141 141
142 void InfoBubble::OnWidgetBoundsChanged(views::Widget* widget, 142 void InfoBubble::OnWidgetBoundsChanged(views::Widget* widget,
143 const gfx::Rect& new_bounds) { 143 const gfx::Rect& new_bounds) {
144 views::BubbleDelegateView::OnWidgetBoundsChanged(widget, new_bounds); 144 views::BubbleDelegateView::OnWidgetBoundsChanged(widget, new_bounds);
145 if (anchor_widget() == widget) 145 if (anchor_widget() == widget)
146 frame_->set_available_bounds(widget->GetWindowBoundsInScreen()); 146 frame_->set_available_bounds(widget->GetWindowBoundsInScreen());
147 } 147 }
148 148
149 } // namespace autofill 149 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/autofill/info_bubble.h ('k') | chrome/browser/ui/views/autofill/new_credit_card_bubble_views.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698