Chromium Code Reviews| Index: ash/display/display_color_manager_chromeos.h |
| diff --git a/ash/display/display_color_manager_chromeos.h b/ash/display/display_color_manager_chromeos.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..744d779dca4370f6ac1c44f7fab0e2e5cf827748 |
| --- /dev/null |
| +++ b/ash/display/display_color_manager_chromeos.h |
| @@ -0,0 +1,62 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef ASH_DISPLAY_DISPLAY_COLOR_MANAGER_CHROMEOS_H_ |
| +#define ASH_DISPLAY_DISPLAY_COLOR_MANAGER_CHROMEOS_H_ |
| + |
| +#include <map> |
| +#include <vector> |
| + |
| +#include "ash/ash_export.h" |
| +#include "base/basictypes.h" |
| +#include "base/files/file_path.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "ui/display/chromeos/display_configurator.h" |
| +#include "ui/gfx/display.h" |
| +#include "ui/gfx/display_observer.h" |
| + |
| +namespace ash { |
| + |
| +// An object that observes changes in display configuration applies any color |
| +// calibration where needed. |
| +class ASH_EXPORT DisplayColorManager |
| + : public ui::DisplayConfigurator::Observer, |
| + public base::RefCountedThreadSafe<DisplayColorManager> { |
|
oshima
2015/04/15 23:56:13
RefCountedThreadSafe is for the special case, wher
|
| + public: |
| + DisplayColorManager(ui::DisplayConfigurator* configurator); |
| + |
| + // Overriden from ui::DisplayConfigurator::Observer: |
| + void OnDisplayModeChanged( |
| + const ui::DisplayConfigurator::DisplayStateList& outputs) override; |
| + void OnDisplayModeChangeFailed( |
| + const ui::DisplayConfigurator::DisplayStateList& displays, |
| + ui::MultipleDisplayState failed_new_state) override {} |
| + |
| + struct ColorCalibrationData { |
| + ColorCalibrationData(); |
| + ~ColorCalibrationData(); |
| + |
| + std::vector<uint16_t> r; |
| + std::vector<uint16_t> g; |
| + std::vector<uint16_t> b; |
| + }; |
| + |
| + private: |
| + friend class base::RefCountedThreadSafe<DisplayColorManager>; |
| + ~DisplayColorManager() override; |
| + void ApplyDisplayColorCalibration(uint64_t display_id); |
| + void LoadInternalFromCommandLine(); |
| + void LoadFromPath(const base::FilePath& path, uint64_t display_id); |
| + void UpdateCalibrationData( |
| + uint64_t display_id, |
| + scoped_ptr<DisplayColorManager::ColorCalibrationData> data); |
| + |
| + ui::DisplayConfigurator* configurator_; |
| + std::map<uint64_t, ColorCalibrationData*> calibration_map_; |
| + DISALLOW_COPY_AND_ASSIGN(DisplayColorManager); |
| +}; |
| + |
| +} // namespace ash |
| + |
| +#endif // ASH_DISPLAY_DISPLAY_COLOR_MANAGER_CHROMEOS_H_ |