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

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

Issue 2503623002: Support creation of toplevel mus::Windows on separate displays (Closed)
Patch Set: Clean up/format code. Created 4 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
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 // TODO(sky): constrain and validate properties before passing to server. 96 // TODO(sky): constrain and validate properties before passing to server.
97 ui::Window* window = root_->window_tree()->NewWindow(properties); 97 ui::Window* window = root_->window_tree()->NewWindow(properties);
98 window->SetBounds(CalculateDefaultBounds(window)); 98 window->SetBounds(CalculateDefaultBounds(window));
99 99
100 ui::Window* container_window = nullptr; 100 ui::Window* container_window = nullptr;
101 int container_id = kShellWindowId_Invalid; 101 int container_id = kShellWindowId_Invalid;
102 if (GetRequestedContainer(window, &container_id)) { 102 if (GetRequestedContainer(window, &container_id)) {
103 container_window = GetWindowByShellWindowId(container_id)->mus_window(); 103 container_window = GetWindowByShellWindowId(container_id)->mus_window();
104 } else { 104 } else {
105 // TODO(sky): window->bounds() isn't quite right. 105 // TODO(sky): window->bounds() isn't quite right.
mfomitchev 2016/11/17 17:14:01 Remove this now?
thanhph 2016/11/17 19:08:30 Done.
106 gfx::Rect* screen_bound = wm_root_window_controller_->ConvertWindowToScreen(
107 WmWindowMus::Get(window), window);
108
106 container_window = WmWindowMus::GetMusWindow(wm::GetDefaultParent( 109 container_window = WmWindowMus::GetMusWindow(wm::GetDefaultParent(
107 WmWindowMus::Get(root_), WmWindowMus::Get(window), window->bounds())); 110 WmWindowMus::Get(root_), WmWindowMus::Get(window), (*screen_bound)));
108 } 111 }
109 DCHECK(WmWindowMus::Get(container_window)->IsContainer()); 112 DCHECK(WmWindowMus::Get(container_window)->IsContainer());
110 113
111 if (provide_non_client_frame) { 114 if (provide_non_client_frame) {
112 NonClientFrameController::Create(container_window, window, 115 NonClientFrameController::Create(container_window, window,
113 window_manager_->window_manager_client()); 116 window_manager_->window_manager_client());
114 } else { 117 } else {
115 container_window->AddChild(window); 118 container_window->AddChild(window);
116 } 119 }
117
118 window_count_++; 120 window_count_++;
119
120 return window; 121 return window;
121 } 122 }
122 123
123 WmWindowMus* RootWindowController::GetWindowByShellWindowId(int id) { 124 WmWindowMus* RootWindowController::GetWindowByShellWindowId(int id) {
124 return WmWindowMus::AsWmWindowMus( 125 return WmWindowMus::AsWmWindowMus(
125 WmWindowMus::Get(root_)->GetChildByShellWindowId(id)); 126 WmWindowMus::Get(root_)->GetChildByShellWindowId(id));
126 } 127 }
127 128
128 void RootWindowController::SetWorkAreaInests(const gfx::Insets& insets) { 129 void RootWindowController::SetWorkAreaInests(const gfx::Insets& insets) {
129 gfx::Rect old_work_area = display_.work_area(); 130 gfx::Rect old_work_area = display_.work_area();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 void RootWindowController::CreateLayoutManagers() { 178 void RootWindowController::CreateLayoutManagers() {
178 // Override the default layout managers for certain containers. 179 // Override the default layout managers for certain containers.
179 WmWindowMus* lock_screen_container = 180 WmWindowMus* lock_screen_container =
180 GetWindowByShellWindowId(kShellWindowId_LockScreenContainer); 181 GetWindowByShellWindowId(kShellWindowId_LockScreenContainer);
181 layout_managers_[lock_screen_container->mus_window()].reset( 182 layout_managers_[lock_screen_container->mus_window()].reset(
182 new ScreenlockLayout(lock_screen_container->mus_window())); 183 new ScreenlockLayout(lock_screen_container->mus_window()));
183 } 184 }
184 185
185 } // namespace mus 186 } // namespace mus
186 } // namespace ash 187 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698