summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authorderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-10 14:05:44 +0000
committerderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-10 14:05:44 +0000
commita487bfeb84f7ece633f455f78c8eff2ed0af6d16 (patch)
tree60bbea989ed2fa08b808f1f8b5e2b709c0c2d0d4 /ash
parent7c2ebfd68efed75ac4099c6698bc157eb6eaa20e (diff)
downloadchromium_src-a487bfeb84f7ece633f455f78c8eff2ed0af6d16.zip
chromium_src-a487bfeb84f7ece633f455f78c8eff2ed0af6d16.tar.gz
chromium_src-a487bfeb84f7ece633f455f78c8eff2ed0af6d16.tar.bz2
ash: Make wm::WindowState's c'tor private.
wm::WindowState objects should be created via the wm::GetWindowState() method; they're owned by an aura::Window and destroyed in the window's d'tor. BUG=365364 Review URL: https://codereview.chromium.org/314433003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276013 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/wm/window_state.cc44
-rw-r--r--ash/wm/window_state.h5
2 files changed, 26 insertions, 23 deletions
diff --git a/ash/wm/window_state.cc b/ash/wm/window_state.cc
index 6e49351..ca1e4bc9 100644
--- a/ash/wm/window_state.cc
+++ b/ash/wm/window_state.cc
@@ -81,24 +81,6 @@ WMEventType WMEventTypeFromShowState(ui::WindowShowState requested_show_state) {
} // namespace
-WindowState::WindowState(aura::Window* window)
- : window_(window),
- window_position_managed_(false),
- bounds_changed_by_user_(false),
- panel_attached_(true),
- ignored_by_shelf_(false),
- can_consume_system_keys_(false),
- top_row_keys_are_function_keys_(false),
- unminimize_to_restore_bounds_(false),
- in_immersive_fullscreen_(false),
- hide_shelf_when_fullscreen_(true),
- minimum_visibility_(false),
- can_be_dragged_(true),
- ignore_property_change_(false),
- current_state_(new DefaultState(ToWindowStateType(GetShowState()))) {
- window_->AddObserver(this);
-}
-
WindowState::~WindowState() {
// WindowState is registered as an owned property of |window_|, and window
// unregisters all of its observers in its d'tor before destroying its
@@ -316,6 +298,28 @@ void WindowState::OnWindowPropertyChanged(aura::Window* window,
}
}
+WindowState::WindowState(aura::Window* window)
+ : window_(window),
+ window_position_managed_(false),
+ bounds_changed_by_user_(false),
+ panel_attached_(true),
+ ignored_by_shelf_(false),
+ can_consume_system_keys_(false),
+ top_row_keys_are_function_keys_(false),
+ unminimize_to_restore_bounds_(false),
+ in_immersive_fullscreen_(false),
+ hide_shelf_when_fullscreen_(true),
+ minimum_visibility_(false),
+ can_be_dragged_(true),
+ ignore_property_change_(false),
+ current_state_(new DefaultState(ToWindowStateType(GetShowState()))) {
+ window_->AddObserver(this);
+}
+
+ui::WindowShowState WindowState::GetShowState() const {
+ return window_->GetProperty(aura::client::kShowStateKey);
+}
+
void WindowState::SetBoundsInScreen(
const gfx::Rect& bounds_in_screen) {
gfx::Rect bounds_in_parent =
@@ -324,10 +328,6 @@ void WindowState::SetBoundsInScreen(
window_->SetBounds(bounds_in_parent);
}
-ui::WindowShowState WindowState::GetShowState() const {
- return window_->GetProperty(aura::client::kShowStateKey);
-}
-
void WindowState::AdjustSnappedBounds(gfx::Rect* bounds) {
if (is_dragged() || !IsSnapped())
return;
diff --git a/ash/wm/window_state.h b/ash/wm/window_state.h
index d26c031..8732d28 100644
--- a/ash/wm/window_state.h
+++ b/ash/wm/window_state.h
@@ -78,7 +78,7 @@ class ASH_EXPORT WindowState : public aura::WindowObserver {
DISALLOW_COPY_AND_ASSIGN(State);
};
- explicit WindowState(aura::Window* window);
+ // Call GetWindowState() to instantiate this class.
virtual ~WindowState();
aura::Window* window() { return window_; }
@@ -306,8 +306,11 @@ class ASH_EXPORT WindowState : public aura::WindowObserver {
friend class DefaultState;
friend class ash::LockWindowState;
friend class ash::MaximizeModeWindowState;
+ friend ASH_EXPORT WindowState* GetWindowState(aura::Window*);
FRIEND_TEST_ALL_PREFIXES(WindowAnimationsTest, CrossFadeToBounds);
+ explicit WindowState(aura::Window* window);
+
WindowStateDelegate* delegate() { return delegate_.get(); }
// Returns the window's current show state.