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

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

Issue 2503623002: Support creation of toplevel mus::Windows on separate displays (Closed)
Patch Set: remove default display_id value in .cc Created 4 years 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
« no previous file with comments | « no previous file | ash/mus/test/wm_test_base.h » ('j') | ash/mus/window_manager_unittest.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 const gfx::Point top_right_in_screen =
sky 2016/11/23 20:48:19 wm_window has a GetBoundsInScreen. Can't you use i
thanhph 2016/11/23 21:31:42 I can't. I tried to use it as below but got ASAN:D
sky 2016/11/23 21:45:36 This is likely failing because window doesn't have
mfomitchev 2016/11/23 22:00:33 Scott, this will not work if there is a transform
thanhph 2016/11/23 22:25:55 Done, thanks! This is shorter.
106 wm_root_window_controller_->ConvertPointToScreen(
107 WmWindowMus::Get(window), window->bounds().top_right());
108
109 const gfx::Point bottom_left_in_screen =
110 wm_root_window_controller_->ConvertPointToScreen(
111 WmWindowMus::Get(window), window->bounds().bottom_left());
112
113 const gfx::Rect bounds_in_screen =
114 gfx::Rect(bottom_left_in_screen.x(), top_right_in_screen.y(),
115 top_right_in_screen.x() - bottom_left_in_screen.x(),
116 bottom_left_in_screen.y() - top_right_in_screen.y());
117
106 container_window = WmWindowMus::GetMusWindow(wm::GetDefaultParent( 118 container_window = WmWindowMus::GetMusWindow(wm::GetDefaultParent(
107 WmWindowMus::Get(root_), WmWindowMus::Get(window), window->bounds())); 119 WmWindowMus::Get(root_), WmWindowMus::Get(window), bounds_in_screen));
108 } 120 }
109 DCHECK(WmWindowMus::Get(container_window)->IsContainer()); 121 DCHECK(WmWindowMus::Get(container_window)->IsContainer());
110 122
111 if (provide_non_client_frame) { 123 if (provide_non_client_frame) {
112 NonClientFrameController::Create(container_window, window, 124 NonClientFrameController::Create(container_window, window,
113 window_manager_->window_manager_client()); 125 window_manager_->window_manager_client());
114 } else { 126 } else {
115 container_window->AddChild(window); 127 container_window->AddChild(window);
116 } 128 }
117 129
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 void RootWindowController::CreateLayoutManagers() { 189 void RootWindowController::CreateLayoutManagers() {
178 // Override the default layout managers for certain containers. 190 // Override the default layout managers for certain containers.
179 WmWindowMus* lock_screen_container = 191 WmWindowMus* lock_screen_container =
180 GetWindowByShellWindowId(kShellWindowId_LockScreenContainer); 192 GetWindowByShellWindowId(kShellWindowId_LockScreenContainer);
181 layout_managers_[lock_screen_container->mus_window()].reset( 193 layout_managers_[lock_screen_container->mus_window()].reset(
182 new ScreenlockLayout(lock_screen_container->mus_window())); 194 new ScreenlockLayout(lock_screen_container->mus_window()));
183 } 195 }
184 196
185 } // namespace mus 197 } // namespace mus
186 } // namespace ash 198 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/mus/test/wm_test_base.h » ('j') | ash/mus/window_manager_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698