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

Side by Side Diff: chrome/browser/ui/views/message_center/message_center_widget_delegate.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/message_center/message_center_widget_delegate. h" 5 #include "chrome/browser/ui/views/message_center/message_center_widget_delegate. h"
6 6
7 #include <complex> 7 #include <complex>
8 8
9 #include "chrome/browser/ui/views/message_center/message_center_frame_view.h" 9 #include "chrome/browser/ui/views/message_center/message_center_frame_view.h"
10 #include "chrome/browser/ui/views/message_center/web_notification_tray.h" 10 #include "chrome/browser/ui/views/message_center/web_notification_tray.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 void MessageCenterWidgetDelegate::OnWidgetClosing(views::Widget* widget) { 105 void MessageCenterWidgetDelegate::OnWidgetClosing(views::Widget* widget) {
106 SetIsClosing(true); 106 SetIsClosing(true);
107 tray_->MarkMessageCenterHidden(); 107 tray_->MarkMessageCenterHidden();
108 } 108 }
109 109
110 void MessageCenterWidgetDelegate::PreferredSizeChanged() { 110 void MessageCenterWidgetDelegate::PreferredSizeChanged() {
111 GetWidget()->SetBounds(GetMessageCenterBounds()); 111 GetWidget()->SetBounds(GetMessageCenterBounds());
112 views::View::PreferredSizeChanged(); 112 views::View::PreferredSizeChanged();
113 } 113 }
114 114
115 gfx::Size MessageCenterWidgetDelegate::GetPreferredSize() { 115 gfx::Size MessageCenterWidgetDelegate::GetPreferredSize() const {
116 int preferred_width = kNotificationWidth + 2 * kMarginBetweenItems; 116 int preferred_width = kNotificationWidth + 2 * kMarginBetweenItems;
117 return gfx::Size(preferred_width, GetHeightForWidth(preferred_width)); 117 return gfx::Size(preferred_width, GetHeightForWidth(preferred_width));
118 } 118 }
119 119
120 gfx::Size MessageCenterWidgetDelegate::GetMaximumSize() { 120 gfx::Size MessageCenterWidgetDelegate::GetMaximumSize() {
121 gfx::Size size = GetPreferredSize(); 121 gfx::Size size = GetPreferredSize();
122 return size; 122 return size;
123 } 123 }
124 124
125 int MessageCenterWidgetDelegate::GetHeightForWidth(int width) { 125 int MessageCenterWidgetDelegate::GetHeightForWidth(int width) const {
126 int height = MessageCenterView::GetHeightForWidth(width); 126 int height = MessageCenterView::GetHeightForWidth(width);
127 return (pos_info_.max_height != 0) ? 127 return (pos_info_.max_height != 0) ?
128 std::min(height, pos_info_.max_height - border_insets_.height()) : height; 128 std::min(height, pos_info_.max_height - border_insets_.height()) : height;
129 } 129 }
130 130
131 bool MessageCenterWidgetDelegate::AcceleratorPressed( 131 bool MessageCenterWidgetDelegate::AcceleratorPressed(
132 const ui::Accelerator& accelerator) { 132 const ui::Accelerator& accelerator) {
133 if (accelerator.key_code() != ui::VKEY_ESCAPE) 133 if (accelerator.key_code() != ui::VKEY_ESCAPE)
134 return false; 134 return false;
135 tray_->SendHideMessageCenter(); 135 tray_->SendHideMessageCenter();
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 bounds.set_y(corrected_anchor.y() - size.height()); 235 bounds.set_y(corrected_anchor.y() - size.height());
236 if (pos_info_.message_center_alignment & ALIGNMENT_LEFT) 236 if (pos_info_.message_center_alignment & ALIGNMENT_LEFT)
237 bounds.set_x(corrected_anchor.x()); 237 bounds.set_x(corrected_anchor.x());
238 if (pos_info_.message_center_alignment & ALIGNMENT_RIGHT) 238 if (pos_info_.message_center_alignment & ALIGNMENT_RIGHT)
239 bounds.set_x(corrected_anchor.x() - size.width()); 239 bounds.set_x(corrected_anchor.x() - size.width());
240 240
241 return bounds; 241 return bounds;
242 } 242 }
243 243
244 } // namespace message_center 244 } // namespace message_center
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698