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 | |
James Cook
2013/10/01 16:00:47
nit: one blank line
| |
68 | |
60 gfx::Size PanelFrameView::GetMinimumSize() { | 69 gfx::Size PanelFrameView::GetMinimumSize() { |
61 if (!frame_painter_) | 70 if (!frame_painter_) |
62 return gfx::Size(); | 71 return gfx::Size(); |
63 return frame_painter_->GetMinimumSize(this); | 72 return frame_painter_->GetMinimumSize(this); |
64 } | 73 } |
65 | 74 |
66 void PanelFrameView::Layout() { | 75 void PanelFrameView::Layout() { |
67 if (!frame_painter_) | 76 if (!frame_painter_) |
68 return; | 77 return; |
69 frame_painter_->LayoutHeader(this, true); | 78 frame_painter_->LayoutHeader(this, true); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 theme_frame_id, | 126 theme_frame_id, |
118 0); | 127 0); |
119 frame_painter_->PaintTitleBar(this, canvas, title_font_); | 128 frame_painter_->PaintTitleBar(this, canvas, title_font_); |
120 frame_painter_->PaintHeaderContentSeparator(this, canvas); | 129 frame_painter_->PaintHeaderContentSeparator(this, canvas); |
121 } | 130 } |
122 | 131 |
123 gfx::Rect PanelFrameView::GetBoundsForClientView() const { | 132 gfx::Rect PanelFrameView::GetBoundsForClientView() const { |
124 if (!frame_painter_) | 133 if (!frame_painter_) |
125 return bounds(); | 134 return bounds(); |
126 return frame_painter_->GetBoundsForClientView( | 135 return frame_painter_->GetBoundsForClientView( |
127 caption_button_container_->bounds().bottom(), | 136 NonClientTopBorderHeight(), bounds()); |
128 bounds()); | |
129 } | 137 } |
130 | 138 |
131 gfx::Rect PanelFrameView::GetWindowBoundsForClientBounds( | 139 gfx::Rect PanelFrameView::GetWindowBoundsForClientBounds( |
132 const gfx::Rect& client_bounds) const { | 140 const gfx::Rect& client_bounds) const { |
133 if (!frame_painter_) | 141 if (!frame_painter_) |
134 return client_bounds; | 142 return client_bounds; |
135 return frame_painter_->GetWindowBoundsForClientBounds( | 143 return frame_painter_->GetWindowBoundsForClientBounds( |
136 caption_button_container_->bounds().bottom(), client_bounds); | 144 NonClientTopBorderHeight(), client_bounds); |
137 } | 145 } |
138 | 146 |
139 } // namespace ash | 147 } // namespace ash |
OLD | NEW |