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 // Reserve enough space to see the buttons and the separator line. | |
flackr
2013/09/30 20:20:26
Perhaps DCHECK(frame_painter_) or have an early ex
pkotwicz
2013/10/01 15:55:04
Thanks for pointing this out!
| |
62 return caption_button_container_->bounds().bottom() + | |
63 frame_painter_->HeaderContentSeparatorSize(); | |
64 } | |
65 | |
66 | |
60 gfx::Size PanelFrameView::GetMinimumSize() { | 67 gfx::Size PanelFrameView::GetMinimumSize() { |
61 if (!frame_painter_) | 68 if (!frame_painter_) |
62 return gfx::Size(); | 69 return gfx::Size(); |
63 return frame_painter_->GetMinimumSize(this); | 70 return frame_painter_->GetMinimumSize(this); |
64 } | 71 } |
65 | 72 |
66 void PanelFrameView::Layout() { | 73 void PanelFrameView::Layout() { |
67 if (!frame_painter_) | 74 if (!frame_painter_) |
68 return; | 75 return; |
69 frame_painter_->LayoutHeader(this, true); | 76 frame_painter_->LayoutHeader(this, true); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 theme_frame_id, | 124 theme_frame_id, |
118 0); | 125 0); |
119 frame_painter_->PaintTitleBar(this, canvas, title_font_); | 126 frame_painter_->PaintTitleBar(this, canvas, title_font_); |
120 frame_painter_->PaintHeaderContentSeparator(this, canvas); | 127 frame_painter_->PaintHeaderContentSeparator(this, canvas); |
121 } | 128 } |
122 | 129 |
123 gfx::Rect PanelFrameView::GetBoundsForClientView() const { | 130 gfx::Rect PanelFrameView::GetBoundsForClientView() const { |
124 if (!frame_painter_) | 131 if (!frame_painter_) |
125 return bounds(); | 132 return bounds(); |
126 return frame_painter_->GetBoundsForClientView( | 133 return frame_painter_->GetBoundsForClientView( |
127 caption_button_container_->bounds().bottom(), | 134 NonClientTopBorderHeight(), |
128 bounds()); | 135 bounds()); |
flackr
2013/09/30 20:20:26
nit: don't wrap.
| |
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 |