diff options
author | ynovikov@chromium.org <ynovikov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-14 18:22:41 +0000 |
---|---|---|
committer | ynovikov@chromium.org <ynovikov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-14 18:22:41 +0000 |
commit | 722098a42f7af76478c25e92565c9043cef7f606 (patch) | |
tree | 084c382efa559c78d94d15733040ba8fedf241ef /ash/display | |
parent | 01d43da65b33b3dfd4d86d09ca2c17262ce88c2a (diff) | |
download | chromium_src-722098a42f7af76478c25e92565c9043cef7f606.zip chromium_src-722098a42f7af76478c25e92565c9043cef7f606.tar.gz chromium_src-722098a42f7af76478c25e92565c9043cef7f606.tar.bz2 |
Add IsInternal property to gfx::Display
Move knowledge whether a display is internal or not
from ash::DisplayManager into gfx::Display.
BUG=171310
TEST=ash_unittests, ui_unittests, unit_tests pass
Review URL: https://chromiumcodereview.appspot.com/12217120
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182494 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/display')
-rw-r--r-- | ash/display/display_controller.cc | 2 | ||||
-rw-r--r-- | ash/display/display_manager.cc | 21 | ||||
-rw-r--r-- | ash/display/display_manager.h | 4 | ||||
-rw-r--r-- | ash/display/event_transformation_handler.cc | 4 |
4 files changed, 13 insertions, 18 deletions
diff --git a/ash/display/display_controller.cc b/ash/display/display_controller.cc index c85aab40..5bdca9b 100644 --- a/ash/display/display_controller.cc +++ b/ash/display/display_controller.cc @@ -301,7 +301,7 @@ void DisplayController::InitPrimaryDisplay() { int y = primary_candidate->bounds_in_pixel().y(); for (int i = 1; i < count; ++i) { const gfx::Display* display = display_manager->GetDisplayAt(i); - if (display_manager->IsInternalDisplayId(display->id())) { + if (display->IsInternal()) { primary_candidate = display; break; } else if (display->bounds_in_pixel().y() < y) { diff --git a/ash/display/display_manager.cc b/ash/display/display_manager.cc index f46fd53..9b2d7f2 100644 --- a/ash/display/display_manager.cc +++ b/ash/display/display_manager.cc @@ -91,7 +91,6 @@ DEFINE_WINDOW_PROPERTY_KEY(int64, kDisplayIdKey, gfx::Display::kInvalidDisplayID); DisplayManager::DisplayManager() : - internal_display_id_(gfx::Display::kInvalidDisplayID), force_bounds_changed_(false) { Init(); } @@ -119,11 +118,11 @@ bool DisplayManager::IsActiveDisplay(const gfx::Display& display) const { } bool DisplayManager::HasInternalDisplay() const { - return internal_display_id_ != gfx::Display::kInvalidDisplayID; + return gfx::Display::InternalDisplayId() != gfx::Display::kInvalidDisplayID; } bool DisplayManager::IsInternalDisplayId(int64 id) const { - return internal_display_id_ == id; + return gfx::Display::InternalDisplayId() == id; } bool DisplayManager::UpdateWorkAreaOfDisplayNearestWindow( @@ -185,11 +184,11 @@ void DisplayManager::OnNativeDisplaysChanged( return; } DisplayList new_displays = updated_displays; - if (internal_display_id_ != gfx::Display::kInvalidDisplayID) { + if (HasInternalDisplay()) { bool internal_display_connected = false; for (DisplayList::const_iterator iter = updated_displays.begin(); iter != updated_displays.end(); ++iter) { - if ((*iter).id() == internal_display_id_) { + if ((*iter).IsInternal()) { internal_display_connected = true; // Update the internal display cache. internal_display_.reset(new gfx::Display); @@ -201,8 +200,9 @@ void DisplayManager::OnNativeDisplaysChanged( if (!internal_display_connected) { // Internal display may be reported as disconnect during startup time. if (!internal_display_.get()) { - internal_display_.reset(new gfx::Display(internal_display_id_, - gfx::Rect(800, 600))); + internal_display_.reset( + new gfx::Display(gfx::Display::InternalDisplayId(), + gfx::Rect(800, 600))); } new_displays.push_back(*internal_display_.get()); } @@ -441,7 +441,8 @@ void DisplayManager::Init() { for (size_t i = 0; i < output_names.size(); ++i) { if (chromeos::OutputConfigurator::IsInternalOutputName( output_names[i])) { - internal_display_id_ = GetDisplayIdForOutput(outputs[i], i); + gfx::Display::SetInternalDisplayId( + GetDisplayIdForOutput(outputs[i], i)); break; } } @@ -530,10 +531,10 @@ void DisplayManager::AddDisplayFromSpec(const std::string& spec) { } int64 DisplayManager::SetFirstDisplayAsInternalDisplayForTest() { - internal_display_id_ = displays_[0].id(); + gfx::Display::SetInternalDisplayId(displays_[0].id()); internal_display_.reset(new gfx::Display); *internal_display_ = displays_[0]; - return internal_display_id_; + return gfx::Display::InternalDisplayId(); } void DisplayManager::EnsurePointerInDisplays() { diff --git a/ash/display/display_manager.h b/ash/display/display_manager.h index 56834d5..0041211 100644 --- a/ash/display/display_manager.h +++ b/ash/display/display_manager.h @@ -59,8 +59,6 @@ class ASH_EXPORT DisplayManager : public aura::RootWindowObserver { bool IsInternalDisplayId(int64 id) const; - uint64 internal_display_id() const { return internal_display_id_; } - bool UpdateWorkAreaOfDisplayNearestWindow(const aura::Window* window, const gfx::Insets& insets); @@ -189,8 +187,6 @@ class ASH_EXPORT DisplayManager : public aura::RootWindowObserver { DisplayList displays_; - int64 internal_display_id_; - // An internal display cache used when the internal display is disconnectd. scoped_ptr<gfx::Display> internal_display_; diff --git a/ash/display/event_transformation_handler.cc b/ash/display/event_transformation_handler.cc index 380399d..7ecc634 100644 --- a/ash/display/event_transformation_handler.cc +++ b/ash/display/event_transformation_handler.cc @@ -4,7 +4,6 @@ #include "ash/display/event_transformation_handler.h" -#include "ash/display/display_manager.h" #include "ash/screen_ash.h" #include "ash/shell.h" #include "ash/wm/coordinate_conversion.h" @@ -45,8 +44,7 @@ void EventTransformationHandler::OnScrollEvent(ui::ScrollEvent* event) { wm::ConvertPointToScreen(target, &point_in_screen); const gfx::Display& display = Shell::GetScreen()->GetDisplayNearestPoint(point_in_screen); - DisplayManager* display_manager = Shell::GetInstance()->display_manager(); - if (!display_manager->IsInternalDisplayId(display.id())) + if (!display.IsInternal()) scale *= kBoostForNonIntegrated; event->Scale(scale); |