summaryrefslogtreecommitdiffstats
path: root/ash/display
diff options
context:
space:
mode:
authormukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-21 08:26:04 +0000
committermukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-21 08:26:04 +0000
commit4c0adc508c8d39abc7aa1b91eb9ca0780fd976d4 (patch)
treeb28f959d286e74aa555d160712943fb9d829c760 /ash/display
parente558397a087212e4157f00ec143367e9d63a4ef7 (diff)
downloadchromium_src-4c0adc508c8d39abc7aa1b91eb9ca0780fd976d4.zip
chromium_src-4c0adc508c8d39abc7aa1b91eb9ca0780fd976d4.tar.gz
chromium_src-4c0adc508c8d39abc7aa1b91eb9ca0780fd976d4.tar.bz2
Redesign display options for ChromeOS.
Several new features have been added recently, and this new UI allows users to customize them through web UI. Updates display options page. BUG=190897 R=oshima@chromium.org, xiyuan@chromium.org, jhawkins@chromium.org Review URL: https://chromiumcodereview.appspot.com/14710011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@201256 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/display')
-rw-r--r--ash/display/display_manager.cc54
-rw-r--r--ash/display/display_manager.h3
2 files changed, 31 insertions, 26 deletions
diff --git a/ash/display/display_manager.cc b/ash/display/display_manager.cc
index c776e79..d15f2d1 100644
--- a/ash/display/display_manager.cc
+++ b/ash/display/display_manager.cc
@@ -86,32 +86,6 @@ struct ScaleComparator {
float scale;
};
-std::vector<float> GetScalesForDisplay(const DisplayInfo& info) {
- std::vector<float> ret;
- if (info.device_scale_factor() == 2.0f) {
- ret.assign(kUIScalesFor2x, kUIScalesFor2x + arraysize(kUIScalesFor2x));
- return ret;
- }
- switch (info.bounds_in_pixel().width()) {
- case 1280:
- ret.assign(kUIScalesFor1280,
- kUIScalesFor1280 + arraysize(kUIScalesFor1280));
- break;
- case 1366:
- ret.assign(kUIScalesFor1366,
- kUIScalesFor1366 + arraysize(kUIScalesFor1366));
- break;
- default:
- ret.assign(kUIScalesFor1280,
- kUIScalesFor1280 + arraysize(kUIScalesFor1280));
-#if defined(OS_CHROMEOS)
- if (base::chromeos::IsRunningOnChromeOS())
- NOTREACHED() << "Unknown resolution:" << info.ToString();
-#endif
- }
- return ret;
-}
-
gfx::Display& GetInvalidDisplay() {
static gfx::Display* invalid_display = new gfx::Display();
return *invalid_display;
@@ -143,6 +117,34 @@ DisplayManager::~DisplayManager() {
}
// static
+std::vector<float> DisplayManager::GetScalesForDisplay(
+ const DisplayInfo& info) {
+ std::vector<float> ret;
+ if (info.device_scale_factor() == 2.0f) {
+ ret.assign(kUIScalesFor2x, kUIScalesFor2x + arraysize(kUIScalesFor2x));
+ return ret;
+ }
+ switch (info.bounds_in_pixel().width()) {
+ case 1280:
+ ret.assign(kUIScalesFor1280,
+ kUIScalesFor1280 + arraysize(kUIScalesFor1280));
+ break;
+ case 1366:
+ ret.assign(kUIScalesFor1366,
+ kUIScalesFor1366 + arraysize(kUIScalesFor1366));
+ break;
+ default:
+ ret.assign(kUIScalesFor1280,
+ kUIScalesFor1280 + arraysize(kUIScalesFor1280));
+#if defined(OS_CHROMEOS)
+ if (base::chromeos::IsRunningOnChromeOS())
+ NOTREACHED() << "Unknown resolution:" << info.ToString();
+#endif
+ }
+ return ret;
+}
+
+// static
float DisplayManager::GetNextUIScale(const DisplayInfo& info, bool up) {
float scale = info.ui_scale();
std::vector<float> scales = GetScalesForDisplay(info);
diff --git a/ash/display/display_manager.h b/ash/display/display_manager.h
index e75a797..99441fc 100644
--- a/ash/display/display_manager.h
+++ b/ash/display/display_manager.h
@@ -39,6 +39,9 @@ class ASH_EXPORT DisplayManager : public aura::RootWindowObserver {
DisplayManager();
virtual ~DisplayManager();
+ // Returns the list of possible UI scales for the display.
+ static std::vector<float> GetScalesForDisplay(const DisplayInfo& info);
+
// Returns next valid UI scale.
static float GetNextUIScale(const DisplayInfo& info, bool up);