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 | |
205 gfx::Size caption_button_container_size = | 203 gfx::Size caption_button_container_size = |
206 caption_button_container_->GetPreferredSize(); | 204 caption_button_container_->GetPreferredSize(); |
207 caption_button_container_->SetBounds( | 205 caption_button_container_->SetBounds( |
208 view_->width() - caption_button_container_size.width(), | 206 view_->width() - caption_button_container_size.width(), |
209 0, | 207 0, |
210 caption_button_container_size.width(), | 208 caption_button_container_size.width(), |
211 caption_button_container_size.height()); | 209 caption_button_container_size.height()); |
212 | 210 caption_button_container_->Layout(); |
213 if (window_icon_) { | 211 if (window_icon_) { |
214 // Vertically center the window icon with respect to the caption button | 212 // Vertically center the window icon with respect to the caption button |
215 // container. | 213 // container. |
216 // Floor when computing the center of |caption_button_container_|. | 214 // Floor when computing the center of |caption_button_container_|. |
217 int icon_offset_y = | 215 int icon_offset_y = |
218 caption_button_container_->height() / 2 - window_icon_size_ / 2; | 216 caption_button_container_->height() / 2 - window_icon_size_ / 2; |
219 window_icon_->SetBounds(HeaderPainterUtil::GetIconXOffset(), icon_offset_y, | 217 window_icon_->SetBounds(HeaderPainterUtil::GetIconXOffset(), icon_offset_y, |
220 window_icon_size_, window_icon_size_); | 218 window_icon_size_, window_icon_size_); |
221 } | 219 } |
222 | 220 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 | 327 |
330 gfx::ImageSkia* DefaultHeaderPainter::GetInactiveFrameImage() const { | 328 gfx::ImageSkia* DefaultHeaderPainter::GetInactiveFrameImage() const { |
331 int frame_image_id = (frame_->IsMaximized() || frame_->IsFullscreen()) ? | 329 int frame_image_id = (frame_->IsMaximized() || frame_->IsFullscreen()) ? |
332 IDR_AURA_WINDOW_HEADER_BASE : | 330 IDR_AURA_WINDOW_HEADER_BASE : |
333 IDR_AURA_WINDOW_HEADER_BASE_RESTORED_INACTIVE; | 331 IDR_AURA_WINDOW_HEADER_BASE_RESTORED_INACTIVE; |
334 return ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 332 return ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
335 frame_image_id); | 333 frame_image_id); |
336 } | 334 } |
337 | 335 |
338 } // namespace ash | 336 } // namespace ash |
OLD | NEW |