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

Side by Side Diff: ash/mus/bridge/wm_root_window_controller_mus.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/bridge/wm_root_window_controller_mus.h" 5 #include "ash/mus/bridge/wm_root_window_controller_mus.h"
6 6
7 #include "ash/mus/bridge/wm_shelf_mus.h" 7 #include "ash/mus/bridge/wm_shelf_mus.h"
8 #include "ash/mus/bridge/wm_shell_mus.h" 8 #include "ash/mus/bridge/wm_shell_mus.h"
9 #include "ash/mus/bridge/wm_window_mus.h" 9 #include "ash/mus/bridge/wm_window_mus.h"
10 #include "ash/mus/root_window_controller.h" 10 #include "ash/mus/root_window_controller.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 WmRootWindowControllerMus::~WmRootWindowControllerMus() { 43 WmRootWindowControllerMus::~WmRootWindowControllerMus() {
44 shell_->RemoveRootWindowController(this); 44 shell_->RemoveRootWindowController(this);
45 } 45 }
46 46
47 // static 47 // static
48 const WmRootWindowControllerMus* WmRootWindowControllerMus::Get( 48 const WmRootWindowControllerMus* WmRootWindowControllerMus::Get(
49 const ui::Window* window) { 49 const ui::Window* window) {
50 if (!window) 50 if (!window)
51 return nullptr; 51 return nullptr;
52 return window->GetRoot()->GetLocalProperty(kWmRootWindowControllerKey);
53 }
52 54
53 return window->GetRoot()->GetLocalProperty(kWmRootWindowControllerKey); 55 gfx::Rect* WmRootWindowControllerMus::ConvertWindowToScreen(
56 const WmWindowMus* source,
57 const ui::Window* window) const {
58 gfx::Point screen_point_top_right =
59 ConvertPointToScreen(source, window->bounds().top_right());
60
61 gfx::Point screen_point_bottom_left =
62 ConvertPointToScreen(source, window->bounds().bottom_left());
63
64 gfx::Rect* screen_bound =
65 new gfx::Rect(screen_point_bottom_left.x(), screen_point_top_right.y(),
66 screen_point_top_right.x() - screen_point_bottom_left.x(),
67 screen_point_bottom_left.y() - screen_point_top_right.y());
68
69 return screen_bound;
54 } 70 }
55 71
56 gfx::Point WmRootWindowControllerMus::ConvertPointToScreen( 72 gfx::Point WmRootWindowControllerMus::ConvertPointToScreen(
57 const WmWindowMus* source, 73 const WmWindowMus* source,
58 const gfx::Point& point) const { 74 const gfx::Point& point) const {
59 gfx::Point point_in_root = 75 gfx::Point point_in_root =
60 source->ConvertPointToTarget(source->GetRootWindow(), point); 76 source->ConvertPointToTarget(source->GetRootWindow(), point);
61 point_in_root += GetDisplay().bounds().OffsetFromOrigin(); 77 point_in_root += GetDisplay().bounds().OffsetFromOrigin();
62 return point_in_root; 78 return point_in_root;
63 } 79 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 144
129 bool WmRootWindowControllerMus::ShouldDestroyWindowInCloseChildWindows( 145 bool WmRootWindowControllerMus::ShouldDestroyWindowInCloseChildWindows(
130 WmWindow* window) { 146 WmWindow* window) {
131 ui::Window* ui_window = WmWindowMus::GetMusWindow(window); 147 ui::Window* ui_window = WmWindowMus::GetMusWindow(window);
132 return ui_window->WasCreatedByThisClient() || 148 return ui_window->WasCreatedByThisClient() ||
133 ui_window->window_tree()->GetRoots().count(ui_window); 149 ui_window->window_tree()->GetRoots().count(ui_window);
134 } 150 }
135 151
136 } // namespace mus 152 } // namespace mus
137 } // namespace ash 153 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698