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

Side by Side Diff: ash/mus/bridge/wm_root_window_controller_mus.cc

Issue 2620913003: Removes WmRootWindowController subclasses (Closed)
Patch Set: spelling 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
« no previous file with comments | « ash/mus/bridge/wm_root_window_controller_mus.h ('k') | ash/mus/bridge/wm_shell_mus.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ash/mus/bridge/wm_root_window_controller_mus.h"
6
7 #include "ash/common/shelf/wm_shelf.h"
8 #include "ash/mus/bridge/wm_shell_mus.h"
9 #include "ash/mus/bridge/wm_window_mus.h"
10 #include "ash/mus/root_window_controller.h"
11 #include "ash/mus/window_manager.h"
12 #include "ui/aura/mus/window_mus.h"
13 #include "ui/aura/mus/window_tree_client.h"
14 #include "ui/aura/window.h"
15 #include "ui/aura/window_property.h"
16 #include "ui/display/display.h"
17
18 DECLARE_WINDOW_PROPERTY_TYPE(ash::mus::WmRootWindowControllerMus*);
19
20 namespace {
21
22 DEFINE_LOCAL_WINDOW_PROPERTY_KEY(ash::mus::WmRootWindowControllerMus*,
23 kWmRootWindowControllerKey,
24 nullptr);
25
26 } // namespace
27
28 namespace ash {
29 namespace mus {
30
31 WmRootWindowControllerMus::WmRootWindowControllerMus(
32 WmShellMus* shell,
33 RootWindowController* root_window_controller)
34 : WmRootWindowController(WmWindowMus::Get(root_window_controller->root())),
35 shell_(shell),
36 root_window_controller_(root_window_controller) {
37 shell_->AddRootWindowController(this);
38 root_window_controller_->root()->SetProperty(kWmRootWindowControllerKey,
39 this);
40 }
41
42 WmRootWindowControllerMus::~WmRootWindowControllerMus() {
43 shell_->RemoveRootWindowController(this);
44 }
45
46 // static
47 const WmRootWindowControllerMus* WmRootWindowControllerMus::Get(
48 const aura::Window* window) {
49 if (!window)
50 return nullptr;
51
52 return window->GetRootWindow()->GetProperty(kWmRootWindowControllerKey);
53 }
54
55 gfx::Point WmRootWindowControllerMus::ConvertPointToScreen(
56 const WmWindowMus* source,
57 const gfx::Point& point) const {
58 gfx::Point point_in_root =
59 source->ConvertPointToTarget(source->GetRootWindow(), point);
60 point_in_root += GetDisplay().bounds().OffsetFromOrigin();
61 return point_in_root;
62 }
63
64 const display::Display& WmRootWindowControllerMus::GetDisplay() const {
65 return root_window_controller_->display();
66 }
67
68 void WmRootWindowControllerMus::MoveWindowsTo(WmWindow* dest) {
69 WmRootWindowController::MoveWindowsTo(dest);
70 }
71
72 bool WmRootWindowControllerMus::HasShelf() {
73 return GetShelf() != nullptr;
74 }
75
76 WmShelf* WmRootWindowControllerMus::GetShelf() {
77 return root_window_controller_->wm_shelf();
78 }
79
80 WmWindow* WmRootWindowControllerMus::GetWindow() {
81 return WmWindowMus::Get(root_window_controller_->root());
82 }
83
84 bool WmRootWindowControllerMus::ShouldDestroyWindowInCloseChildWindows(
85 WmWindow* window) {
86 aura::WindowTreeClient* window_tree_client =
87 root_window_controller_->window_manager()->window_tree_client();
88 aura::Window* aura_window = WmWindowMus::GetAuraWindow(window);
89 aura::WindowMus* window_mus = aura::WindowMus::Get(aura_window);
90 return window_tree_client->WasCreatedByThisClient(window_mus) ||
91 window_tree_client->IsRoot(window_mus);
92 }
93
94 } // namespace mus
95 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/bridge/wm_root_window_controller_mus.h ('k') | ash/mus/bridge/wm_shell_mus.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698