OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/frame/browser_header_painter_ash.h" | 5 #include "chrome/browser/ui/views/frame/browser_header_painter_ash.h" |
6 | 6 |
7 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" | 7 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" |
8 #include "ash/frame/header_painter_util.h" | 8 #include "ash/frame/header_painter_util.h" |
9 #include "base/logging.h" // DCHECK | 9 #include "base/logging.h" // DCHECK |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 } | 225 } |
226 } | 226 } |
227 | 227 |
228 void BrowserHeaderPainterAsh::LayoutHeader() { | 228 void BrowserHeaderPainterAsh::LayoutHeader() { |
229 // Purposefully set |painted_height_| to an invalid value. We cannot use | 229 // Purposefully set |painted_height_| to an invalid value. We cannot use |
230 // |painted_height_| because the computation of |painted_height_| may depend | 230 // |painted_height_| because the computation of |painted_height_| may depend |
231 // on having laid out the window controls. | 231 // on having laid out the window controls. |
232 painted_height_ = -1; | 232 painted_height_ = -1; |
233 | 233 |
234 UpdateCaptionButtonImages(); | 234 UpdateCaptionButtonImages(); |
| 235 caption_button_container_->Layout(); |
235 | 236 |
236 gfx::Size caption_button_container_size = | 237 gfx::Size caption_button_container_size = |
237 caption_button_container_->GetPreferredSize(); | 238 caption_button_container_->GetPreferredSize(); |
238 caption_button_container_->SetBounds( | 239 caption_button_container_->SetBounds( |
239 view_->width() - caption_button_container_size.width(), | 240 view_->width() - caption_button_container_size.width(), |
240 0, | 241 0, |
241 caption_button_container_size.width(), | 242 caption_button_container_size.width(), |
242 caption_button_container_size.height()); | 243 caption_button_container_size.height()); |
243 caption_button_container_->Layout(); | |
244 | 244 |
245 if (window_icon_) { | 245 if (window_icon_) { |
246 // Vertically center the window icon with respect to the caption button | 246 // Vertically center the window icon with respect to the caption button |
247 // container. | 247 // container. |
248 int icon_size = ash::HeaderPainterUtil::GetDefaultIconSize(); | 248 int icon_size = ash::HeaderPainterUtil::GetDefaultIconSize(); |
249 int icon_offset_y = (caption_button_container_->height() - icon_size) / 2; | 249 int icon_offset_y = (caption_button_container_->height() - icon_size) / 2; |
250 window_icon_->SetBounds(ash::HeaderPainterUtil::GetIconXOffset(), | 250 window_icon_->SetBounds(ash::HeaderPainterUtil::GetIconXOffset(), |
251 icon_offset_y, icon_size, icon_size); | 251 icon_offset_y, icon_size, icon_size); |
252 } | 252 } |
253 } | 253 } |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 } | 428 } |
429 | 429 |
430 gfx::Rect BrowserHeaderPainterAsh::GetPaintedBounds() const { | 430 gfx::Rect BrowserHeaderPainterAsh::GetPaintedBounds() const { |
431 return gfx::Rect(view_->width(), painted_height_); | 431 return gfx::Rect(view_->width(), painted_height_); |
432 } | 432 } |
433 | 433 |
434 gfx::Rect BrowserHeaderPainterAsh::GetTitleBounds() const { | 434 gfx::Rect BrowserHeaderPainterAsh::GetTitleBounds() const { |
435 return ash::HeaderPainterUtil::GetTitleBounds(window_icon_, | 435 return ash::HeaderPainterUtil::GetTitleBounds(window_icon_, |
436 caption_button_container_, BrowserFrame::GetTitleFontList()); | 436 caption_button_container_, BrowserFrame::GetTitleFontList()); |
437 } | 437 } |
OLD | NEW |