| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/wm/panels/panel_frame_view.h" | 5 #include "ash/wm/panels/panel_frame_view.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/default_header_painter.h" | 8 #include "ash/frame/default_header_painter.h" |
| 9 #include "ash/frame/frame_border_hit_test_controller.h" | 9 #include "ash/frame/frame_border_hit_test_controller.h" |
| 10 #include "ash/frame/header_painter_util.h" |
| 10 #include "grit/ash_resources.h" | 11 #include "grit/ash_resources.h" |
| 11 #include "ui/base/hit_test.h" | 12 #include "ui/base/hit_test.h" |
| 12 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
| 13 #include "ui/gfx/canvas.h" | 14 #include "ui/gfx/canvas.h" |
| 14 #include "ui/views/controls/image_view.h" | 15 #include "ui/views/controls/image_view.h" |
| 15 #include "ui/views/widget/widget.h" | 16 #include "ui/views/widget/widget.h" |
| 16 #include "ui/views/widget/widget_delegate.h" | 17 #include "ui/views/widget/widget_delegate.h" |
| 17 | 18 |
| 18 namespace ash { | 19 namespace ash { |
| 19 | 20 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 38 return kViewClassName; | 39 return kViewClassName; |
| 39 } | 40 } |
| 40 | 41 |
| 41 void PanelFrameView::InitHeaderPainter() { | 42 void PanelFrameView::InitHeaderPainter() { |
| 42 header_painter_.reset(new DefaultHeaderPainter); | 43 header_painter_.reset(new DefaultHeaderPainter); |
| 43 | 44 |
| 44 caption_button_container_ = new FrameCaptionButtonContainerView(frame_, | 45 caption_button_container_ = new FrameCaptionButtonContainerView(frame_, |
| 45 FrameCaptionButtonContainerView::MINIMIZE_ALLOWED); | 46 FrameCaptionButtonContainerView::MINIMIZE_ALLOWED); |
| 46 AddChildView(caption_button_container_); | 47 AddChildView(caption_button_container_); |
| 47 | 48 |
| 49 header_painter_->Init(frame_, this, caption_button_container_); |
| 50 |
| 48 if (frame_->widget_delegate()->ShouldShowWindowIcon()) { | 51 if (frame_->widget_delegate()->ShouldShowWindowIcon()) { |
| 49 window_icon_ = new views::ImageView(); | 52 window_icon_ = new views::ImageView(); |
| 50 AddChildView(window_icon_); | 53 AddChildView(window_icon_); |
| 54 header_painter_->UpdateLeftHeaderView(window_icon_); |
| 51 } | 55 } |
| 52 | |
| 53 header_painter_->Init(frame_, this, window_icon_, caption_button_container_); | |
| 54 } | 56 } |
| 55 | 57 |
| 56 int PanelFrameView::NonClientTopBorderHeight() const { | 58 int PanelFrameView::NonClientTopBorderHeight() const { |
| 57 if (!header_painter_) | 59 if (!header_painter_) |
| 58 return 0; | 60 return 0; |
| 59 return header_painter_->GetHeaderHeightForPainting(); | 61 return header_painter_->GetHeaderHeightForPainting(); |
| 60 } | 62 } |
| 61 | 63 |
| 62 gfx::Size PanelFrameView::GetMinimumSize() const { | 64 gfx::Size PanelFrameView::GetMinimumSize() const { |
| 63 if (!header_painter_) | 65 if (!header_painter_) |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 } | 125 } |
| 124 | 126 |
| 125 gfx::Rect PanelFrameView::GetWindowBoundsForClientBounds( | 127 gfx::Rect PanelFrameView::GetWindowBoundsForClientBounds( |
| 126 const gfx::Rect& client_bounds) const { | 128 const gfx::Rect& client_bounds) const { |
| 127 gfx::Rect window_bounds = client_bounds; | 129 gfx::Rect window_bounds = client_bounds; |
| 128 window_bounds.Inset(0, -NonClientTopBorderHeight(), 0, 0); | 130 window_bounds.Inset(0, -NonClientTopBorderHeight(), 0, 0); |
| 129 return window_bounds; | 131 return window_bounds; |
| 130 } | 132 } |
| 131 | 133 |
| 132 } // namespace ash | 134 } // namespace ash |
| OLD | NEW |