Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef ASH_DISPLAY_DISPLAY_COLOR_MANAGER_CHROMEOS_H_ | |
| 6 #define ASH_DISPLAY_DISPLAY_COLOR_MANAGER_CHROMEOS_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "ash/ash_export.h" | |
| 12 #include "base/basictypes.h" | |
| 13 #include "base/files/file_path.h" | |
| 14 #include "base/memory/ref_counted.h" | |
| 15 #include "ui/display/chromeos/display_configurator.h" | |
| 16 #include "ui/gfx/display.h" | |
| 17 #include "ui/gfx/display_observer.h" | |
| 18 | |
| 19 namespace ash { | |
| 20 | |
| 21 // An object that observes changes in display configuration applies any color | |
| 22 // calibration where needed. | |
| 23 class ASH_EXPORT DisplayColorManager | |
| 24 : public ui::DisplayConfigurator::Observer, | |
| 25 public base::RefCountedThreadSafe<DisplayColorManager> { | |
|
oshima
2015/04/15 23:56:13
RefCountedThreadSafe is for the special case, wher
| |
| 26 public: | |
| 27 DisplayColorManager(ui::DisplayConfigurator* configurator); | |
| 28 | |
| 29 // Overriden from ui::DisplayConfigurator::Observer: | |
| 30 void OnDisplayModeChanged( | |
| 31 const ui::DisplayConfigurator::DisplayStateList& outputs) override; | |
| 32 void OnDisplayModeChangeFailed( | |
| 33 const ui::DisplayConfigurator::DisplayStateList& displays, | |
| 34 ui::MultipleDisplayState failed_new_state) override {} | |
| 35 | |
| 36 struct ColorCalibrationData { | |
| 37 ColorCalibrationData(); | |
| 38 ~ColorCalibrationData(); | |
| 39 | |
| 40 std::vector<uint16_t> r; | |
| 41 std::vector<uint16_t> g; | |
| 42 std::vector<uint16_t> b; | |
| 43 }; | |
| 44 | |
| 45 private: | |
| 46 friend class base::RefCountedThreadSafe<DisplayColorManager>; | |
| 47 ~DisplayColorManager() override; | |
| 48 void ApplyDisplayColorCalibration(uint64_t display_id); | |
| 49 void LoadInternalFromCommandLine(); | |
| 50 void LoadFromPath(const base::FilePath& path, uint64_t display_id); | |
| 51 void UpdateCalibrationData( | |
| 52 uint64_t display_id, | |
| 53 scoped_ptr<DisplayColorManager::ColorCalibrationData> data); | |
| 54 | |
| 55 ui::DisplayConfigurator* configurator_; | |
| 56 std::map<uint64_t, ColorCalibrationData*> calibration_map_; | |
| 57 DISALLOW_COPY_AND_ASSIGN(DisplayColorManager); | |
| 58 }; | |
| 59 | |
| 60 } // namespace ash | |
| 61 | |
| 62 #endif // ASH_DISPLAY_DISPLAY_COLOR_MANAGER_CHROMEOS_H_ | |
| OLD | NEW |