diff options
author | oshima <oshima@chromium.org> | 2015-04-23 01:07:43 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-23 08:08:01 +0000 |
commit | 0b9377aad2963ed234fb41e5be10dcf60676f7a1 (patch) | |
tree | db6bd72329df4968fa8678fc762d5a191d5b7822 /ash | |
parent | ddcfb76424b4180aa6ef4944a7aa9bf119bb3e8e (diff) | |
download | chromium_src-0b9377aad2963ed234fb41e5be10dcf60676f7a1.zip chromium_src-0b9377aad2963ed234fb41e5be10dcf60676f7a1.tar.gz chromium_src-0b9377aad2963ed234fb41e5be10dcf60676f7a1.tar.bz2 |
Move HasInternalDisplay to gfx::Display
Remove IsInternalDisplay as it's not useful.
BUG=None
Review URL: https://codereview.chromium.org/1102713002
Cr-Commit-Position: refs/heads/master@{#326475}
Diffstat (limited to 'ash')
-rw-r--r-- | ash/content/display/screen_orientation_controller_chromeos.cc | 32 | ||||
-rw-r--r-- | ash/display/display_manager.cc | 19 | ||||
-rw-r--r-- | ash/display/display_manager.h | 5 | ||||
-rw-r--r-- | ash/display/resolution_notification_controller.cc | 2 | ||||
-rw-r--r-- | ash/system/chromeos/brightness/tray_brightness.cc | 4 | ||||
-rw-r--r-- | ash/system/chromeos/tray_display.cc | 14 |
6 files changed, 31 insertions, 45 deletions
diff --git a/ash/content/display/screen_orientation_controller_chromeos.cc b/ash/content/display/screen_orientation_controller_chromeos.cc index dbd4465..ac15726 100644 --- a/ash/content/display/screen_orientation_controller_chromeos.cc +++ b/ash/content/display/screen_orientation_controller_chromeos.cc @@ -37,13 +37,12 @@ const float kDisplayRotationStickyAngleDegrees = 60.0f; const float kMinimumAccelerationScreenRotation = 4.2f; blink::WebScreenOrientationLockType GetDisplayNaturalOrientation() { - ash::DisplayManager* display_manager = - ash::Shell::GetInstance()->display_manager(); - if (!display_manager->HasInternalDisplay()) + if (!gfx::Display::HasInternalDisplay()) return blink::WebScreenOrientationLockLandscape; ash::DisplayInfo info = - display_manager->GetDisplayInfo(gfx::Display::InternalDisplayId()); + ash::Shell::GetInstance()->display_manager()->GetDisplayInfo( + gfx::Display::InternalDisplayId()); gfx::Size size = info.size_in_pixel(); switch (info.rotation()) { case gfx::Display::ROTATE_0: @@ -102,19 +101,17 @@ void ScreenOrientationController::SetRotationLocked(bool rotation_locked) { rotation_locked_orientation_ = blink::WebScreenOrientationLockAny; FOR_EACH_OBSERVER(Observer, observers_, OnRotationLockChanged(rotation_locked_)); - DisplayManager* display_manager = Shell::GetInstance()->display_manager(); - if (!display_manager->HasInternalDisplay()) + if (!gfx::Display::HasInternalDisplay()) return; base::AutoReset<bool> auto_ignore_display_configuration_updates( &ignore_display_configuration_updates_, true); - display_manager->RegisterDisplayRotationProperties(rotation_locked_, - current_rotation_); + Shell::GetInstance()->display_manager()->RegisterDisplayRotationProperties( + rotation_locked_, current_rotation_); } void ScreenOrientationController::SetDisplayRotation( gfx::Display::Rotation rotation) { - DisplayManager* display_manager = Shell::GetInstance()->display_manager(); - if (!display_manager->HasInternalDisplay()) + if (!gfx::Display::HasInternalDisplay()) return; current_rotation_ = rotation; base::AutoReset<bool> auto_ignore_display_configuration_updates( @@ -196,9 +193,9 @@ void ScreenOrientationController::Unlock(content::WebContents* web_contents) { void ScreenOrientationController::OnDisplayConfigurationChanged() { if (ignore_display_configuration_updates_) return; - DisplayManager* display_manager = Shell::GetInstance()->display_manager(); - if (!display_manager->HasInternalDisplay()) + if (!gfx::Display::HasInternalDisplay()) return; + DisplayManager* display_manager = Shell::GetInstance()->display_manager(); gfx::Display::Rotation user_rotation = display_manager->GetDisplayInfo(gfx::Display::InternalDisplayId()) .rotation(); @@ -212,13 +209,14 @@ void ScreenOrientationController::OnDisplayConfigurationChanged() { } void ScreenOrientationController::OnMaximizeModeStarted() { - DisplayManager* display_manager = Shell::GetInstance()->display_manager(); // Do not exit early, as the internal display can be determined after Maximize // Mode has started. (chrome-os-partner:38796) // Always start observing. - if (display_manager->HasInternalDisplay()) { + if (gfx::Display::HasInternalDisplay()) { current_rotation_ = user_rotation_ = - display_manager->GetDisplayInfo(gfx::Display::InternalDisplayId()) + Shell::GetInstance() + ->display_manager() + ->GetDisplayInfo(gfx::Display::InternalDisplayId()) .rotation(); } if (!rotation_locked_) @@ -294,10 +292,10 @@ void ScreenOrientationController::LockRotationToSecondaryOrientation( void ScreenOrientationController::LockToRotationMatchingOrientation( blink::WebScreenOrientationLockType lock_orientation) { - DisplayManager* display_manager = Shell::GetInstance()->display_manager(); - if (!display_manager->HasInternalDisplay()) + if (!gfx::Display::HasInternalDisplay()) return; + DisplayManager* display_manager = Shell::GetInstance()->display_manager(); gfx::Display::Rotation rotation = display_manager->GetDisplayInfo(gfx::Display::InternalDisplayId()) .rotation(); diff --git a/ash/display/display_manager.cc b/ash/display/display_manager.cc index 3dcbadd..d40917a 100644 --- a/ash/display/display_manager.cc +++ b/ash/display/display_manager.cc @@ -104,21 +104,15 @@ void MaybeInitInternalDisplay(DisplayInfo* info) { } } +bool IsInternalDisplayId(int64 id) { + return gfx::Display::InternalDisplayId() == id; +} + } // namespace using std::string; using std::vector; -// static -bool DisplayManager::HasInternalDisplay() { - return gfx::Display::InternalDisplayId() != gfx::Display::kInvalidDisplayID; -} - -// static -bool DisplayManager::IsInternalDisplayId(int64 id) { - return gfx::Display::InternalDisplayId() == id; -} - DisplayManager::DisplayManager() : delegate_(NULL), screen_(new ScreenAsh), @@ -628,10 +622,9 @@ void DisplayManager::OnNativeDisplaysChanged( else if (display_modes_.find(iter->id()) != display_modes_.end()) display_modes_[iter->id()] = *display_modes_iter; } - if (HasInternalDisplay() && - !internal_display_connected && + if (gfx::Display::HasInternalDisplay() && !internal_display_connected && display_info_.find(gfx::Display::InternalDisplayId()) == - display_info_.end()) { + display_info_.end()) { DisplayInfo internal_display_info( gfx::Display::InternalDisplayId(), l10n_util::GetStringUTF8(IDS_ASH_INTERNAL_DISPLAY_NAME), diff --git a/ash/display/display_manager.h b/ash/display/display_manager.h index c8480b0..9aa686c 100644 --- a/ash/display/display_manager.h +++ b/ash/display/display_manager.h @@ -79,11 +79,6 @@ class ASH_EXPORT DisplayManager MIRRORING }; - // True if there is an internal display. - static bool HasInternalDisplay(); - - static bool IsInternalDisplayId(int64 id); - DisplayManager(); #if defined(OS_CHROMEOS) ~DisplayManager() override; diff --git a/ash/display/resolution_notification_controller.cc b/ash/display/resolution_notification_controller.cc index bea5554..a0e98ea 100644 --- a/ash/display/resolution_notification_controller.cc +++ b/ash/display/resolution_notification_controller.cc @@ -139,7 +139,7 @@ ResolutionNotificationController::ResolutionChangeInfo::ResolutionChangeInfo( accept_callback(accept_callback), timeout_count(0) { DisplayManager* display_manager = Shell::GetInstance()->display_manager(); - if (!display_manager->HasInternalDisplay() && + if (!gfx::Display::HasInternalDisplay() && display_manager->num_connected_displays() == 1u) { timeout_count = kTimeoutInSec; } diff --git a/ash/system/chromeos/brightness/tray_brightness.cc b/ash/system/chromeos/brightness/tray_brightness.cc index e874ccf..3e8b330 100644 --- a/ash/system/chromeos/brightness/tray_brightness.cc +++ b/ash/system/chromeos/brightness/tray_brightness.cc @@ -8,7 +8,6 @@ #include "ash/accelerators/accelerator_controller.h" #include "ash/ash_constants.h" -#include "ash/display/display_manager.h" #include "ash/metrics/user_metrics_recorder.h" #include "ash/shell.h" #include "ash/shell_observer.h" @@ -26,6 +25,7 @@ #include "grit/ash_resources.h" #include "grit/ash_strings.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/gfx/display.h" #include "ui/gfx/image/image.h" #include "ui/views/controls/button/image_button.h" #include "ui/views/controls/image_view.h" @@ -273,7 +273,7 @@ void TrayBrightness::HandleBrightnessChanged(double percent, // Never show the bubble on systems that lack internal displays: if an // external display's brightness is changed, it may already display the new // level via an on-screen display. - if (!Shell::GetInstance()->display_manager()->HasInternalDisplay()) + if (!gfx::Display::HasInternalDisplay()) return; if (brightness_view_) diff --git a/ash/system/chromeos/tray_display.cc b/ash/system/chromeos/tray_display.cc index 9a61897..aaeead2 100644 --- a/ash/system/chromeos/tray_display.cc +++ b/ash/system/chromeos/tray_display.cc @@ -92,9 +92,9 @@ base::string16 GetAllDisplayInfo() { std::vector<base::string16> lines; int64 internal_id = gfx::Display::kInvalidDisplayID; // Make sure to show the internal display first. - if (display_manager->HasInternalDisplay() && - display_manager->IsInternalDisplayId( - display_manager->first_display_id())) { + if (gfx::Display::HasInternalDisplay() && + gfx::Display::InternalDisplayId() == + display_manager->first_display_id()) { internal_id = display_manager->first_display_id(); lines.push_back(GetDisplayInfoLine(internal_id)); } @@ -228,7 +228,7 @@ class DisplayView : public ActionableView { base::string16* additional_message_out) { DisplayManager* display_manager = GetDisplayManager(); if (display_manager->GetNumDisplays() > 1) { - if (GetDisplayManager()->HasInternalDisplay()) { + if (gfx::Display::HasInternalDisplay()) { return l10n_util::GetStringFUTF16( IDS_ASH_STATUS_TRAY_DISPLAY_EXTENDED, GetExternalDisplayName()); } @@ -237,7 +237,7 @@ class DisplayView : public ActionableView { } if (display_manager->IsInMirrorMode()) { - if (GetDisplayManager()->HasInternalDisplay()) { + if (gfx::Display::HasInternalDisplay()) { return l10n_util::GetStringFUTF16( IDS_ASH_STATUS_TRAY_DISPLAY_MIRRORING, GetDisplayName(display_manager->mirroring_display_id())); @@ -247,8 +247,8 @@ class DisplayView : public ActionableView { } int64 primary_id = Shell::GetScreen()->GetPrimaryDisplay().id(); - if (display_manager->HasInternalDisplay() && - !display_manager->IsInternalDisplayId(primary_id)) { + if (gfx::Display::HasInternalDisplay() && + !(gfx::Display::InternalDisplayId() == primary_id)) { if (additional_message_out) { *additional_message_out = l10n_util::GetStringUTF16( IDS_ASH_STATUS_TRAY_DISPLAY_DOCKED_DESCRIPTION); |