Index: ash/content/display/display_color_manager_chromeos.cc |
diff --git a/ash/content/display/display_color_manager_chromeos.cc b/ash/content/display/display_color_manager_chromeos.cc |
index 0d7252f87399c8726e09611d5804a9d30233e9a1..45a015808971b3cd7882a9a27334f67e37a21709 100644 |
--- a/ash/content/display/display_color_manager_chromeos.cc |
+++ b/ash/content/display/display_color_manager_chromeos.cc |
@@ -8,7 +8,12 @@ |
#include "base/bind_helpers.h" |
#include "base/command_line.h" |
#include "base/files/file_path.h" |
+#include "base/format_macros.h" |
#include "base/logging.h" |
+#include "base/path_service.h" |
+#include "base/path_service.h" |
oshima
2015/05/14 00:06:11
remove dup.
robert.bradford
2015/05/14 17:55:38
Done.
|
+#include "base/strings/stringprintf.h" |
+#include "chromeos/chromeos_paths.h" |
#include "chromeos/chromeos_switches.h" |
#include "content/public/browser/browser_thread.h" |
#include "third_party/qcms/src/qcms.h" |
@@ -58,6 +63,15 @@ bool ParseFile(const base::FilePath& path, |
return true; |
} |
+base::FilePath PathForDisplaySnapshot(const ui::DisplaySnapshot* snapshot) { |
+ base::FilePath path; |
+ CHECK( |
+ PathService::Get(chromeos::DIR_DEVICE_COLOR_CALIBRATION_PROFILES, &path)); |
+ path = path.Append( |
+ base::StringPrintf("%08" PRIx64 ".icc", snapshot->product_id())); |
+ return path; |
+} |
+ |
} // namespace |
DisplayColorManager::DisplayColorManager(ui::DisplayConfigurator* configurator) |
@@ -77,8 +91,18 @@ DisplayColorManager::~DisplayColorManager() { |
void DisplayColorManager::OnDisplayModeChanged( |
const ui::DisplayConfigurator::DisplayStateList& display_states) { |
- for (const ui::DisplaySnapshot* state : display_states) |
- ApplyDisplayColorCalibration(state->display_id()); |
+ for (const ui::DisplaySnapshot* state : display_states) { |
+ if (calibration_map_[state->display_id()]) { |
oshima
2015/05/14 00:06:11
shouldn't we cache the value per product id instea
robert.bradford
2015/05/14 17:55:38
Done. But this resulted in a refactor of the way t
|
+ ApplyDisplayColorCalibration(state->display_id()); |
+ } else { |
+ if (state->product_id() != ui::DisplaySnapshot::kInvalidProductID) { |
+ base::FilePath path = PathForDisplaySnapshot(state); |
+ VLOG(1) << "Loading ICC file " << path.value() |
+ << " for display id: " << state->display_id(); |
+ LoadCalibrationForDisplay(state->display_id(), path); |
+ } |
+ } |
+ } |
} |
void DisplayColorManager::ApplyDisplayColorCalibration(uint64_t display_id) { |
@@ -127,6 +151,7 @@ void DisplayColorManager::UpdateCalibrationData( |
if (success) { |
// The map takes over ownership of the underlying memory. |
calibration_map_[display_id] = data.release(); |
+ ApplyDisplayColorCalibration(display_id); |
} |
} |