summaryrefslogtreecommitdiffstats
path: root/ash/display
diff options
context:
space:
mode:
authormukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-21 11:37:16 +0000
committermukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-21 11:37:16 +0000
commit35fad2692b6c3ae10c1a0c0831291a1a6433bca5 (patch)
tree07ab467199336700f6428b48e2bb685163b78b6f /ash/display
parent3c31bb28ba2b2c237b6ec4cb1d9b61e3306174f1 (diff)
downloadchromium_src-35fad2692b6c3ae10c1a0c0831291a1a6433bca5.zip
chromium_src-35fad2692b6c3ae10c1a0c0831291a1a6433bca5.tar.gz
chromium_src-35fad2692b6c3ae10c1a0c0831291a1a6433bca5.tar.bz2
Introduces the settings UI of color calibration.
This CL depends on crrev.com/195893005. BUG=344728 R=oshima@chromium.org TEST=manually Review URL: https://codereview.chromium.org/196493003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258529 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/display')
-rw-r--r--ash/display/display_change_observer_chromeos.cc2
-rw-r--r--ash/display/display_info.cc22
-rw-r--r--ash/display/display_info.h25
-rw-r--r--ash/display/display_manager.cc31
-rw-r--r--ash/display/display_manager.h10
5 files changed, 84 insertions, 6 deletions
diff --git a/ash/display/display_change_observer_chromeos.cc b/ash/display/display_change_observer_chromeos.cc
index 6aca864..461b7be 100644
--- a/ash/display/display_change_observer_chromeos.cc
+++ b/ash/display/display_change_observer_chromeos.cc
@@ -165,6 +165,8 @@ void DisplayChangeObserver::OnDisplayModeChanged(
displays.back().set_touch_support(
output.touch_device_id == 0 ? gfx::Display::TOUCH_SUPPORT_UNAVAILABLE :
gfx::Display::TOUCH_SUPPORT_AVAILABLE);
+ displays.back().set_available_color_profiles(
+ output.available_color_profiles);
}
// DisplayManager can be null during the boot.
diff --git a/ash/display/display_info.cc b/ash/display/display_info.cc
index 17a1bc1..25b6a74 100644
--- a/ash/display/display_info.cc
+++ b/ash/display/display_info.cc
@@ -173,7 +173,8 @@ DisplayInfo::DisplayInfo()
device_scale_factor_(1.0f),
overscan_insets_in_dip_(0, 0, 0, 0),
configured_ui_scale_(1.0f),
- native_(false) {
+ native_(false),
+ color_profile_(ui::COLOR_PROFILE_STANDARD) {
}
DisplayInfo::DisplayInfo(int64 id,
@@ -187,7 +188,8 @@ DisplayInfo::DisplayInfo(int64 id,
device_scale_factor_(1.0f),
overscan_insets_in_dip_(0, 0, 0, 0),
configured_ui_scale_(1.0f),
- native_(false) {
+ native_(false),
+ color_profile_(ui::COLOR_PROFILE_STANDARD) {
}
DisplayInfo::~DisplayInfo() {
@@ -212,13 +214,17 @@ void DisplayInfo::Copy(const DisplayInfo& native_info) {
if (!native_info.overscan_insets_in_dip_.empty())
overscan_insets_in_dip_ = native_info.overscan_insets_in_dip_;
- // Rotation_ and ui_scale_ are given by preference, or unit
- // tests. Don't copy if this native_info came from
+ // Rotation_ and ui_scale_ color_profile_ are given by preference,
+ // or unit tests. Don't copy if this native_info came from
// DisplayChangeObserver.
if (!native_info.native()) {
rotation_ = native_info.rotation_;
configured_ui_scale_ = native_info.configured_ui_scale_;
+ color_profile_ = native_info.color_profile();
}
+
+ available_color_profiles_ = native_info.available_color_profiles();
+
// Don't copy insets as it may be given by preference. |rotation_|
// is treated as a native so that it can be specified in
// |CreateFromSpec|.
@@ -298,5 +304,13 @@ std::string DisplayInfo::ToFullString() const {
return ToString() + ", display_modes==" + display_modes_str;
}
+void DisplayInfo::SetColorProfile(ui::ColorCalibrationProfile profile) {
+ if (std::find(available_color_profiles_.begin(),
+ available_color_profiles_.end(),
+ profile) != available_color_profiles_.end()) {
+ color_profile_ = profile;
+ }
+}
+
} // namespace internal
} // namespace ash
diff --git a/ash/display/display_info.h b/ash/display/display_info.h
index ccb989a..d47ac37 100644
--- a/ash/display/display_info.h
+++ b/ash/display/display_info.h
@@ -9,6 +9,7 @@
#include <vector>
#include "ash/ash_export.h"
+#include "ui/display/display_constants.h"
#include "ui/gfx/display.h"
#include "ui/gfx/insets.h"
#include "ui/gfx/rect.h"
@@ -154,6 +155,24 @@ class ASH_EXPORT DisplayInfo {
display_modes_.swap(display_modes);
}
+ ui::ColorCalibrationProfile color_profile() const {
+ return color_profile_;
+ }
+
+ // Sets the color profile. It will ignore if the specified |profile| is not in
+ // |available_color_profiles_|.
+ void SetColorProfile(ui::ColorCalibrationProfile profile);
+
+ const std::vector<ui::ColorCalibrationProfile>&
+ available_color_profiles() const {
+ return available_color_profiles_;
+ }
+
+ void set_available_color_profiles(
+ const std::vector<ui::ColorCalibrationProfile>& profiles) {
+ available_color_profiles_ = profiles;
+ }
+
// Returns a string representation of the DisplayInfo, excluding display
// modes.
std::string ToString() const;
@@ -195,6 +214,12 @@ class ASH_EXPORT DisplayInfo {
// The list of modes supported by this display.
std::vector<DisplayMode> display_modes_;
+
+ // The current profile of the color calibration.
+ ui::ColorCalibrationProfile color_profile_;
+
+ // The list of available variations for the color calibration.
+ std::vector<ui::ColorCalibrationProfile> available_color_profiles_;
};
} // namespace internal
diff --git a/ash/display/display_manager.cc b/ash/display/display_manager.cc
index ac3da91..c548428 100644
--- a/ash/display/display_manager.cc
+++ b/ash/display/display_manager.cc
@@ -464,11 +464,13 @@ void DisplayManager::RegisterDisplayProperty(
gfx::Display::Rotation rotation,
float ui_scale,
const gfx::Insets* overscan_insets,
- const gfx::Size& resolution_in_pixels) {
+ const gfx::Size& resolution_in_pixels,
+ ui::ColorCalibrationProfile color_profile) {
if (display_info_.find(display_id) == display_info_.end())
display_info_[display_id] = DisplayInfo(display_id, std::string(), false);
display_info_[display_id].set_rotation(rotation);
+ display_info_[display_id].SetColorProfile(color_profile);
// Just in case the preference file was corrupted.
if (0.5f <= ui_scale && ui_scale <= 2.0f)
display_info_[display_id].set_configured_ui_scale(ui_scale);
@@ -502,6 +504,21 @@ gfx::Insets DisplayManager::GetOverscanInsets(int64 display_id) const {
it->second.overscan_insets_in_dip() : gfx::Insets();
}
+void DisplayManager::SetColorCalibrationProfile(
+ int64 display_id,
+ ui::ColorCalibrationProfile profile) {
+#if defined(OS_CHROMEOS)
+ if (delegate_)
+ delegate_->PreDisplayConfigurationChange(false);
+ if (Shell::GetInstance()->output_configurator()->SetColorCalibrationProfile(
+ display_id, profile)) {
+ display_info_[display_id].SetColorProfile(profile);
+ }
+ if (delegate_)
+ delegate_->PostDisplayConfigurationChange();
+#endif
+}
+
void DisplayManager::OnNativeDisplaysChanged(
const std::vector<DisplayInfo>& updated_displays) {
if (updated_displays.empty()) {
@@ -972,6 +989,18 @@ void DisplayManager::InsertAndUpdateDisplayInfo(const DisplayInfo& new_info) {
display_info_[new_info.id()].set_native(false);
}
display_info_[new_info.id()].UpdateDisplaySize();
+
+ OnDisplayInfoUpdated(display_info_[new_info.id()]);
+}
+
+void DisplayManager::OnDisplayInfoUpdated(const DisplayInfo& display_info) {
+#if defined(OS_CHROMEOS)
+ ui::ColorCalibrationProfile color_profile = display_info.color_profile();
+ if (color_profile != ui::COLOR_PROFILE_STANDARD) {
+ Shell::GetInstance()->output_configurator()->SetColorCalibrationProfile(
+ display_info.id(), color_profile);
+ }
+#endif
}
gfx::Display DisplayManager::CreateDisplayFromDisplayInfoById(int64 id) {
diff --git a/ash/display/display_manager.h b/ash/display/display_manager.h
index c17f73f..c672524 100644
--- a/ash/display/display_manager.h
+++ b/ash/display/display_manager.h
@@ -174,7 +174,8 @@ class ASH_EXPORT DisplayManager
gfx::Display::Rotation rotation,
float ui_scale,
const gfx::Insets* overscan_insets,
- const gfx::Size& resolution_in_pixels);
+ const gfx::Size& resolution_in_pixels,
+ ui::ColorCalibrationProfile color_profile);
// Returns the display's selected mode.
bool GetSelectedModeForDisplayId(int64 display_id,
@@ -188,6 +189,10 @@ class ASH_EXPORT DisplayManager
// the display.
gfx::Insets GetOverscanInsets(int64 display_id) const;
+ // Sets the color calibration of the display to |profile|.
+ void SetColorCalibrationProfile(int64 display_id,
+ ui::ColorCalibrationProfile profile);
+
// Called when display configuration has changed. The new display
// configurations is passed as a vector of Display object, which
// contains each display's new infomration.
@@ -304,6 +309,9 @@ private:
// a display.
void InsertAndUpdateDisplayInfo(const DisplayInfo& new_info);
+ // Called when the display info is updated through InsertAndUpdateDisplayInfo.
+ void OnDisplayInfoUpdated(const DisplayInfo& display_info);
+
// Creates a display object from the DisplayInfo for |display_id|.
gfx::Display CreateDisplayFromDisplayInfoById(int64 display_id);