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

Side by Side Diff: ash/frame/caption_buttons/frame_caption_button_container_view.cc

Issue 2901503003: Rename GetPreferredSize to CalculatePreferredSize in ash/ (Closed)
Patch Set: improvements Created 3 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
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 "ash/frame/caption_buttons/frame_caption_button_container_view.h" 5 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <map> 8 #include <map>
9 9
10 #include "ash/frame/caption_buttons/frame_caption_button.h" 10 #include "ash/frame/caption_buttons/frame_caption_button.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 size_button_->SetVisible(true); 198 size_button_->SetVisible(true);
199 maximize_mode_animation_->SetSlideDuration(kShowAnimationDurationMs); 199 maximize_mode_animation_->SetSlideDuration(kShowAnimationDurationMs);
200 maximize_mode_animation_->Show(); 200 maximize_mode_animation_->Show();
201 } else { 201 } else {
202 maximize_mode_animation_->SetSlideDuration(kHideAnimationDurationMs); 202 maximize_mode_animation_->SetSlideDuration(kHideAnimationDurationMs);
203 maximize_mode_animation_->Hide(); 203 maximize_mode_animation_->Hide();
204 } 204 }
205 } 205 }
206 206
207 void FrameCaptionButtonContainerView::SetButtonSize(const gfx::Size& size) { 207 void FrameCaptionButtonContainerView::SetButtonSize(const gfx::Size& size) {
208 minimize_button_->set_size(size); 208 minimize_button_->set_preferred_size(size);
209 size_button_->set_size(size); 209 size_button_->set_preferred_size(size);
210 close_button_->set_size(size); 210 close_button_->set_preferred_size(size);
211 } 211 }
212 212
213 gfx::Size FrameCaptionButtonContainerView::GetPreferredSize() const { 213 gfx::Size FrameCaptionButtonContainerView::CalculatePreferredSize() const {
214 int width = 0; 214 int width = 0;
215 for (int i = 0; i < child_count(); ++i) { 215 for (int i = 0; i < child_count(); ++i) {
216 const views::View* child = child_at(i); 216 const views::View* child = child_at(i);
217 if (child->visible()) 217 if (child->visible())
218 width += child_at(i)->GetPreferredSize().width(); 218 width += child_at(i)->GetPreferredSize().width();
219 } 219 }
220 return gfx::Size(width, close_button_->GetPreferredSize().height()); 220 return gfx::Size(width, close_button_->GetPreferredSize().height());
221 } 221 }
222 222
223 void FrameCaptionButtonContainerView::Layout() { 223 void FrameCaptionButtonContainerView::Layout() {
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 views::Button::ButtonState new_state = views::Button::STATE_NORMAL; 404 views::Button::ButtonState new_state = views::Button::STATE_NORMAL;
405 if (button == to_hover) 405 if (button == to_hover)
406 new_state = views::Button::STATE_HOVERED; 406 new_state = views::Button::STATE_HOVERED;
407 else if (button == to_press) 407 else if (button == to_press)
408 new_state = views::Button::STATE_PRESSED; 408 new_state = views::Button::STATE_PRESSED;
409 button->SetState(new_state); 409 button->SetState(new_state);
410 } 410 }
411 } 411 }
412 412
413 } // namespace ash 413 } // namespace ash
OLDNEW
« no previous file with comments | « ash/frame/caption_buttons/frame_caption_button_container_view.h ('k') | ash/frame/custom_frame_view_ash.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698