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

Side by Side Diff: ash/wm/window_state.h

Issue 1867223004: Convert //ash from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments 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
« no previous file with comments | « ash/wm/window_resizer.h ('k') | ash/wm/window_state.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef ASH_WM_WINDOW_STATE_H_ 5 #ifndef ASH_WM_WINDOW_STATE_H_
6 #define ASH_WM_WINDOW_STATE_H_ 6 #define ASH_WM_WINDOW_STATE_H_
7 7
8 #include <memory>
9
8 #include "ash/ash_export.h" 10 #include "ash/ash_export.h"
9 #include "ash/wm/drag_details.h" 11 #include "ash/wm/drag_details.h"
10 #include "ash/wm/wm_types.h" 12 #include "ash/wm/wm_types.h"
11 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
12 #include "base/macros.h" 14 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/observer_list.h" 15 #include "base/observer_list.h"
15 #include "ui/aura/window_observer.h" 16 #include "ui/aura/window_observer.h"
16 #include "ui/base/ui_base_types.h" 17 #include "ui/base/ui_base_types.h"
17 18
18 namespace aura { 19 namespace aura {
19 class Window; 20 class Window;
20 } 21 }
21 22
22 namespace gfx { 23 namespace gfx {
23 class Rect; 24 class Rect;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 DISALLOW_COPY_AND_ASSIGN(State); 79 DISALLOW_COPY_AND_ASSIGN(State);
79 }; 80 };
80 81
81 // Call GetWindowState() to instantiate this class. 82 // Call GetWindowState() to instantiate this class.
82 ~WindowState() override; 83 ~WindowState() override;
83 84
84 aura::Window* window() { return window_; } 85 aura::Window* window() { return window_; }
85 const aura::Window* window() const { return window_; } 86 const aura::Window* window() const { return window_; }
86 87
87 bool HasDelegate() const; 88 bool HasDelegate() const;
88 void SetDelegate(scoped_ptr<WindowStateDelegate> delegate); 89 void SetDelegate(std::unique_ptr<WindowStateDelegate> delegate);
89 90
90 // Returns the window's current ash state type. 91 // Returns the window's current ash state type.
91 // Refer to WindowStateType definition in wm_types.h as for why Ash 92 // Refer to WindowStateType definition in wm_types.h as for why Ash
92 // has its own state type. 93 // has its own state type.
93 WindowStateType GetStateType() const; 94 WindowStateType GetStateType() const;
94 95
95 // Predicates to check window state. 96 // Predicates to check window state.
96 bool IsMinimized() const; 97 bool IsMinimized() const;
97 bool IsMaximized() const; 98 bool IsMaximized() const;
98 bool IsFullscreen() const; 99 bool IsFullscreen() const;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 // Sets the restore bounds property on the window in the virtual screen 170 // Sets the restore bounds property on the window in the virtual screen
170 // coordinates. Deletes existing bounds value if exists. 171 // coordinates. Deletes existing bounds value if exists.
171 void SetRestoreBoundsInScreen(const gfx::Rect& bounds_in_screen); 172 void SetRestoreBoundsInScreen(const gfx::Rect& bounds_in_screen);
172 173
173 // Deletes and clears the restore bounds property on the window. 174 // Deletes and clears the restore bounds property on the window.
174 void ClearRestoreBounds(); 175 void ClearRestoreBounds();
175 176
176 // Replace the State object of a window with a state handler which can 177 // Replace the State object of a window with a state handler which can
177 // implement a new window manager type. The passed object will be owned 178 // implement a new window manager type. The passed object will be owned
178 // by this object and the returned object will be owned by the caller. 179 // by this object and the returned object will be owned by the caller.
179 scoped_ptr<State> SetStateObject(scoped_ptr<State> new_state); 180 std::unique_ptr<State> SetStateObject(std::unique_ptr<State> new_state);
180 181
181 // True if the window should be unminimized to the restore bounds, as 182 // True if the window should be unminimized to the restore bounds, as
182 // opposed to the window's current bounds. |unminimized_to_restore_bounds_| is 183 // opposed to the window's current bounds. |unminimized_to_restore_bounds_| is
183 // reset to the default value after the window is unminimized. 184 // reset to the default value after the window is unminimized.
184 bool unminimize_to_restore_bounds() const { 185 bool unminimize_to_restore_bounds() const {
185 return unminimize_to_restore_bounds_; 186 return unminimize_to_restore_bounds_;
186 } 187 }
187 void set_unminimize_to_restore_bounds(bool value) { 188 void set_unminimize_to_restore_bounds(bool value) {
188 unminimize_to_restore_bounds_ = value; 189 unminimize_to_restore_bounds_ = value;
189 } 190 }
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 // Sets the wndow's |bounds| and transitions to the new bounds with 354 // Sets the wndow's |bounds| and transitions to the new bounds with
354 // a scale animation. 355 // a scale animation.
355 void SetBoundsDirectAnimated(const gfx::Rect& bounds); 356 void SetBoundsDirectAnimated(const gfx::Rect& bounds);
356 357
357 // Sets the window's |bounds| and transition to the new bounds with 358 // Sets the window's |bounds| and transition to the new bounds with
358 // a cross fade animation. 359 // a cross fade animation.
359 void SetBoundsDirectCrossFade(const gfx::Rect& bounds); 360 void SetBoundsDirectCrossFade(const gfx::Rect& bounds);
360 361
361 // The owner of this window settings. 362 // The owner of this window settings.
362 aura::Window* window_; 363 aura::Window* window_;
363 scoped_ptr<WindowStateDelegate> delegate_; 364 std::unique_ptr<WindowStateDelegate> delegate_;
364 365
365 bool window_position_managed_; 366 bool window_position_managed_;
366 bool bounds_changed_by_user_; 367 bool bounds_changed_by_user_;
367 bool panel_attached_; 368 bool panel_attached_;
368 bool ignored_by_shelf_; 369 bool ignored_by_shelf_;
369 bool can_consume_system_keys_; 370 bool can_consume_system_keys_;
370 bool top_row_keys_are_function_keys_; 371 bool top_row_keys_are_function_keys_;
371 scoped_ptr<DragDetails> drag_details_; 372 std::unique_ptr<DragDetails> drag_details_;
372 373
373 bool unminimize_to_restore_bounds_; 374 bool unminimize_to_restore_bounds_;
374 bool in_immersive_fullscreen_; 375 bool in_immersive_fullscreen_;
375 bool hide_shelf_when_fullscreen_; 376 bool hide_shelf_when_fullscreen_;
376 bool minimum_visibility_; 377 bool minimum_visibility_;
377 bool can_be_dragged_; 378 bool can_be_dragged_;
378 bool cached_always_on_top_; 379 bool cached_always_on_top_;
379 380
380 // A property to remember the window position which was set before the 381 // A property to remember the window position which was set before the
381 // auto window position manager changed the window bounds, so that it can get 382 // auto window position manager changed the window bounds, so that it can get
382 // restored when only this one window gets shown. 383 // restored when only this one window gets shown.
383 scoped_ptr<gfx::Rect> pre_auto_manage_window_bounds_; 384 std::unique_ptr<gfx::Rect> pre_auto_manage_window_bounds_;
384 385
385 base::ObserverList<WindowStateObserver> observer_list_; 386 base::ObserverList<WindowStateObserver> observer_list_;
386 387
387 // True to ignore a property change event to avoid reentrance in 388 // True to ignore a property change event to avoid reentrance in
388 // UpdateWindowStateType() 389 // UpdateWindowStateType()
389 bool ignore_property_change_; 390 bool ignore_property_change_;
390 391
391 scoped_ptr<State> current_state_; 392 std::unique_ptr<State> current_state_;
392 393
393 DISALLOW_COPY_AND_ASSIGN(WindowState); 394 DISALLOW_COPY_AND_ASSIGN(WindowState);
394 }; 395 };
395 396
396 // Returns the WindowState for active window. Returns |NULL| 397 // Returns the WindowState for active window. Returns |NULL|
397 // if there is no active window. 398 // if there is no active window.
398 ASH_EXPORT WindowState* GetActiveWindowState(); 399 ASH_EXPORT WindowState* GetActiveWindowState();
399 400
400 // Returns the WindowState for |window|. Creates WindowState 401 // Returns the WindowState for |window|. Creates WindowState
401 // if it didn't exist. The settings object is owned by |window|. 402 // if it didn't exist. The settings object is owned by |window|.
402 ASH_EXPORT WindowState* GetWindowState(aura::Window* window); 403 ASH_EXPORT WindowState* GetWindowState(aura::Window* window);
403 404
404 // const version of GetWindowState. 405 // const version of GetWindowState.
405 ASH_EXPORT const WindowState* 406 ASH_EXPORT const WindowState*
406 GetWindowState(const aura::Window* window); 407 GetWindowState(const aura::Window* window);
407 408
408 } // namespace wm 409 } // namespace wm
409 } // namespace ash 410 } // namespace ash
410 411
411 #endif // ASH_WM_WINDOW_STATE_H_ 412 #endif // ASH_WM_WINDOW_STATE_H_
OLDNEW
« no previous file with comments | « ash/wm/window_resizer.h ('k') | ash/wm/window_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698