OLD | NEW |
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/wm/workspace_controller.h" | 5 #include "ash/wm/workspace_controller.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/wm/window_util.h" | 8 #include "ash/wm/window_util.h" |
9 #include "ash/wm/workspace/workspace_event_filter.h" | 9 #include "ash/wm/workspace/workspace_event_filter.h" |
10 #include "ash/wm/workspace/workspace_layout_manager.h" | 10 #include "ash/wm/workspace/workspace_layout_manager.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 viewport->SetLayoutManager(layout_manager_); | 38 viewport->SetLayoutManager(layout_manager_); |
39 Shell::GetRootWindow()->AddRootWindowObserver(this); | 39 Shell::GetRootWindow()->AddRootWindowObserver(this); |
40 Shell::GetRootWindow()->AddObserver(this); | 40 Shell::GetRootWindow()->AddObserver(this); |
41 workspace_manager_->set_grid_size(kGridSize); | 41 workspace_manager_->set_grid_size(kGridSize); |
42 event_filter_->set_grid_size(kGridSize); | 42 event_filter_->set_grid_size(kGridSize); |
43 } | 43 } |
44 | 44 |
45 WorkspaceController::~WorkspaceController() { | 45 WorkspaceController::~WorkspaceController() { |
46 Shell::GetRootWindow()->RemoveObserver(this); | 46 Shell::GetRootWindow()->RemoveObserver(this); |
47 Shell::GetRootWindow()->RemoveRootWindowObserver(this); | 47 Shell::GetRootWindow()->RemoveRootWindowObserver(this); |
| 48 // WorkspaceLayoutManager may attempt to access state from us. Destroy it now. |
| 49 if (viewport_->layout_manager() == layout_manager_) |
| 50 viewport_->SetLayoutManager(NULL); |
48 } | 51 } |
49 | 52 |
50 void WorkspaceController::ToggleOverview() { | 53 void WorkspaceController::ToggleOverview() { |
51 workspace_manager_->SetOverview(!workspace_manager_->is_overview()); | 54 workspace_manager_->SetOverview(!workspace_manager_->is_overview()); |
52 } | 55 } |
53 | 56 |
54 void WorkspaceController::ShowMenu(views::Widget* widget, | 57 void WorkspaceController::ShowMenu(views::Widget* widget, |
55 const gfx::Point& location) { | 58 const gfx::Point& location) { |
56 #if !defined(OS_MACOSX) | 59 #if !defined(OS_MACOSX) |
57 ui::SimpleMenuModel menu_model(this); | 60 ui::SimpleMenuModel menu_model(this); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 } | 119 } |
117 | 120 |
118 bool WorkspaceController::GetAcceleratorForCommandId( | 121 bool WorkspaceController::GetAcceleratorForCommandId( |
119 int command_id, | 122 int command_id, |
120 ui::Accelerator* accelerator) { | 123 ui::Accelerator* accelerator) { |
121 return false; | 124 return false; |
122 } | 125 } |
123 | 126 |
124 } // namespace internal | 127 } // namespace internal |
125 } // namespace ash | 128 } // namespace ash |
OLD | NEW |