Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(470)

Side by Side Diff: ash/frame/custom_frame_view_ash.cc

Issue 1890713002: Adds WmWindow and converts WindowState to use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge again Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/ash_switches.h" 10 #include "ash/ash_switches.h"
11 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" 11 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h"
12 #include "ash/frame/default_header_painter.h" 12 #include "ash/frame/default_header_painter.h"
13 #include "ash/frame/frame_border_hit_test_controller.h" 13 #include "ash/frame/frame_border_hit_test_controller.h"
14 #include "ash/frame/header_painter.h" 14 #include "ash/frame/header_painter.h"
15 #include "ash/session/session_state_delegate.h" 15 #include "ash/session/session_state_delegate.h"
16 #include "ash/shell.h" 16 #include "ash/shell.h"
17 #include "ash/shell_observer.h" 17 #include "ash/shell_observer.h"
18 #include "ash/wm/immersive_fullscreen_controller.h" 18 #include "ash/wm/immersive_fullscreen_controller.h"
19 #include "ash/wm/window_state.h" 19 #include "ash/wm/window_state.h"
20 #include "ash/wm/window_state_aura.h"
20 #include "ash/wm/window_state_delegate.h" 21 #include "ash/wm/window_state_delegate.h"
21 #include "ash/wm/window_state_observer.h" 22 #include "ash/wm/window_state_observer.h"
22 #include "base/command_line.h" 23 #include "base/command_line.h"
23 #include "ui/aura/client/aura_constants.h" 24 #include "ui/aura/client/aura_constants.h"
24 #include "ui/aura/window.h" 25 #include "ui/aura/window.h"
25 #include "ui/aura/window_observer.h" 26 #include "ui/aura/window_observer.h"
26 #include "ui/gfx/canvas.h" 27 #include "ui/gfx/canvas.h"
27 #include "ui/gfx/geometry/rect.h" 28 #include "ui/gfx/geometry/rect.h"
28 #include "ui/gfx/geometry/rect_conversions.h" 29 #include "ui/gfx/geometry/rect_conversions.h"
29 #include "ui/gfx/geometry/size.h" 30 #include "ui/gfx/geometry/size.h"
(...skipping 26 matching lines...) Expand all
56 custom_frame_view->InitImmersiveFullscreenControllerForView( 57 custom_frame_view->InitImmersiveFullscreenControllerForView(
57 immersive_fullscreen_controller_.get()); 58 immersive_fullscreen_controller_.get());
58 59
59 // Add a window state observer to exit fullscreen properly in case 60 // Add a window state observer to exit fullscreen properly in case
60 // fullscreen is exited without going through 61 // fullscreen is exited without going through
61 // WindowState::ToggleFullscreen(). This is the case when exiting 62 // WindowState::ToggleFullscreen(). This is the case when exiting
62 // immersive fullscreen via the "Restore" window control. 63 // immersive fullscreen via the "Restore" window control.
63 // TODO(pkotwicz): This is a hack. Remove ASAP. http://crbug.com/319048 64 // TODO(pkotwicz): This is a hack. Remove ASAP. http://crbug.com/319048
64 window_state_ = window_state; 65 window_state_ = window_state;
65 window_state_->AddObserver(this); 66 window_state_->AddObserver(this);
66 window_state_->window()->AddObserver(this); 67 window_state_->aura_window()->AddObserver(this);
67 } 68 }
68 ~CustomFrameViewAshWindowStateDelegate() override { 69 ~CustomFrameViewAshWindowStateDelegate() override {
69 if (window_state_) { 70 if (window_state_) {
70 window_state_->RemoveObserver(this); 71 window_state_->RemoveObserver(this);
71 window_state_->window()->RemoveObserver(this); 72 window_state_->aura_window()->RemoveObserver(this);
72 } 73 }
73 } 74 }
74 private: 75 private:
75 // Overridden from ash::wm::WindowStateDelegate: 76 // Overridden from ash::wm::WindowStateDelegate:
76 bool ToggleFullscreen(ash::wm::WindowState* window_state) override { 77 bool ToggleFullscreen(ash::wm::WindowState* window_state) override {
77 bool enter_fullscreen = !window_state->IsFullscreen(); 78 bool enter_fullscreen = !window_state->IsFullscreen();
78 if (enter_fullscreen) { 79 if (enter_fullscreen) {
79 window_state->window()->SetProperty(aura::client::kShowStateKey, 80 window_state->aura_window()->SetProperty(aura::client::kShowStateKey,
80 ui::SHOW_STATE_FULLSCREEN); 81 ui::SHOW_STATE_FULLSCREEN);
81 } else { 82 } else {
82 window_state->Restore(); 83 window_state->Restore();
83 } 84 }
84 if (immersive_fullscreen_controller_) { 85 if (immersive_fullscreen_controller_) {
85 immersive_fullscreen_controller_->SetEnabled( 86 immersive_fullscreen_controller_->SetEnabled(
86 ash::ImmersiveFullscreenController::WINDOW_TYPE_OTHER, 87 ash::ImmersiveFullscreenController::WINDOW_TYPE_OTHER,
87 enter_fullscreen); 88 enter_fullscreen);
88 } 89 }
89 return true; 90 return true;
90 } 91 }
91 // Overridden from aura::WindowObserver: 92 // Overridden from aura::WindowObserver:
92 void OnWindowDestroying(aura::Window* window) override { 93 void OnWindowDestroying(aura::Window* window) override {
93 window_state_->RemoveObserver(this); 94 window_state_->RemoveObserver(this);
94 window_state_->window()->RemoveObserver(this); 95 window_state_->aura_window()->RemoveObserver(this);
95 window_state_ = NULL; 96 window_state_ = NULL;
96 } 97 }
97 // Overridden from ash::wm::WindowStateObserver: 98 // Overridden from ash::wm::WindowStateObserver:
98 void OnPostWindowStateTypeChange(ash::wm::WindowState* window_state, 99 void OnPostWindowStateTypeChange(ash::wm::WindowState* window_state,
99 ash::wm::WindowStateType old_type) override { 100 ash::wm::WindowStateType old_type) override {
100 if (!window_state->IsFullscreen() && 101 if (!window_state->IsFullscreen() &&
101 !window_state->IsMinimized() && 102 !window_state->IsMinimized() &&
102 immersive_fullscreen_controller_.get() && 103 immersive_fullscreen_controller_.get() &&
103 immersive_fullscreen_controller_->IsEnabled()) { 104 immersive_fullscreen_controller_->IsEnabled()) {
104 immersive_fullscreen_controller_->SetEnabled( 105 immersive_fullscreen_controller_->SetEnabled(
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 FrameCaptionButtonContainerView* CustomFrameViewAsh:: 581 FrameCaptionButtonContainerView* CustomFrameViewAsh::
581 GetFrameCaptionButtonContainerViewForTest() { 582 GetFrameCaptionButtonContainerViewForTest() {
582 return header_view_->caption_button_container(); 583 return header_view_->caption_button_container();
583 } 584 }
584 585
585 int CustomFrameViewAsh::NonClientTopBorderHeight() const { 586 int CustomFrameViewAsh::NonClientTopBorderHeight() const {
586 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); 587 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight();
587 } 588 }
588 589
589 } // namespace ash 590 } // namespace ash
OLDNEW
« no previous file with comments | « ash/frame/caption_buttons/frame_size_button_unittest.cc ('k') | ash/metrics/user_metrics_recorder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698