Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ASH_DISPLAY_DISPLAY_COLOR_MANAGER_CHROMEOS_H_ | 5 #ifndef ASH_DISPLAY_DISPLAY_COLOR_MANAGER_CHROMEOS_H_ |
| 6 #define ASH_DISPLAY_DISPLAY_COLOR_MANAGER_CHROMEOS_H_ | 6 #define ASH_DISPLAY_DISPLAY_COLOR_MANAGER_CHROMEOS_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "ash/ash_export.h" | 13 #include "ash/ash_export.h" |
| 14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "ui/display/chromeos/display_configurator.h" | 17 #include "ui/display/chromeos/display_configurator.h" |
| 18 #include "ui/gfx/display.h" | 18 #include "ui/display/types/display_constants.h" |
| 19 #include "ui/gfx/display_observer.h" | |
| 20 | 19 |
| 21 namespace base { | 20 namespace base { |
| 22 class SequencedWorkerPool; | 21 class SequencedWorkerPool; |
| 23 } | 22 } |
| 24 | 23 |
| 25 namespace ui { | 24 namespace ui { |
| 25 class DisplaySnapshot; | |
| 26 struct GammaRampRGBEntry; | 26 struct GammaRampRGBEntry; |
| 27 } // namespace ui | 27 } // namespace ui |
| 28 | 28 |
| 29 namespace ash { | 29 namespace ash { |
| 30 | 30 |
| 31 // An object that observes changes in display configuration applies any color | 31 // An object that observes changes in display configuration applies any color |
| 32 // calibration where needed. | 32 // calibration where needed. |
| 33 class ASH_EXPORT DisplayColorManager | 33 class ASH_EXPORT DisplayColorManager |
| 34 : public ui::DisplayConfigurator::Observer, | 34 : public ui::DisplayConfigurator::Observer { |
| 35 public base::SupportsWeakPtr<DisplayColorManager> { | |
| 36 public: | 35 public: |
| 37 DisplayColorManager(ui::DisplayConfigurator* configurator, | 36 DisplayColorManager(ui::DisplayConfigurator* configurator, |
| 38 base::SequencedWorkerPool* blocking_pool); | 37 base::SequencedWorkerPool* blocking_pool); |
| 39 ~DisplayColorManager() override; | 38 ~DisplayColorManager() override; |
| 40 | 39 |
| 41 // ui::DisplayConfigurator::Observer | 40 // ui::DisplayConfigurator::Observer |
| 42 void OnDisplayModeChanged( | 41 void OnDisplayModeChanged( |
| 43 const ui::DisplayConfigurator::DisplayStateList& outputs) override; | 42 const ui::DisplayConfigurator::DisplayStateList& outputs) override; |
| 44 void OnDisplayModeChangeFailed( | 43 void OnDisplayModeChangeFailed( |
| 45 const ui::DisplayConfigurator::DisplayStateList& displays, | 44 const ui::DisplayConfigurator::DisplayStateList& displays, |
| 46 ui::MultipleDisplayState failed_new_state) override {} | 45 ui::MultipleDisplayState failed_new_state) override {} |
| 47 | 46 |
| 48 struct ColorCalibrationData { | 47 struct ColorCalibrationData { |
| 49 ColorCalibrationData(); | 48 ColorCalibrationData(); |
| 50 ~ColorCalibrationData(); | 49 ~ColorCalibrationData(); |
| 51 | 50 |
| 52 std::vector<ui::GammaRampRGBEntry> lut; | 51 std::vector<ui::GammaRampRGBEntry> lut; |
| 53 }; | 52 }; |
| 54 | 53 |
| 54 protected: | |
| 55 virtual void FinishLoadCalibrationForDisplay(int64_t display_id, | |
| 56 int64_t product_id, | |
| 57 ui::DisplayConnectionType type, | |
| 58 const base::FilePath& path, | |
| 59 bool file_downloaded); | |
| 60 virtual void UpdateCalibrationData(int64_t display_id, | |
| 61 int64_t product_id, | |
| 62 scoped_ptr<ColorCalibrationData> data); | |
|
oshima
2016/03/22 20:27:21
why virtual?
Greg Levin
2016/03/23 00:16:18
The DCM unit test needs to add some code to these
oshima
2016/03/23 09:06:48
It looks to me that you can simply wait until the
Greg Levin
2016/03/23 16:09:19
I may be misremembering, but I seem to recall Quit
oshima
2016/03/23 17:10:45
You're right. I misread the code. Please disregard
| |
| 63 | |
| 55 private: | 64 private: |
| 56 void ApplyDisplayColorCalibration(int64_t display_id, int64_t product_id); | 65 void ApplyDisplayColorCalibration(int64_t display_id, int64_t product_id); |
| 57 void LoadCalibrationForDisplay(const ui::DisplaySnapshot* display); | 66 void LoadCalibrationForDisplay(const ui::DisplaySnapshot* display); |
| 58 void UpdateCalibrationData( | |
| 59 int64_t display_id, | |
| 60 int64_t product_id, | |
| 61 scoped_ptr<DisplayColorManager::ColorCalibrationData> data, | |
| 62 bool success); | |
| 63 | 67 |
| 64 ui::DisplayConfigurator* configurator_; | 68 ui::DisplayConfigurator* configurator_; |
| 65 std::map<int64_t, ColorCalibrationData*> calibration_map_; | 69 std::map<int64_t, ColorCalibrationData*> calibration_map_; |
| 66 base::SequencedWorkerPool* blocking_pool_; | 70 base::SequencedWorkerPool* blocking_pool_; |
| 67 | 71 |
| 72 // Factory for callbacks. | |
| 73 base::WeakPtrFactory<DisplayColorManager> weak_ptr_factory_; | |
| 74 | |
| 68 DISALLOW_COPY_AND_ASSIGN(DisplayColorManager); | 75 DISALLOW_COPY_AND_ASSIGN(DisplayColorManager); |
| 69 }; | 76 }; |
| 70 | 77 |
| 71 } // namespace ash | 78 } // namespace ash |
| 72 | 79 |
| 73 #endif // ASH_DISPLAY_DISPLAY_COLOR_MANAGER_CHROMEOS_H_ | 80 #endif // ASH_DISPLAY_DISPLAY_COLOR_MANAGER_CHROMEOS_H_ |
| OLD | NEW |