Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(728)

Side by Side Diff: ash/display/display_color_manager_chromeos.cc

Issue 2613493002: Fix namespace for src/ui/display/. (Closed)
Patch Set: Rebase. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "ash/display/display_color_manager_chromeos.h" 5 #include "ash/display/display_color_manager_chromeos.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 141 }
142 142
143 VLOG(1) << "ICC file successfully parsed"; 143 VLOG(1) << "ICC file successfully parsed";
144 qcms_profile_release(display_profile); 144 qcms_profile_release(display_profile);
145 return data; 145 return data;
146 } 146 }
147 147
148 } // namespace 148 } // namespace
149 149
150 DisplayColorManager::DisplayColorManager( 150 DisplayColorManager::DisplayColorManager(
151 ui::DisplayConfigurator* configurator, 151 display::DisplayConfigurator* configurator,
152 base::SequencedWorkerPool* blocking_pool) 152 base::SequencedWorkerPool* blocking_pool)
153 : configurator_(configurator), 153 : configurator_(configurator),
154 blocking_pool_(blocking_pool), 154 blocking_pool_(blocking_pool),
155 weak_ptr_factory_(this) { 155 weak_ptr_factory_(this) {
156 configurator_->AddObserver(this); 156 configurator_->AddObserver(this);
157 } 157 }
158 158
159 DisplayColorManager::~DisplayColorManager() { 159 DisplayColorManager::~DisplayColorManager() {
160 configurator_->RemoveObserver(this); 160 configurator_->RemoveObserver(this);
161 } 161 }
162 162
163 void DisplayColorManager::OnDisplayModeChanged( 163 void DisplayColorManager::OnDisplayModeChanged(
164 const ui::DisplayConfigurator::DisplayStateList& display_states) { 164 const display::DisplayConfigurator::DisplayStateList& display_states) {
165 for (const ui::DisplaySnapshot* state : display_states) { 165 for (const display::DisplaySnapshot* state : display_states) {
166 // Ensure we always reset the configuration before setting a new one. 166 // Ensure we always reset the configuration before setting a new one.
167 configurator_->SetColorCorrection( 167 configurator_->SetColorCorrection(
168 state->display_id(), std::vector<ui::GammaRampRGBEntry>(), 168 state->display_id(), std::vector<display::GammaRampRGBEntry>(),
169 std::vector<ui::GammaRampRGBEntry>(), std::vector<float>()); 169 std::vector<display::GammaRampRGBEntry>(), std::vector<float>());
170 170
171 if (calibration_map_[state->product_id()]) { 171 if (calibration_map_[state->product_id()]) {
172 ApplyDisplayColorCalibration(state->display_id(), state->product_id()); 172 ApplyDisplayColorCalibration(state->display_id(), state->product_id());
173 } else { 173 } else {
174 if (state->product_id() != ui::DisplaySnapshot::kInvalidProductID) 174 if (state->product_id() != display::DisplaySnapshot::kInvalidProductID)
175 LoadCalibrationForDisplay(state); 175 LoadCalibrationForDisplay(state);
176 } 176 }
177 } 177 }
178 } 178 }
179 179
180 void DisplayColorManager::ApplyDisplayColorCalibration(int64_t display_id, 180 void DisplayColorManager::ApplyDisplayColorCalibration(int64_t display_id,
181 int64_t product_id) { 181 int64_t product_id) {
182 if (calibration_map_.find(product_id) != calibration_map_.end()) { 182 if (calibration_map_.find(product_id) != calibration_map_.end()) {
183 ColorCalibrationData* data = calibration_map_[product_id].get(); 183 ColorCalibrationData* data = calibration_map_[product_id].get();
184 if (!configurator_->SetColorCorrection(display_id, data->degamma_lut, 184 if (!configurator_->SetColorCorrection(display_id, data->degamma_lut,
185 data->gamma_lut, 185 data->gamma_lut,
186 data->correction_matrix)) 186 data->correction_matrix))
187 LOG(WARNING) << "Error applying color correction data"; 187 LOG(WARNING) << "Error applying color correction data";
188 } 188 }
189 } 189 }
190 190
191 void DisplayColorManager::LoadCalibrationForDisplay( 191 void DisplayColorManager::LoadCalibrationForDisplay(
192 const ui::DisplaySnapshot* display) { 192 const display::DisplaySnapshot* display) {
193 DCHECK(thread_checker_.CalledOnValidThread()); 193 DCHECK(thread_checker_.CalledOnValidThread());
194 if (display->display_id() == display::kInvalidDisplayId) { 194 if (display->display_id() == display::kInvalidDisplayId) {
195 LOG(WARNING) << "Trying to load calibration data for invalid display id"; 195 LOG(WARNING) << "Trying to load calibration data for invalid display id";
196 return; 196 return;
197 } 197 }
198 198
199 quirks::QuirksManager::Get()->RequestIccProfilePath( 199 quirks::QuirksManager::Get()->RequestIccProfilePath(
200 display->product_id(), 200 display->product_id(),
201 base::Bind(&DisplayColorManager::FinishLoadCalibrationForDisplay, 201 base::Bind(&DisplayColorManager::FinishLoadCalibrationForDisplay,
202 weak_ptr_factory_.GetWeakPtr(), display->display_id(), 202 weak_ptr_factory_.GetWeakPtr(), display->display_id(),
203 display->product_id(), display->has_color_correction_matrix(), 203 display->product_id(), display->has_color_correction_matrix(),
204 display->type())); 204 display->type()));
205 } 205 }
206 206
207 void DisplayColorManager::FinishLoadCalibrationForDisplay( 207 void DisplayColorManager::FinishLoadCalibrationForDisplay(
208 int64_t display_id, 208 int64_t display_id,
209 int64_t product_id, 209 int64_t product_id,
210 bool has_color_correction_matrix, 210 bool has_color_correction_matrix,
211 ui::DisplayConnectionType type, 211 display::DisplayConnectionType type,
212 const base::FilePath& path, 212 const base::FilePath& path,
213 bool file_downloaded) { 213 bool file_downloaded) {
214 DCHECK(thread_checker_.CalledOnValidThread()); 214 DCHECK(thread_checker_.CalledOnValidThread());
215 std::string product_string = quirks::IdToHexString(product_id); 215 std::string product_string = quirks::IdToHexString(product_id);
216 if (path.empty()) { 216 if (path.empty()) {
217 VLOG(1) << "No ICC file found with product id: " << product_string 217 VLOG(1) << "No ICC file found with product id: " << product_string
218 << " for display id: " << display_id; 218 << " for display id: " << display_id;
219 return; 219 return;
220 } 220 }
221 221
222 if (file_downloaded && type == ui::DISPLAY_CONNECTION_TYPE_INTERNAL) { 222 if (file_downloaded && type == display::DISPLAY_CONNECTION_TYPE_INTERNAL) {
223 VLOG(1) << "Downloaded ICC file with product id: " << product_string 223 VLOG(1) << "Downloaded ICC file with product id: " << product_string
224 << " for internal display id: " << display_id 224 << " for internal display id: " << display_id
225 << ". Profile will be applied on next startup."; 225 << ". Profile will be applied on next startup.";
226 return; 226 return;
227 } 227 }
228 228
229 VLOG(1) << "Loading ICC file " << path.value() 229 VLOG(1) << "Loading ICC file " << path.value()
230 << " for display id: " << display_id 230 << " for display id: " << display_id
231 << " with product id: " << product_string; 231 << " with product id: " << product_string;
232 232
(...skipping 13 matching lines...) Expand all
246 calibration_map_[product_id] = std::move(data); 246 calibration_map_[product_id] = std::move(data);
247 ApplyDisplayColorCalibration(display_id, product_id); 247 ApplyDisplayColorCalibration(display_id, product_id);
248 } 248 }
249 } 249 }
250 250
251 DisplayColorManager::ColorCalibrationData::ColorCalibrationData() {} 251 DisplayColorManager::ColorCalibrationData::ColorCalibrationData() {}
252 252
253 DisplayColorManager::ColorCalibrationData::~ColorCalibrationData() {} 253 DisplayColorManager::ColorCalibrationData::~ColorCalibrationData() {}
254 254
255 } // namespace ash 255 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_color_manager_chromeos.h ('k') | ash/display/display_color_manager_chromeos_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698