| Index: ash/display/multi_display_manager.cc
|
| diff --git a/ash/monitor/multi_monitor_manager.cc b/ash/display/multi_display_manager.cc
|
| similarity index 67%
|
| rename from ash/monitor/multi_monitor_manager.cc
|
| rename to ash/display/multi_display_manager.cc
|
| index 70bf90de67c3386ded202f8b4a3beec4201d5cda..54b3d74d6ef5eecea1f25dd7132dee7b301974ff 100644
|
| --- a/ash/monitor/multi_monitor_manager.cc
|
| +++ b/ash/display/multi_display_manager.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "ash/monitor/multi_monitor_manager.h"
|
| +#include "ash/display/multi_display_manager.h"
|
|
|
| #include <string>
|
| #include <vector>
|
| @@ -36,46 +36,46 @@ using aura::Window;
|
| using std::string;
|
| using std::vector;
|
|
|
| -DEFINE_WINDOW_PROPERTY_KEY(int, kMonitorIdKey, -1);
|
| +DEFINE_WINDOW_PROPERTY_KEY(int, kDisplayIdKey, -1);
|
|
|
| -MultiMonitorManager::MultiMonitorManager() {
|
| +MultiDisplayManager::MultiDisplayManager() {
|
| Init();
|
| }
|
|
|
| -MultiMonitorManager::~MultiMonitorManager() {
|
| +MultiDisplayManager::~MultiDisplayManager() {
|
| }
|
|
|
| // static
|
| -void MultiMonitorManager::AddRemoveMonitor() {
|
| - MultiMonitorManager* manager = static_cast<MultiMonitorManager*>(
|
| - aura::Env::GetInstance()->monitor_manager());
|
| - manager->AddRemoveMonitorImpl();
|
| +void MultiDisplayManager::AddRemoveDisplay() {
|
| + MultiDisplayManager* manager = static_cast<MultiDisplayManager*>(
|
| + aura::Env::GetInstance()->display_manager());
|
| + manager->AddRemoveDisplayImpl();
|
| }
|
|
|
| -void MultiMonitorManager::CycleMonitor() {
|
| - MultiMonitorManager* manager = static_cast<MultiMonitorManager*>(
|
| - aura::Env::GetInstance()->monitor_manager());
|
| - manager->CycleMonitorImpl();
|
| +void MultiDisplayManager::CycleDisplay() {
|
| + MultiDisplayManager* manager = static_cast<MultiDisplayManager*>(
|
| + aura::Env::GetInstance()->display_manager());
|
| + manager->CycleDisplayImpl();
|
| }
|
|
|
| - void MultiMonitorManager::ToggleMonitorScale() {
|
| - MultiMonitorManager* manager = static_cast<MultiMonitorManager*>(
|
| - aura::Env::GetInstance()->monitor_manager());
|
| - manager->ScaleMonitorImpl();
|
| + void MultiDisplayManager::ToggleDisplayScale() {
|
| + MultiDisplayManager* manager = static_cast<MultiDisplayManager*>(
|
| + aura::Env::GetInstance()->display_manager());
|
| + manager->ScaleDisplayImpl();
|
| }
|
|
|
| -void MultiMonitorManager::OnNativeMonitorsChanged(
|
| +void MultiDisplayManager::OnNativeDisplaysChanged(
|
| const std::vector<gfx::Display>& new_displays) {
|
| size_t min = std::min(displays_.size(), new_displays.size());
|
|
|
| - // For m19, we only care about 1st monitor as primary, and
|
| - // don't differentiate the rest of monitors as all secondary
|
| - // monitors have the same content. ID for primary monitor stays the same
|
| - // because we never remove it, we don't update IDs for other monitors
|
| + // For m19, we only care about 1st display as primary, and
|
| + // don't differentiate the rest of displays as all secondary
|
| + // displays have the same content. ID for primary display stays the same
|
| + // because we never remove it, we don't update IDs for other displays
|
| // , for now, because they're the same.
|
| // TODO(oshima): Fix this so that we can differentiate outputs
|
| - // and keep a content on one monitor stays on the same monitor
|
| - // when a monitor is added or removed.
|
| + // and keep a content on one display stays on the same display
|
| + // when a display is added or removed.
|
| for (size_t i = 0; i < min; ++i) {
|
| gfx::Display& current_display = displays_[i];
|
| const gfx::Display& new_display = new_displays[i];
|
| @@ -89,7 +89,7 @@ void MultiMonitorManager::OnNativeMonitorsChanged(
|
| }
|
|
|
| if (displays_.size() < new_displays.size()) {
|
| - // New monitors added
|
| + // New displays added
|
| for (size_t i = min; i < new_displays.size(); ++i) {
|
| const gfx::Display& new_display = new_displays[i];
|
| displays_.push_back(gfx::Display(new_display.id()));
|
| @@ -102,8 +102,8 @@ void MultiMonitorManager::OnNativeMonitorsChanged(
|
| NotifyDisplayAdded(display);
|
| }
|
| } else {
|
| - // Monitors are removed. We keep the monitor for the primary
|
| - // monitor (at index 0) because it needs the monitor information
|
| + // Displays are removed. We keep the display for the primary
|
| + // display (at index 0) because it needs the display information
|
| // even if it doesn't exit.
|
| while (displays_.size() > new_displays.size() && displays_.size() > 1) {
|
| Displays::reverse_iterator iter = displays_.rbegin();
|
| @@ -113,45 +113,45 @@ void MultiMonitorManager::OnNativeMonitorsChanged(
|
| }
|
| }
|
|
|
| -RootWindow* MultiMonitorManager::CreateRootWindowForMonitor(
|
| +RootWindow* MultiDisplayManager::CreateRootWindowForDisplay(
|
| const gfx::Display& display) {
|
| RootWindow* root_window = new RootWindow(display.bounds_in_pixel());
|
| // No need to remove RootWindowObserver because
|
| - // the MonitorManager object outlives RootWindow objects.
|
| + // the DisplayManager object outlives RootWindow objects.
|
| root_window->AddRootWindowObserver(this);
|
| - root_window->SetProperty(kMonitorIdKey, display.id());
|
| + root_window->SetProperty(kDisplayIdKey, display.id());
|
| root_window->Init();
|
| return root_window;
|
| }
|
|
|
| -const gfx::Display& MultiMonitorManager::GetDisplayAt(size_t index) {
|
| +const gfx::Display& MultiDisplayManager::GetDisplayAt(size_t index) {
|
| return index < displays_.size() ? displays_[index] : GetInvalidDisplay();
|
| }
|
|
|
| -size_t MultiMonitorManager::GetNumDisplays() const {
|
| +size_t MultiDisplayManager::GetNumDisplays() const {
|
| return displays_.size();
|
| }
|
|
|
| -const gfx::Display& MultiMonitorManager::GetDisplayNearestWindow(
|
| +const gfx::Display& MultiDisplayManager::GetDisplayNearestWindow(
|
| const Window* window) const {
|
| if (!window) {
|
| - MultiMonitorManager* manager = const_cast<MultiMonitorManager*>(this);
|
| + MultiDisplayManager* manager = const_cast<MultiDisplayManager*>(this);
|
| return manager->GetDisplayAt(0);
|
| }
|
| const RootWindow* root = window->GetRootWindow();
|
| - MultiMonitorManager* manager = const_cast<MultiMonitorManager*>(this);
|
| + MultiDisplayManager* manager = const_cast<MultiDisplayManager*>(this);
|
| return root ? manager->FindDisplayForRootWindow(root) : GetInvalidDisplay();
|
| }
|
|
|
| -const gfx::Display& MultiMonitorManager::GetDisplayNearestPoint(
|
| +const gfx::Display& MultiDisplayManager::GetDisplayNearestPoint(
|
| const gfx::Point& point) const {
|
| // TODO(oshima): For m19, mouse is constrained within
|
| // the primary window.
|
| - MultiMonitorManager* manager = const_cast<MultiMonitorManager*>(this);
|
| + MultiDisplayManager* manager = const_cast<MultiDisplayManager*>(this);
|
| return manager->GetDisplayAt(0);
|
| }
|
|
|
| -void MultiMonitorManager::OnRootWindowResized(const aura::RootWindow* root,
|
| +void MultiDisplayManager::OnRootWindowResized(const aura::RootWindow* root,
|
| const gfx::Size& old_size) {
|
| if (!use_fullscreen_host_window()) {
|
| gfx::Display& display = FindDisplayForRootWindow(root);
|
| @@ -160,7 +160,7 @@ void MultiMonitorManager::OnRootWindowResized(const aura::RootWindow* root,
|
| }
|
| }
|
|
|
| -bool MultiMonitorManager::UpdateWorkAreaOfMonitorNearestWindow(
|
| +bool MultiDisplayManager::UpdateWorkAreaOfDisplayNearestWindow(
|
| const aura::Window* window,
|
| const gfx::Insets& insets) {
|
| const RootWindow* root = window->GetRootWindow();
|
| @@ -170,23 +170,23 @@ bool MultiMonitorManager::UpdateWorkAreaOfMonitorNearestWindow(
|
| return old_work_area != display.work_area();
|
| }
|
|
|
| -void MultiMonitorManager::Init() {
|
| - // TODO(oshima): Move this logic to MonitorChangeObserver.
|
| +void MultiDisplayManager::Init() {
|
| + // TODO(oshima): Move this logic to DisplayChangeObserver.
|
| const string size_str = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
|
| switches::kAuraHostWindowSize);
|
| vector<string> parts;
|
| base::SplitString(size_str, ',', &parts);
|
| for (vector<string>::const_iterator iter = parts.begin();
|
| iter != parts.end(); ++iter) {
|
| - displays_.push_back(CreateMonitorFromSpec(*iter));
|
| + displays_.push_back(CreateDisplayFromSpec(*iter));
|
| }
|
| if (displays_.empty())
|
| - displays_.push_back(CreateMonitorFromSpec("" /* default */));
|
| + displays_.push_back(CreateDisplayFromSpec("" /* default */));
|
| // Force the 1st display to be the primary display (id == 0).
|
| displays_[0].set_id(0);
|
| }
|
|
|
| -void MultiMonitorManager::AddRemoveMonitorImpl() {
|
| +void MultiDisplayManager::AddRemoveDisplayImpl() {
|
| std::vector<gfx::Display> new_displays;
|
| if (displays_.size() > 1) {
|
| // Remove if there is more than one display.
|
| @@ -196,13 +196,13 @@ void MultiMonitorManager::AddRemoveMonitorImpl() {
|
| } else {
|
| // Add if there is only one display.
|
| new_displays.push_back(displays_[0]);
|
| - new_displays.push_back(CreateMonitorFromSpec("50+50-1280x768"));
|
| + new_displays.push_back(CreateDisplayFromSpec("50+50-1280x768"));
|
| }
|
| if (new_displays.size())
|
| - OnNativeMonitorsChanged(new_displays);
|
| + OnNativeDisplaysChanged(new_displays);
|
| }
|
|
|
| -void MultiMonitorManager::CycleMonitorImpl() {
|
| +void MultiDisplayManager::CycleDisplayImpl() {
|
| if (displays_.size() > 1) {
|
| std::vector<gfx::Display> new_displays;
|
| for (Displays::const_iterator iter = displays_.begin() + 1;
|
| @@ -211,11 +211,11 @@ void MultiMonitorManager::CycleMonitorImpl() {
|
| new_displays.push_back(display);
|
| }
|
| new_displays.push_back(displays_.front());
|
| - OnNativeMonitorsChanged(new_displays);
|
| + OnNativeDisplaysChanged(new_displays);
|
| }
|
| }
|
|
|
| -void MultiMonitorManager::ScaleMonitorImpl() {
|
| +void MultiDisplayManager::ScaleDisplayImpl() {
|
| if (displays_.size() > 0) {
|
| std::vector<gfx::Display> new_displays;
|
| for (Displays::const_iterator iter = displays_.begin();
|
| @@ -227,13 +227,13 @@ void MultiMonitorManager::ScaleMonitorImpl() {
|
| display.size().Scale(factor)));
|
| new_displays.push_back(display);
|
| }
|
| - OnNativeMonitorsChanged(new_displays);
|
| + OnNativeDisplaysChanged(new_displays);
|
| }
|
| }
|
|
|
| -gfx::Display& MultiMonitorManager::FindDisplayForRootWindow(
|
| +gfx::Display& MultiDisplayManager::FindDisplayForRootWindow(
|
| const aura::RootWindow* root_window) {
|
| - int id = root_window->GetProperty(kMonitorIdKey);
|
| + int id = root_window->GetProperty(kDisplayIdKey);
|
| for (Displays::iterator iter = displays_.begin();
|
| iter != displays_.end(); ++iter) {
|
| if ((*iter).id() == id)
|
|
|