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

Side by Side Diff: ash/mus/root_window_controller.cc

Issue 2633293005: Converts mash to use Shell (Closed)
Patch Set: cleanup Created 3 years, 11 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/mus/root_window_controller.h" 5 #include "ash/mus/root_window_controller.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 RootWindowController::RootWindowController( 70 RootWindowController::RootWindowController(
71 WindowManager* window_manager, 71 WindowManager* window_manager,
72 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host, 72 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host,
73 const display::Display& display, 73 const display::Display& display,
74 ash::RootWindowController::RootWindowType root_window_type) 74 ash::RootWindowController::RootWindowType root_window_type)
75 : window_manager_(window_manager), 75 : window_manager_(window_manager),
76 window_tree_host_(window_tree_host.get()), 76 window_tree_host_(window_tree_host.get()),
77 window_count_(0), 77 window_count_(0),
78 display_(display) { 78 display_(display) {
79 ash::InitRootWindowSettings(window_tree_host->window()); 79 ash::InitRootWindowSettings(window_tree_host->window())->display_id =
James Cook 2017/01/18 01:00:24 nit: This would be clearer if the result of InitRo
sky 2017/01/18 04:00:07 Done.
80 display.id();
80 window_tree_host->window()->SetProperty(kRootWindowControllerKey, this); 81 window_tree_host->window()->SetProperty(kRootWindowControllerKey, this);
81 WmShellMus::Get()->AddRootWindowController(this);
82 ash_root_window_controller_ = base::WrapUnique( 82 ash_root_window_controller_ = base::WrapUnique(
83 new ash::RootWindowController(nullptr, window_tree_host.release())); 83 new ash::RootWindowController(nullptr, window_tree_host.release()));
84 ash_root_window_controller_->Init(root_window_type); 84 ash_root_window_controller_->Init(root_window_type);
85 85
86 // TODO: To avoid lots of IPC AddActivationParent() should take an array.
87 // http://crbug.com/682048.
86 for (size_t i = 0; i < kNumActivatableShellWindowIds; ++i) { 88 for (size_t i = 0; i < kNumActivatableShellWindowIds; ++i) {
87 window_manager_->window_manager_client()->AddActivationParent( 89 window_manager_->window_manager_client()->AddActivationParent(
88 GetWindowByShellWindowId(kActivatableShellWindowIds[i])->aura_window()); 90 GetWindowByShellWindowId(kActivatableShellWindowIds[i])->aura_window());
89 } 91 }
90 } 92 }
91 93
92 RootWindowController::~RootWindowController() { 94 RootWindowController::~RootWindowController() {
93 Shutdown(); 95 Shutdown();
94 ash_root_window_controller_.reset(); 96 ash_root_window_controller_.reset();
95 WmShellMus::Get()->RemoveRootWindowController(this);
96 } 97 }
97 98
98 // static 99 // static
99 RootWindowController* RootWindowController::ForWindow(aura::Window* window) { 100 RootWindowController* RootWindowController::ForWindow(aura::Window* window) {
100 return window->GetRootWindow()->GetProperty(kRootWindowControllerKey); 101 return window->GetRootWindow()->GetProperty(kRootWindowControllerKey);
101 } 102 }
102 103
103 void RootWindowController::Shutdown() { 104 void RootWindowController::Shutdown() {
104 // NOTE: Shutdown() may be called multiple times. 105 // NOTE: Shutdown() may be called multiple times.
105 ash_root_window_controller_->Shutdown(); 106 ash_root_window_controller_->Shutdown();
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 } else { 235 } else {
235 width = root()->bounds().width() - 240; 236 width = root()->bounds().width() - 240;
236 height = root()->bounds().height() - 240; 237 height = root()->bounds().height() - 240;
237 } 238 }
238 return gfx::Rect(40 + (window_count_ % 4) * 40, 40 + (window_count_ % 4) * 40, 239 return gfx::Rect(40 + (window_count_ % 4) * 40, 40 + (window_count_ % 4) * 40,
239 width, height); 240 width, height);
240 } 241 }
241 242
242 } // namespace mus 243 } // namespace mus
243 } // namespace ash 244 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698