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/wm/caption_buttons/frame_caption_button_container_view.h" | 7 #include "ash/wm/caption_buttons/frame_caption_button_container_view.h" |
8 #include "ash/wm/frame_painter.h" | 8 #include "ash/wm/frame_painter.h" |
9 #include "grit/ash_resources.h" | 9 #include "grit/ash_resources.h" |
10 #include "third_party/skia/include/core/SkPaint.h" | 10 #include "third_party/skia/include/core/SkPaint.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 AddChildView(caption_button_container_); | 50 AddChildView(caption_button_container_); |
51 | 51 |
52 if (frame_->widget_delegate()->ShouldShowWindowIcon()) { | 52 if (frame_->widget_delegate()->ShouldShowWindowIcon()) { |
53 window_icon_ = new views::ImageView(); | 53 window_icon_ = new views::ImageView(); |
54 AddChildView(window_icon_); | 54 AddChildView(window_icon_); |
55 } | 55 } |
56 | 56 |
57 frame_painter_->Init(frame_, window_icon_, caption_button_container_); | 57 frame_painter_->Init(frame_, window_icon_, caption_button_container_); |
58 } | 58 } |
59 | 59 |
| 60 int PanelFrameView::NonClientTopBorderHeight() const { |
| 61 if (!frame_painter_) |
| 62 return 0; |
| 63 // Reserve enough space to see the buttons and the separator line. |
| 64 return caption_button_container_->bounds().bottom() + |
| 65 frame_painter_->HeaderContentSeparatorSize(); |
| 66 } |
| 67 |
60 gfx::Size PanelFrameView::GetMinimumSize() { | 68 gfx::Size PanelFrameView::GetMinimumSize() { |
61 if (!frame_painter_) | 69 if (!frame_painter_) |
62 return gfx::Size(); | 70 return gfx::Size(); |
63 return frame_painter_->GetMinimumSize(this); | 71 return frame_painter_->GetMinimumSize(this); |
64 } | 72 } |
65 | 73 |
66 void PanelFrameView::Layout() { | 74 void PanelFrameView::Layout() { |
67 if (!frame_painter_) | 75 if (!frame_painter_) |
68 return; | 76 return; |
69 frame_painter_->LayoutHeader(this, true); | 77 frame_painter_->LayoutHeader(this, true); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 theme_frame_id, | 125 theme_frame_id, |
118 0); | 126 0); |
119 frame_painter_->PaintTitleBar(this, canvas, title_font_); | 127 frame_painter_->PaintTitleBar(this, canvas, title_font_); |
120 frame_painter_->PaintHeaderContentSeparator(this, canvas); | 128 frame_painter_->PaintHeaderContentSeparator(this, canvas); |
121 } | 129 } |
122 | 130 |
123 gfx::Rect PanelFrameView::GetBoundsForClientView() const { | 131 gfx::Rect PanelFrameView::GetBoundsForClientView() const { |
124 if (!frame_painter_) | 132 if (!frame_painter_) |
125 return bounds(); | 133 return bounds(); |
126 return frame_painter_->GetBoundsForClientView( | 134 return frame_painter_->GetBoundsForClientView( |
127 caption_button_container_->bounds().bottom(), | 135 NonClientTopBorderHeight(), bounds()); |
128 bounds()); | |
129 } | 136 } |
130 | 137 |
131 gfx::Rect PanelFrameView::GetWindowBoundsForClientBounds( | 138 gfx::Rect PanelFrameView::GetWindowBoundsForClientBounds( |
132 const gfx::Rect& client_bounds) const { | 139 const gfx::Rect& client_bounds) const { |
133 if (!frame_painter_) | 140 if (!frame_painter_) |
134 return client_bounds; | 141 return client_bounds; |
135 return frame_painter_->GetWindowBoundsForClientBounds( | 142 return frame_painter_->GetWindowBoundsForClientBounds( |
136 caption_button_container_->bounds().bottom(), client_bounds); | 143 NonClientTopBorderHeight(), client_bounds); |
137 } | 144 } |
138 | 145 |
139 } // namespace ash | 146 } // namespace ash |
OLD | NEW |