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/common/material_design/material_design_controller.h" |
| 8 #include "ash/common/wm_shell.h" |
7 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" | 9 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" |
8 #include "ash/frame/default_header_painter.h" | 10 #include "ash/frame/default_header_painter.h" |
9 #include "ash/frame/frame_border_hit_test_controller.h" | 11 #include "ash/frame/frame_border_hit_test_controller.h" |
10 #include "ui/aura/client/aura_constants.h" | 12 #include "ui/aura/client/aura_constants.h" |
11 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
12 #include "ui/base/hit_test.h" | 14 #include "ui/base/hit_test.h" |
13 #include "ui/gfx/canvas.h" | 15 #include "ui/gfx/canvas.h" |
14 #include "ui/views/controls/image_view.h" | 16 #include "ui/views/controls/image_view.h" |
15 #include "ui/views/widget/widget.h" | 17 #include "ui/views/widget/widget.h" |
16 #include "ui/views/widget/widget_delegate.h" | 18 #include "ui/views/widget/widget_delegate.h" |
17 | 19 |
18 namespace ash { | 20 namespace ash { |
19 | 21 |
20 // static | 22 // static |
21 const char PanelFrameView::kViewClassName[] = "PanelFrameView"; | 23 const char PanelFrameView::kViewClassName[] = "PanelFrameView"; |
22 | 24 |
23 PanelFrameView::PanelFrameView(views::Widget* frame, FrameType frame_type) | 25 PanelFrameView::PanelFrameView(views::Widget* frame, FrameType frame_type) |
24 : frame_(frame), | 26 : frame_(frame), |
25 caption_button_container_(NULL), | 27 caption_button_container_(NULL), |
26 window_icon_(NULL), | 28 window_icon_(NULL), |
27 frame_border_hit_test_controller_( | 29 frame_border_hit_test_controller_( |
28 new FrameBorderHitTestController(frame_)) { | 30 new FrameBorderHitTestController(frame_)) { |
29 DCHECK(!frame_->widget_delegate()->CanMaximize()); | 31 DCHECK(!frame_->widget_delegate()->CanMaximize()); |
30 if (frame_type != FRAME_NONE) | 32 if (frame_type != FRAME_NONE) |
31 InitHeaderPainter(); | 33 InitHeaderPainter(); |
| 34 ash::WmShell::Get()->AddShellObserver(this); |
32 } | 35 } |
33 | 36 |
34 PanelFrameView::~PanelFrameView() {} | 37 PanelFrameView::~PanelFrameView() { |
| 38 ash::WmShell::Get()->RemoveShellObserver(this); |
| 39 } |
35 | 40 |
36 void PanelFrameView::SetFrameColors(SkColor active_frame_color, | 41 void PanelFrameView::SetFrameColors(SkColor active_frame_color, |
37 SkColor inactive_frame_color) { | 42 SkColor inactive_frame_color) { |
38 header_painter_->SetFrameColors(active_frame_color, inactive_frame_color); | 43 header_painter_->SetFrameColors(active_frame_color, inactive_frame_color); |
39 } | 44 } |
40 | 45 |
41 const char* PanelFrameView::GetClassName() const { | 46 const char* PanelFrameView::GetClassName() const { |
42 return kViewClassName; | 47 return kViewClassName; |
43 } | 48 } |
44 | 49 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 return client_bounds; | 135 return client_bounds; |
131 } | 136 } |
132 | 137 |
133 gfx::Rect PanelFrameView::GetWindowBoundsForClientBounds( | 138 gfx::Rect PanelFrameView::GetWindowBoundsForClientBounds( |
134 const gfx::Rect& client_bounds) const { | 139 const gfx::Rect& client_bounds) const { |
135 gfx::Rect window_bounds = client_bounds; | 140 gfx::Rect window_bounds = client_bounds; |
136 window_bounds.Inset(0, -NonClientTopBorderHeight(), 0, 0); | 141 window_bounds.Inset(0, -NonClientTopBorderHeight(), 0, 0); |
137 return window_bounds; | 142 return window_bounds; |
138 } | 143 } |
139 | 144 |
| 145 /////////////////////////////////////////////////////////////////////////////// |
| 146 // ShellObserver: |
| 147 |
| 148 void PanelFrameView::OnOverviewModeStarting() { |
| 149 if (ash::MaterialDesignController::IsOverviewMaterial()) |
| 150 SetVisible(false); |
| 151 } |
| 152 |
| 153 void PanelFrameView::OnOverviewModeEnded() { |
| 154 if (ash::MaterialDesignController::IsOverviewMaterial()) |
| 155 SetVisible(true); |
| 156 } |
| 157 |
140 } // namespace ash | 158 } // namespace ash |
OLD | NEW |