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

Side by Side Diff: ash/common/wm/window_state.cc

Issue 2700523004: Remove docked windows entirely in M59. (Closed)
Patch Set: Rebase Created 3 years, 9 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/common/wm/window_state.h" 5 #include "ash/common/wm/window_state.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/common/wm/default_state.h" 9 #include "ash/common/wm/default_state.h"
10 #include "ash/common/wm/window_positioning_utils.h" 10 #include "ash/common/wm/window_positioning_utils.h"
(...skipping 16 matching lines...) Expand all
27 return WM_EVENT_NORMAL; 27 return WM_EVENT_NORMAL;
28 case ui::SHOW_STATE_MINIMIZED: 28 case ui::SHOW_STATE_MINIMIZED:
29 return WM_EVENT_MINIMIZE; 29 return WM_EVENT_MINIMIZE;
30 case ui::SHOW_STATE_MAXIMIZED: 30 case ui::SHOW_STATE_MAXIMIZED:
31 return WM_EVENT_MAXIMIZE; 31 return WM_EVENT_MAXIMIZE;
32 case ui::SHOW_STATE_FULLSCREEN: 32 case ui::SHOW_STATE_FULLSCREEN:
33 return WM_EVENT_FULLSCREEN; 33 return WM_EVENT_FULLSCREEN;
34 case ui::SHOW_STATE_INACTIVE: 34 case ui::SHOW_STATE_INACTIVE:
35 return WM_EVENT_SHOW_INACTIVE; 35 return WM_EVENT_SHOW_INACTIVE;
36 36
37 // TODO(afakhry): Remove Docked Windows in M58.
38 case ui::SHOW_STATE_DOCKED:
39 return WM_EVENT_DOCK;
40 case ui::SHOW_STATE_END: 37 case ui::SHOW_STATE_END:
41 NOTREACHED() << "No WMEvent defined for the show state:" 38 NOTREACHED() << "No WMEvent defined for the show state:"
42 << requested_show_state; 39 << requested_show_state;
43 } 40 }
44 return WM_EVENT_NORMAL; 41 return WM_EVENT_NORMAL;
45 } 42 }
46 43
47 } // namespace 44 } // namespace
48 45
49 WindowState::~WindowState() {} 46 WindowState::~WindowState() {}
50 47
51 bool WindowState::HasDelegate() const { 48 bool WindowState::HasDelegate() const {
52 return !!delegate_; 49 return !!delegate_;
53 } 50 }
54 51
55 void WindowState::SetDelegate(std::unique_ptr<WindowStateDelegate> delegate) { 52 void WindowState::SetDelegate(std::unique_ptr<WindowStateDelegate> delegate) {
56 DCHECK(!delegate_.get()); 53 DCHECK(!delegate_.get());
57 delegate_ = std::move(delegate); 54 delegate_ = std::move(delegate);
58 } 55 }
59 56
60 WindowStateType WindowState::GetStateType() const { 57 WindowStateType WindowState::GetStateType() const {
61 return current_state_->GetType(); 58 return current_state_->GetType();
62 } 59 }
63 60
64 bool WindowState::IsMinimized() const { 61 bool WindowState::IsMinimized() const {
65 return GetStateType() == WINDOW_STATE_TYPE_MINIMIZED || 62 return GetStateType() == WINDOW_STATE_TYPE_MINIMIZED;
66 GetStateType() == WINDOW_STATE_TYPE_DOCKED_MINIMIZED;
67 } 63 }
68 64
69 bool WindowState::IsMaximized() const { 65 bool WindowState::IsMaximized() const {
70 return GetStateType() == WINDOW_STATE_TYPE_MAXIMIZED; 66 return GetStateType() == WINDOW_STATE_TYPE_MAXIMIZED;
71 } 67 }
72 68
73 bool WindowState::IsFullscreen() const { 69 bool WindowState::IsFullscreen() const {
74 return GetStateType() == WINDOW_STATE_TYPE_FULLSCREEN; 70 return GetStateType() == WINDOW_STATE_TYPE_FULLSCREEN;
75 } 71 }
76 72
(...skipping 22 matching lines...) Expand all
99 } 95 }
100 96
101 bool WindowState::IsNormalOrSnapped() const { 97 bool WindowState::IsNormalOrSnapped() const {
102 return IsNormalStateType() || IsSnapped(); 98 return IsNormalStateType() || IsSnapped();
103 } 99 }
104 100
105 bool WindowState::IsActive() const { 101 bool WindowState::IsActive() const {
106 return window_->IsActive(); 102 return window_->IsActive();
107 } 103 }
108 104
109 bool WindowState::IsDocked() const {
110 return GetStateType() == WINDOW_STATE_TYPE_DOCKED ||
111 GetStateType() == WINDOW_STATE_TYPE_DOCKED_MINIMIZED;
112 }
113
114 bool WindowState::IsUserPositionable() const { 105 bool WindowState::IsUserPositionable() const {
115 return (window_->GetType() == ui::wm::WINDOW_TYPE_NORMAL || 106 return (window_->GetType() == ui::wm::WINDOW_TYPE_NORMAL ||
116 window_->GetType() == ui::wm::WINDOW_TYPE_PANEL); 107 window_->GetType() == ui::wm::WINDOW_TYPE_PANEL);
117 } 108 }
118 109
119 bool WindowState::CanMaximize() const { 110 bool WindowState::CanMaximize() const {
120 // Window must allow maximization and have no maximum width or height. 111 // Window must allow maximization and have no maximum width or height.
121 if (!window_->CanMaximize()) 112 if (!window_->CanMaximize())
122 return false; 113 return false;
123 114
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 if (!window_->GetTargetVisibility()) { 383 if (!window_->GetTargetVisibility()) {
393 SetBoundsConstrained(new_bounds); 384 SetBoundsConstrained(new_bounds);
394 return; 385 return;
395 } 386 }
396 387
397 window_->SetBoundsDirectCrossFade(new_bounds); 388 window_->SetBoundsDirectCrossFade(new_bounds);
398 } 389 }
399 390
400 } // namespace wm 391 } // namespace wm
401 } // namespace ash 392 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698