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

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

Issue 2642003002: Removes ash::mus::RootWindowController (Closed)
Patch Set: feedback 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/screen_mus.h" 5 #include "ash/mus/screen_mus.h"
6 6
7 #include "services/ui/public/interfaces/display/display_controller.mojom.h"
7 #include "ui/aura/env.h" 8 #include "ui/aura/env.h"
8 #include "ui/aura/mus/window_tree_host_mus.h" 9 #include "ui/aura/mus/window_tree_host_mus.h"
9 #include "ui/aura/window.h" 10 #include "ui/aura/window.h"
10 11
11 namespace ash { 12 namespace ash {
12 13
13 ScreenMus::ScreenMus() = default; 14 ScreenMus::ScreenMus(display::mojom::DisplayController* display_controller)
15 : display_controller_(display_controller) {}
14 16
15 ScreenMus::~ScreenMus() = default; 17 ScreenMus::~ScreenMus() = default;
16 18
19 void ScreenMus::SetWorkAreaInsets(aura::Window* window,
20 const gfx::Insets& insets) {
21 // If we are not the active instance assume we're in shutdown, and ignore.
22 if (display::Screen::GetScreen() != this)
23 return;
24
25 display::Display old_display = GetDisplayNearestWindow(window);
26 display::Display new_display = old_display;
27 new_display.UpdateWorkAreaFromInsets(insets);
28 if (old_display.work_area() == new_display.work_area())
29 return;
30
31 display_list().UpdateDisplay(new_display);
32 if (display_controller_) {
33 display_controller_->SetDisplayWorkArea(
34 new_display.id(), new_display.bounds().size(), insets);
35 }
36 }
37
17 display::Display ScreenMus::GetDisplayNearestWindow( 38 display::Display ScreenMus::GetDisplayNearestWindow(
18 aura::Window* window) const { 39 aura::Window* window) const {
19 const aura::WindowTreeHost* host = window->GetHost(); 40 const aura::WindowTreeHost* host = window->GetHost();
20 if (!host) 41 if (!host)
21 return GetPrimaryDisplay(); 42 return GetPrimaryDisplay();
22 auto iter = display_list().FindDisplayById( 43 auto iter = display_list().FindDisplayById(
23 static_cast<const aura::WindowTreeHostMus*>(host)->display_id()); 44 static_cast<const aura::WindowTreeHostMus*>(host)->display_id());
24 return iter == display_list().displays().end() ? GetPrimaryDisplay() : *iter; 45 return iter == display_list().displays().end() ? GetPrimaryDisplay() : *iter;
25 } 46 }
26 47
27 gfx::Point ScreenMus::GetCursorScreenPoint() { 48 gfx::Point ScreenMus::GetCursorScreenPoint() {
28 return aura::Env::GetInstance()->last_mouse_location(); 49 return aura::Env::GetInstance()->last_mouse_location();
29 } 50 }
30 51
31 } // namespace ash 52 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698