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

Side by Side Diff: ash/frame/caption_buttons/frame_caption_button_container_view.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 "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 8
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/frame/caption_buttons/frame_caption_button.h" 10 #include "ash/frame/caption_buttons/frame_caption_button.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // TODO(flackr): Refactor the Maximize Mode notifications. Currently 124 // TODO(flackr): Refactor the Maximize Mode notifications. Currently
125 // UpdateSizeButtonVisibilty requires a force_hidden parameter. This is 125 // UpdateSizeButtonVisibilty requires a force_hidden parameter. This is
126 // because Shell::IsMaximizeWindowManagerEnabled is still false at the 126 // because Shell::IsMaximizeWindowManagerEnabled is still false at the
127 // time when ShellObserver::OnMaximizeModeStarted is called. This prevents 127 // time when ShellObserver::OnMaximizeModeStarted is called. This prevents
128 // this method from performing that check, and instead relies on the calling 128 // this method from performing that check, and instead relies on the calling
129 // code to tell it to force being hidden. 129 // code to tell it to force being hidden.
130 size_button_->SetVisible( 130 size_button_->SetVisible(
131 !force_hidden && frame_->widget_delegate()->CanMaximize()); 131 !force_hidden && frame_->widget_delegate()->CanMaximize());
132 } 132 }
133 133
134 gfx::Size FrameCaptionButtonContainerView::GetPreferredSize() { 134 gfx::Size FrameCaptionButtonContainerView::GetPreferredSize() const {
135 int width = 0; 135 int width = 0;
136 for (int i = 0; i < child_count(); ++i) { 136 for (int i = 0; i < child_count(); ++i) {
137 views::View* child = child_at(i); 137 const views::View* child = child_at(i);
138 if (child->visible()) 138 if (child->visible())
139 width += child_at(i)->GetPreferredSize().width(); 139 width += child_at(i)->GetPreferredSize().width();
140 } 140 }
141 return gfx::Size(width, close_button_->GetPreferredSize().height()); 141 return gfx::Size(width, close_button_->GetPreferredSize().height());
142 } 142 }
143 143
144 void FrameCaptionButtonContainerView::Layout() { 144 void FrameCaptionButtonContainerView::Layout() {
145 int x = 0; 145 int x = 0;
146 for (int i = 0; i < child_count(); ++i) { 146 for (int i = 0; i < child_count(); ++i) {
147 views::View* child = child_at(i); 147 views::View* child = child_at(i);
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 : icon_image_id(icon_id), 304 : icon_image_id(icon_id),
305 inactive_icon_image_id(inactive_icon_id), 305 inactive_icon_image_id(inactive_icon_id),
306 hovered_background_image_id(hovered_background_id), 306 hovered_background_image_id(hovered_background_id),
307 pressed_background_image_id(pressed_background_id) { 307 pressed_background_image_id(pressed_background_id) {
308 } 308 }
309 309
310 FrameCaptionButtonContainerView::ButtonIconIds::~ButtonIconIds() { 310 FrameCaptionButtonContainerView::ButtonIconIds::~ButtonIconIds() {
311 } 311 }
312 312
313 } // namespace ash 313 } // 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