| 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/frame/caption_buttons/frame_caption_button_container_view.h
" |
| 8 #include "ash/common/frame/default_header_painter.h" |
| 9 #include "ash/common/frame/frame_border_hit_test.h" |
| 7 #include "ash/common/material_design/material_design_controller.h" | 10 #include "ash/common/material_design/material_design_controller.h" |
| 8 #include "ash/common/wm_shell.h" | 11 #include "ash/common/wm_shell.h" |
| 9 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" | |
| 10 #include "ash/frame/default_header_painter.h" | |
| 11 #include "ash/frame/frame_border_hit_test_controller.h" | 12 #include "ash/frame/frame_border_hit_test_controller.h" |
| 12 #include "ui/aura/client/aura_constants.h" | 13 #include "ui/aura/client/aura_constants.h" |
| 13 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
| 14 #include "ui/base/hit_test.h" | 15 #include "ui/base/hit_test.h" |
| 15 #include "ui/gfx/canvas.h" | 16 #include "ui/gfx/canvas.h" |
| 16 #include "ui/views/controls/image_view.h" | 17 #include "ui/views/controls/image_view.h" |
| 17 #include "ui/views/widget/widget.h" | 18 #include "ui/views/widget/widget.h" |
| 18 #include "ui/views/widget/widget_delegate.h" | 19 #include "ui/views/widget/widget_delegate.h" |
| 19 | 20 |
| 20 namespace ash { | 21 namespace ash { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 gfx::Rect PanelFrameView::GetWindowBoundsForClientBounds( | 120 gfx::Rect PanelFrameView::GetWindowBoundsForClientBounds( |
| 120 const gfx::Rect& client_bounds) const { | 121 const gfx::Rect& client_bounds) const { |
| 121 gfx::Rect window_bounds = client_bounds; | 122 gfx::Rect window_bounds = client_bounds; |
| 122 window_bounds.Inset(0, -NonClientTopBorderHeight(), 0, 0); | 123 window_bounds.Inset(0, -NonClientTopBorderHeight(), 0, 0); |
| 123 return window_bounds; | 124 return window_bounds; |
| 124 } | 125 } |
| 125 | 126 |
| 126 int PanelFrameView::NonClientHitTest(const gfx::Point& point) { | 127 int PanelFrameView::NonClientHitTest(const gfx::Point& point) { |
| 127 if (!header_painter_) | 128 if (!header_painter_) |
| 128 return HTNOWHERE; | 129 return HTNOWHERE; |
| 129 return FrameBorderHitTestController::NonClientHitTest( | 130 return FrameBorderNonClientHitTest(this, caption_button_container_, point); |
| 130 this, caption_button_container_, point); | |
| 131 } | 131 } |
| 132 | 132 |
| 133 void PanelFrameView::OnPaint(gfx::Canvas* canvas) { | 133 void PanelFrameView::OnPaint(gfx::Canvas* canvas) { |
| 134 if (!header_painter_) | 134 if (!header_painter_) |
| 135 return; | 135 return; |
| 136 bool paint_as_active = ShouldPaintAsActive(); | 136 bool paint_as_active = ShouldPaintAsActive(); |
| 137 caption_button_container_->SetPaintAsActive(paint_as_active); | 137 caption_button_container_->SetPaintAsActive(paint_as_active); |
| 138 | 138 |
| 139 HeaderPainter::Mode header_mode = paint_as_active | 139 HeaderPainter::Mode header_mode = paint_as_active |
| 140 ? HeaderPainter::MODE_ACTIVE | 140 ? HeaderPainter::MODE_ACTIVE |
| 141 : HeaderPainter::MODE_INACTIVE; | 141 : HeaderPainter::MODE_INACTIVE; |
| 142 header_painter_->PaintHeader(canvas, header_mode); | 142 header_painter_->PaintHeader(canvas, header_mode); |
| 143 } | 143 } |
| 144 | 144 |
| 145 /////////////////////////////////////////////////////////////////////////////// | 145 /////////////////////////////////////////////////////////////////////////////// |
| 146 // PanelFrameView, ShellObserver overrides: | 146 // PanelFrameView, ShellObserver overrides: |
| 147 | 147 |
| 148 void PanelFrameView::OnOverviewModeStarting() { | 148 void PanelFrameView::OnOverviewModeStarting() { |
| 149 if (ash::MaterialDesignController::IsOverviewMaterial()) | 149 if (ash::MaterialDesignController::IsOverviewMaterial()) |
| 150 caption_button_container_->SetVisible(false); | 150 caption_button_container_->SetVisible(false); |
| 151 } | 151 } |
| 152 | 152 |
| 153 void PanelFrameView::OnOverviewModeEnded() { | 153 void PanelFrameView::OnOverviewModeEnded() { |
| 154 if (ash::MaterialDesignController::IsOverviewMaterial()) | 154 if (ash::MaterialDesignController::IsOverviewMaterial()) |
| 155 caption_button_container_->SetVisible(true); | 155 caption_button_container_->SetVisible(true); |
| 156 } | 156 } |
| 157 | 157 |
| 158 } // namespace ash | 158 } // namespace ash |
| OLD | NEW |