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

Side by Side Diff: chromeos/display/output_configurator.cc

Issue 24039002: Pepper API implementation for output protection. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: revise init & terminate of PepperOutputProtectionMessageFilter Created 7 years, 3 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chromeos/display/output_configurator.h" 5 #include "chromeos/display/output_configurator.h"
6 6
7 #include <X11/Xlib.h> 7 #include <X11/Xlib.h>
8 #include <X11/extensions/Xrandr.h> 8 #include <X11/extensions/Xrandr.h>
9 #include <X11/extensions/XInput2.h> 9 #include <X11/extensions/XInput2.h>
10 10
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 new_state, power_state_, outputs); 227 new_state, power_state_, outputs);
228 228
229 // Force the DPMS on chrome startup as the driver doesn't always detect 229 // Force the DPMS on chrome startup as the driver doesn't always detect
230 // that all displays are on when signing out. 230 // that all displays are on when signing out.
231 delegate_->ForceDPMSOn(); 231 delegate_->ForceDPMSOn();
232 delegate_->UngrabServer(); 232 delegate_->UngrabServer();
233 delegate_->SendProjectingStateToPowerManager(IsProjecting(outputs)); 233 delegate_->SendProjectingStateToPowerManager(IsProjecting(outputs));
234 NotifyObservers(success, new_state); 234 NotifyObservers(success, new_state);
235 } 235 }
236 236
237 uint64_t OutputConfigurator::RegisterOutputProtectionClient() {
238 if (!configure_display_)
239 return 0;
240
241 return delegate_->RegisterOutputProtectionClient();
242 }
243
244 void OutputConfigurator::UnregisterOutputProtectionClient(uint64_t client_id) {
245 if (!configure_display_)
246 return;
247
248 delegate_->GrabServer();
249 delegate_->UnregisterOutputProtectionClient(client_id);
250 delegate_->UngrabServer();
251 }
252
253 bool OutputConfigurator::QueryOutputProtectionStatus(
254 uint64_t client_id,
255 uint32_t* link_mask,
256 uint32_t* protection_mask) {
257 if (!configure_display_)
258 return false;
259
260 delegate_->GrabServer();
Daniel Erat 2013/09/18 22:39:16 the delegate isn't checking these server grabs. ar
marcheu 2013/09/18 23:21:35 Yup this grab isn't strictly required, as we are j
kcwu 2013/09/20 03:03:47 Done.
261 bool result = delegate_->QueryOutputProtectionStatus(client_id, link_mask,
262 protection_mask);
263 delegate_->UngrabServer();
264 return result;
265 }
266
267 bool OutputConfigurator::EnableOutputProtection(
268 uint64_t client_id,
269 uint32_t desired_method_mask) {
270 if (!configure_display_)
271 return false;
272
273 delegate_->GrabServer();
274 bool result = delegate_->EnableOutputProtection(client_id,
275 desired_method_mask);
276 delegate_->UngrabServer();
277 return result;
278 }
279
237 void OutputConfigurator::Stop() { 280 void OutputConfigurator::Stop() {
238 configure_display_ = false; 281 configure_display_ = false;
239 } 282 }
240 283
241 bool OutputConfigurator::SetDisplayPower(DisplayPowerState power_state, 284 bool OutputConfigurator::SetDisplayPower(DisplayPowerState power_state,
242 int flags) { 285 int flags) {
243 if (!configure_display_) 286 if (!configure_display_)
244 return false; 287 return false;
245 288
246 VLOG(1) << "SetDisplayPower: power_state=" 289 VLOG(1) << "SetDisplayPower: power_state="
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 float width_ratio = static_cast<float>(mirror_mode_info->width) / 742 float width_ratio = static_cast<float>(mirror_mode_info->width) /
700 static_cast<float>(native_mode_info->width); 743 static_cast<float>(native_mode_info->width);
701 float height_ratio = static_cast<float>(mirror_mode_info->height) / 744 float height_ratio = static_cast<float>(mirror_mode_info->height) /
702 static_cast<float>(native_mode_info->height); 745 static_cast<float>(native_mode_info->height);
703 746
704 area_ratio = width_ratio * height_ratio; 747 area_ratio = width_ratio * height_ratio;
705 return area_ratio; 748 return area_ratio;
706 } 749 }
707 750
708 } // namespace chromeos 751 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698