| Index: ash/display/screen_ash.cc
|
| diff --git a/ash/display/screen_ash.cc b/ash/display/screen_ash.cc
|
| index 4b420ba6bec36c87b63e20824aba5ffa60d66c01..0f30c3567587ff8fcf930574e1315b3ccff15b32 100644
|
| --- a/ash/display/screen_ash.cc
|
| +++ b/ash/display/screen_ash.cc
|
| @@ -17,9 +17,9 @@
|
| #include "ui/aura/client/screen_position_client.h"
|
| #include "ui/aura/env.h"
|
| #include "ui/aura/window_event_dispatcher.h"
|
| -#include "ui/gfx/display.h"
|
| +#include "ui/display/display.h"
|
| +#include "ui/display/screen.h"
|
| #include "ui/gfx/display_finder.h"
|
| -#include "ui/gfx/screen.h"
|
|
|
| namespace ash {
|
|
|
| @@ -29,44 +29,49 @@ DisplayManager* GetDisplayManager() {
|
| return Shell::GetInstance()->display_manager();
|
| }
|
|
|
| -class ScreenForShutdown : public gfx::Screen {
|
| +class ScreenForShutdown : public display::Screen {
|
| public:
|
| explicit ScreenForShutdown(ScreenAsh* screen_ash)
|
| : display_list_(screen_ash->GetAllDisplays()),
|
| primary_display_(screen_ash->GetPrimaryDisplay()) {
|
| }
|
|
|
| - // gfx::Screen overrides:
|
| + // display::Screen overrides:
|
| gfx::Point GetCursorScreenPoint() override { return gfx::Point(); }
|
| gfx::NativeWindow GetWindowUnderCursor() override { return NULL; }
|
| gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override {
|
| return NULL;
|
| }
|
| int GetNumDisplays() const override { return display_list_.size(); }
|
| - std::vector<gfx::Display> GetAllDisplays() const override {
|
| + std::vector<display::Display> GetAllDisplays() const override {
|
| return display_list_;
|
| }
|
| - gfx::Display GetDisplayNearestWindow(gfx::NativeView view) const override {
|
| + display::Display GetDisplayNearestWindow(
|
| + gfx::NativeView view) const override {
|
| return primary_display_;
|
| }
|
| - gfx::Display GetDisplayNearestPoint(const gfx::Point& point) const override {
|
| + display::Display GetDisplayNearestPoint(
|
| + const gfx::Point& point) const override {
|
| return *gfx::FindDisplayNearestPoint(display_list_, point);
|
| }
|
| - gfx::Display GetDisplayMatching(const gfx::Rect& match_rect) const override {
|
| - const gfx::Display* matching =
|
| + display::Display GetDisplayMatching(
|
| + const gfx::Rect& match_rect) const override {
|
| + const display::Display* matching =
|
| gfx::FindDisplayWithBiggestIntersection(display_list_, match_rect);
|
| // Fallback to the primary display if there is no matching display.
|
| return matching ? *matching : GetPrimaryDisplay();
|
| }
|
| - gfx::Display GetPrimaryDisplay() const override { return primary_display_; }
|
| - void AddObserver(gfx::DisplayObserver* observer) override {
|
| + display::Display GetPrimaryDisplay() const override {
|
| + return primary_display_;
|
| + }
|
| + void AddObserver(display::DisplayObserver* observer) override {
|
| NOTREACHED() << "Observer should not be added during shutdown";
|
| }
|
| - void RemoveObserver(gfx::DisplayObserver* observer) override {}
|
| + void RemoveObserver(display::DisplayObserver* observer) override {}
|
|
|
| private:
|
| - const std::vector<gfx::Display> display_list_;
|
| - const gfx::Display primary_display_;
|
| + const std::vector<display::Display> display_list_;
|
| + const display::Display primary_display_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(ScreenForShutdown);
|
| };
|
| @@ -79,20 +84,20 @@ ScreenAsh::ScreenAsh() {
|
| ScreenAsh::~ScreenAsh() {
|
| }
|
|
|
| -void ScreenAsh::NotifyMetricsChanged(const gfx::Display& display,
|
| +void ScreenAsh::NotifyMetricsChanged(const display::Display& display,
|
| uint32_t metrics) {
|
| - FOR_EACH_OBSERVER(gfx::DisplayObserver,
|
| - observers_,
|
| + FOR_EACH_OBSERVER(display::DisplayObserver, observers_,
|
| OnDisplayMetricsChanged(display, metrics));
|
| }
|
|
|
| -void ScreenAsh::NotifyDisplayAdded(const gfx::Display& display) {
|
| - FOR_EACH_OBSERVER(gfx::DisplayObserver, observers_, OnDisplayAdded(display));
|
| +void ScreenAsh::NotifyDisplayAdded(const display::Display& display) {
|
| + FOR_EACH_OBSERVER(display::DisplayObserver, observers_,
|
| + OnDisplayAdded(display));
|
| }
|
|
|
| -void ScreenAsh::NotifyDisplayRemoved(const gfx::Display& display) {
|
| - FOR_EACH_OBSERVER(
|
| - gfx::DisplayObserver, observers_, OnDisplayRemoved(display));
|
| +void ScreenAsh::NotifyDisplayRemoved(const display::Display& display) {
|
| + FOR_EACH_OBSERVER(display::DisplayObserver, observers_,
|
| + OnDisplayRemoved(display));
|
| }
|
|
|
| gfx::Point ScreenAsh::GetCursorScreenPoint() {
|
| @@ -101,7 +106,7 @@ gfx::Point ScreenAsh::GetCursorScreenPoint() {
|
|
|
| gfx::NativeWindow ScreenAsh::GetWindowUnderCursor() {
|
| return GetWindowAtScreenPoint(
|
| - gfx::Screen::GetScreen()->GetCursorScreenPoint());
|
| + display::Screen::GetScreen()->GetCursorScreenPoint());
|
| }
|
|
|
| gfx::NativeWindow ScreenAsh::GetWindowAtScreenPoint(const gfx::Point& point) {
|
| @@ -121,11 +126,12 @@ int ScreenAsh::GetNumDisplays() const {
|
| return GetDisplayManager()->GetNumDisplays();
|
| }
|
|
|
| -std::vector<gfx::Display> ScreenAsh::GetAllDisplays() const {
|
| +std::vector<display::Display> ScreenAsh::GetAllDisplays() const {
|
| return GetDisplayManager()->active_display_list();
|
| }
|
|
|
| -gfx::Display ScreenAsh::GetDisplayNearestWindow(gfx::NativeView window) const {
|
| +display::Display ScreenAsh::GetDisplayNearestWindow(
|
| + gfx::NativeView window) const {
|
| if (!window)
|
| return GetPrimaryDisplay();
|
| const aura::Window* root_window = window->GetRootWindow();
|
| @@ -134,21 +140,23 @@ gfx::Display ScreenAsh::GetDisplayNearestWindow(gfx::NativeView window) const {
|
| const RootWindowSettings* rws = GetRootWindowSettings(root_window);
|
| int64_t id = rws->display_id;
|
| // if id is |kInvaildDisplayID|, it's being deleted.
|
| - DCHECK(id != gfx::Display::kInvalidDisplayID);
|
| - if (id == gfx::Display::kInvalidDisplayID)
|
| + DCHECK(id != display::Display::kInvalidDisplayID);
|
| + if (id == display::Display::kInvalidDisplayID)
|
| return GetPrimaryDisplay();
|
|
|
| DisplayManager* display_manager = GetDisplayManager();
|
| // RootWindow needs Display to determine its device scale factor
|
| // for non desktop display.
|
| - gfx::Display mirroring_display = display_manager->GetMirroringDisplayById(id);
|
| + display::Display mirroring_display =
|
| + display_manager->GetMirroringDisplayById(id);
|
| if (mirroring_display.is_valid())
|
| return mirroring_display;
|
| return display_manager->GetDisplayForId(id);
|
| }
|
|
|
| -gfx::Display ScreenAsh::GetDisplayNearestPoint(const gfx::Point& point) const {
|
| - const gfx::Display& display =
|
| +display::Display ScreenAsh::GetDisplayNearestPoint(
|
| + const gfx::Point& point) const {
|
| + const display::Display& display =
|
| GetDisplayManager()->FindDisplayContainingPoint(point);
|
| if (display.is_valid())
|
| return display;
|
| @@ -159,29 +167,30 @@ gfx::Display ScreenAsh::GetDisplayNearestPoint(const gfx::Point& point) const {
|
| GetDisplayManager()->active_display_list(), point);
|
| }
|
|
|
| -gfx::Display ScreenAsh::GetDisplayMatching(const gfx::Rect& match_rect) const {
|
| +display::Display ScreenAsh::GetDisplayMatching(
|
| + const gfx::Rect& match_rect) const {
|
| if (match_rect.IsEmpty())
|
| return GetDisplayNearestPoint(match_rect.origin());
|
| - const gfx::Display* matching = gfx::FindDisplayWithBiggestIntersection(
|
| + const display::Display* matching = gfx::FindDisplayWithBiggestIntersection(
|
| GetDisplayManager()->active_display_list(), match_rect);
|
| // Fallback to the primary display if there is no matching display.
|
| return matching ? *matching : GetPrimaryDisplay();
|
| }
|
|
|
| -gfx::Display ScreenAsh::GetPrimaryDisplay() const {
|
| +display::Display ScreenAsh::GetPrimaryDisplay() const {
|
| return GetDisplayManager()->GetDisplayForId(
|
| WindowTreeHostManager::GetPrimaryDisplayId());
|
| }
|
|
|
| -void ScreenAsh::AddObserver(gfx::DisplayObserver* observer) {
|
| +void ScreenAsh::AddObserver(display::DisplayObserver* observer) {
|
| observers_.AddObserver(observer);
|
| }
|
|
|
| -void ScreenAsh::RemoveObserver(gfx::DisplayObserver* observer) {
|
| +void ScreenAsh::RemoveObserver(display::DisplayObserver* observer) {
|
| observers_.RemoveObserver(observer);
|
| }
|
|
|
| -gfx::Screen* ScreenAsh::CloneForShutdown() {
|
| +display::Screen* ScreenAsh::CloneForShutdown() {
|
| return new ScreenForShutdown(this);
|
| }
|
|
|
|
|