| 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/frame/custom_frame_view_ash.h" | 5 #include "ash/frame/custom_frame_view_ash.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/aura/wm_window_aura.h" | 10 #include "ash/aura/wm_window_aura.h" |
| 11 #include "ash/common/ash_switches.h" | 11 #include "ash/common/ash_switches.h" |
| 12 #include "ash/common/material_design/material_design_controller.h" |
| 12 #include "ash/common/session/session_state_delegate.h" | 13 #include "ash/common/session/session_state_delegate.h" |
| 13 #include "ash/common/shell_observer.h" | 14 #include "ash/common/shell_observer.h" |
| 14 #include "ash/common/wm/window_state.h" | 15 #include "ash/common/wm/window_state.h" |
| 15 #include "ash/common/wm/window_state_delegate.h" | 16 #include "ash/common/wm/window_state_delegate.h" |
| 16 #include "ash/common/wm/window_state_observer.h" | 17 #include "ash/common/wm/window_state_observer.h" |
| 17 #include "ash/common/wm_lookup.h" | 18 #include "ash/common/wm_lookup.h" |
| 18 #include "ash/common/wm_shell.h" | 19 #include "ash/common/wm_shell.h" |
| 19 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" | 20 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" |
| 20 #include "ash/frame/default_header_painter.h" | 21 #include "ash/frame/default_header_painter.h" |
| 21 #include "ash/frame/frame_border_hit_test_controller.h" | 22 #include "ash/frame/frame_border_hit_test_controller.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 void SizeConstraintsChanged(); | 159 void SizeConstraintsChanged(); |
| 159 | 160 |
| 160 void SetFrameColors(SkColor active_frame_color, SkColor inactive_frame_color); | 161 void SetFrameColors(SkColor active_frame_color, SkColor inactive_frame_color); |
| 161 | 162 |
| 162 // views::View: | 163 // views::View: |
| 163 void Layout() override; | 164 void Layout() override; |
| 164 void OnPaint(gfx::Canvas* canvas) override; | 165 void OnPaint(gfx::Canvas* canvas) override; |
| 165 void ChildPreferredSizeChanged(views::View* child) override; | 166 void ChildPreferredSizeChanged(views::View* child) override; |
| 166 | 167 |
| 167 // ShellObserver: | 168 // ShellObserver: |
| 169 void OnOverviewModeStarting() override; |
| 170 void OnOverviewModeEnded() override; |
| 168 void OnMaximizeModeStarted() override; | 171 void OnMaximizeModeStarted() override; |
| 169 void OnMaximizeModeEnded() override; | 172 void OnMaximizeModeEnded() override; |
| 170 | 173 |
| 171 FrameCaptionButtonContainerView* caption_button_container() { | 174 FrameCaptionButtonContainerView* caption_button_container() { |
| 172 return caption_button_container_; | 175 return caption_button_container_; |
| 173 } | 176 } |
| 174 | 177 |
| 175 views::View* avatar_icon() const { return avatar_icon_; } | 178 views::View* avatar_icon() const { return avatar_icon_; } |
| 176 | 179 |
| 177 private: | 180 private: |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 // until the completion of the animation. Layout in response to the preferred | 306 // until the completion of the animation. Layout in response to the preferred |
| 304 // size changes. | 307 // size changes. |
| 305 if (child != caption_button_container_) | 308 if (child != caption_button_container_) |
| 306 return; | 309 return; |
| 307 parent()->Layout(); | 310 parent()->Layout(); |
| 308 } | 311 } |
| 309 | 312 |
| 310 /////////////////////////////////////////////////////////////////////////////// | 313 /////////////////////////////////////////////////////////////////////////////// |
| 311 // CustomFrameViewAsh::HeaderView, ShellObserver overrides: | 314 // CustomFrameViewAsh::HeaderView, ShellObserver overrides: |
| 312 | 315 |
| 316 void CustomFrameViewAsh::HeaderView::OnOverviewModeStarting() { |
| 317 if (ash::MaterialDesignController::IsOverviewMaterial()) |
| 318 caption_button_container_->SetVisible(false); |
| 319 } |
| 320 |
| 321 void CustomFrameViewAsh::HeaderView::OnOverviewModeEnded() { |
| 322 if (ash::MaterialDesignController::IsOverviewMaterial()) |
| 323 caption_button_container_->SetVisible(true); |
| 324 } |
| 325 |
| 313 void CustomFrameViewAsh::HeaderView::OnMaximizeModeStarted() { | 326 void CustomFrameViewAsh::HeaderView::OnMaximizeModeStarted() { |
| 314 caption_button_container_->UpdateSizeButtonVisibility(); | 327 caption_button_container_->UpdateSizeButtonVisibility(); |
| 315 parent()->Layout(); | 328 parent()->Layout(); |
| 316 } | 329 } |
| 317 | 330 |
| 318 void CustomFrameViewAsh::HeaderView::OnMaximizeModeEnded() { | 331 void CustomFrameViewAsh::HeaderView::OnMaximizeModeEnded() { |
| 319 caption_button_container_->UpdateSizeButtonVisibility(); | 332 caption_button_container_->UpdateSizeButtonVisibility(); |
| 320 parent()->Layout(); | 333 parent()->Layout(); |
| 321 } | 334 } |
| 322 | 335 |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 FrameCaptionButtonContainerView* | 602 FrameCaptionButtonContainerView* |
| 590 CustomFrameViewAsh::GetFrameCaptionButtonContainerViewForTest() { | 603 CustomFrameViewAsh::GetFrameCaptionButtonContainerViewForTest() { |
| 591 return header_view_->caption_button_container(); | 604 return header_view_->caption_button_container(); |
| 592 } | 605 } |
| 593 | 606 |
| 594 int CustomFrameViewAsh::NonClientTopBorderHeight() const { | 607 int CustomFrameViewAsh::NonClientTopBorderHeight() const { |
| 595 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); | 608 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); |
| 596 } | 609 } |
| 597 | 610 |
| 598 } // namespace ash | 611 } // namespace ash |
| OLD | NEW |