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 "ash/frame/default_header_painter.h" | 5 #include "ash/frame/default_header_painter.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/debug/leak_annotations.h" | 9 #include "base/debug/leak_annotations.h" |
10 #include "base/logging.h" // DCHECK | 10 #include "base/logging.h" // DCHECK |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 PaintHighlightForInactiveRestoredWindow(canvas); | 193 PaintHighlightForInactiveRestoredWindow(canvas); |
194 } | 194 } |
195 if (frame_->widget_delegate() && | 195 if (frame_->widget_delegate() && |
196 frame_->widget_delegate()->ShouldShowWindowTitle()) { | 196 frame_->widget_delegate()->ShouldShowWindowTitle()) { |
197 PaintTitleBar(canvas); | 197 PaintTitleBar(canvas); |
198 } | 198 } |
199 PaintHeaderContentSeparator(canvas); | 199 PaintHeaderContentSeparator(canvas); |
200 } | 200 } |
201 | 201 |
202 void DefaultHeaderPainter::LayoutHeader() { | 202 void DefaultHeaderPainter::LayoutHeader() { |
| 203 caption_button_container_->Layout(); |
| 204 |
203 gfx::Size caption_button_container_size = | 205 gfx::Size caption_button_container_size = |
204 caption_button_container_->GetPreferredSize(); | 206 caption_button_container_->GetPreferredSize(); |
205 caption_button_container_->SetBounds( | 207 caption_button_container_->SetBounds( |
206 view_->width() - caption_button_container_size.width(), | 208 view_->width() - caption_button_container_size.width(), |
207 0, | 209 0, |
208 caption_button_container_size.width(), | 210 caption_button_container_size.width(), |
209 caption_button_container_size.height()); | 211 caption_button_container_size.height()); |
210 caption_button_container_->Layout(); | 212 |
211 if (window_icon_) { | 213 if (window_icon_) { |
212 // Vertically center the window icon with respect to the caption button | 214 // Vertically center the window icon with respect to the caption button |
213 // container. | 215 // container. |
214 // Floor when computing the center of |caption_button_container_|. | 216 // Floor when computing the center of |caption_button_container_|. |
215 int icon_offset_y = | 217 int icon_offset_y = |
216 caption_button_container_->height() / 2 - window_icon_size_ / 2; | 218 caption_button_container_->height() / 2 - window_icon_size_ / 2; |
217 window_icon_->SetBounds(HeaderPainterUtil::GetIconXOffset(), icon_offset_y, | 219 window_icon_->SetBounds(HeaderPainterUtil::GetIconXOffset(), icon_offset_y, |
218 window_icon_size_, window_icon_size_); | 220 window_icon_size_, window_icon_size_); |
219 } | 221 } |
220 | 222 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 | 329 |
328 gfx::ImageSkia* DefaultHeaderPainter::GetInactiveFrameImage() const { | 330 gfx::ImageSkia* DefaultHeaderPainter::GetInactiveFrameImage() const { |
329 int frame_image_id = (frame_->IsMaximized() || frame_->IsFullscreen()) ? | 331 int frame_image_id = (frame_->IsMaximized() || frame_->IsFullscreen()) ? |
330 IDR_AURA_WINDOW_HEADER_BASE : | 332 IDR_AURA_WINDOW_HEADER_BASE : |
331 IDR_AURA_WINDOW_HEADER_BASE_RESTORED_INACTIVE; | 333 IDR_AURA_WINDOW_HEADER_BASE_RESTORED_INACTIVE; |
332 return ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 334 return ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
333 frame_image_id); | 335 frame_image_id); |
334 } | 336 } |
335 | 337 |
336 } // namespace ash | 338 } // namespace ash |
OLD | NEW |