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

Side by Side Diff: ui/aura_shell/show_state_controller.cc

Issue 8430024: Add WorkspaceObserver to observe changes in workspace state (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update comments Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « ui/aura_shell/show_state_controller.h ('k') | ui/aura_shell/workspace/workspace.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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "ui/aura_shell/show_state_controller.h" 5 #include "ui/aura_shell/show_state_controller.h"
6 6
7 #include "ui/aura/aura_constants.h" 7 #include "ui/aura/aura_constants.h"
8 #include "ui/aura/window.h" 8 #include "ui/aura/window.h"
9 #include "ui/aura_shell/default_container_layout_manager.h"
10 #include "ui/aura_shell/property_util.h" 9 #include "ui/aura_shell/property_util.h"
11 #include "ui/aura_shell/workspace/workspace.h" 10 #include "ui/aura_shell/workspace/workspace.h"
12 #include "ui/aura_shell/workspace/workspace_manager.h" 11 #include "ui/aura_shell/workspace/workspace_manager.h"
13 #include "ui/base/ui_base_types.h" 12 #include "ui/base/ui_base_types.h"
14 13
15 namespace aura_shell { 14 namespace aura_shell {
16 namespace internal { 15 namespace internal {
17 16
18 ShowStateController::ShowStateController( 17 ShowStateController::ShowStateController(
19 DefaultContainerLayoutManager* layout_manager) 18 WorkspaceManager* workspace_manager)
20 : layout_manager_(layout_manager) { 19 : workspace_manager_(workspace_manager) {
21 } 20 }
22 21
23 ShowStateController::~ShowStateController() { 22 ShowStateController::~ShowStateController() {
24 } 23 }
25 24
26 void ShowStateController::OnPropertyChanged(aura::Window* window, 25 void ShowStateController::OnPropertyChanged(aura::Window* window,
27 const char* name, 26 const char* name,
28 void* old) { 27 void* old) {
29 if (name != aura::kShowStateKey) 28 if (name != aura::kShowStateKey)
30 return; 29 return;
31 if (window->GetIntProperty(name) == ui::SHOW_STATE_NORMAL) { 30 if (window->GetIntProperty(name) == ui::SHOW_STATE_NORMAL) {
32 // Restore the size of window first, then let Workspace layout the window. 31 // Restore the size of window first, then let Workspace layout the window.
33 const gfx::Rect* restore = GetRestoreBounds(window); 32 const gfx::Rect* restore = GetRestoreBounds(window);
34 window->SetProperty(aura::kRestoreBoundsKey, NULL); 33 window->SetProperty(aura::kRestoreBoundsKey, NULL);
35 if (restore) 34 if (restore)
36 window->SetBounds(*restore); 35 window->SetBounds(*restore);
37 delete restore; 36 delete restore;
38 } else if (old == reinterpret_cast<void*>(ui::SHOW_STATE_NORMAL)) { 37 } else if (old == reinterpret_cast<void*>(ui::SHOW_STATE_NORMAL)) {
39 // Store the restore bounds only if previous state is normal. 38 // Store the restore bounds only if previous state is normal.
40 DCHECK(window->GetProperty(aura::kRestoreBoundsKey) == NULL); 39 DCHECK(window->GetProperty(aura::kRestoreBoundsKey) == NULL);
41 SetRestoreBounds(window, window->GetTargetBounds()); 40 SetRestoreBounds(window, window->GetTargetBounds());
42 } 41 }
43 42
44 layout_manager_->set_ignore_calculate_bounds(true); 43 workspace_manager_->FindBy(window)->Layout(NULL, window);
45 layout_manager_->workspace_manager()->FindBy(window)->Layout(NULL, window);
46 layout_manager_->set_ignore_calculate_bounds(false);
47 } 44 }
48 45
49 } // namespace internal 46 } // namespace internal
50 } // namespace aura_shell 47 } // namespace aura_shell
OLDNEW
« no previous file with comments | « ui/aura_shell/show_state_controller.h ('k') | ui/aura_shell/workspace/workspace.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698