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

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: add test 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 return delegate_->RegisterOutputProtectionClient();
239 }
240
241 void OutputConfigurator::UnregisterOutputProtectionClient(uint64_t client_id) {
242 delegate_->GrabServer();
243 delegate_->UnregisterOutputProtectionClient(client_id);
244 delegate_->UngrabServer();
245 }
246
247 bool OutputConfigurator::QueryOutputProtectionStatus(
248 uint64_t client_id,
249 uint32_t* link_mask,
250 uint32_t* protection_mask) {
251 if (!configure_display_)
252 return false;
253
254 delegate_->GrabServer();
255 bool result = delegate_->QueryOutputProtectionStatus(client_id, link_mask,
256 protection_mask);
257 delegate_->UngrabServer();
258 return result;
259 }
260
261 bool OutputConfigurator::EnableOutputProtection(
262 uint64_t client_id,
263 uint32_t desired_method_mask) {
264 if (!configure_display_)
265 return false;
266
267 delegate_->GrabServer();
268 bool result = delegate_->EnableOutputProtection(client_id,
269 desired_method_mask);
270 delegate_->UngrabServer();
271 return result;
272 }
273
237 void OutputConfigurator::Stop() { 274 void OutputConfigurator::Stop() {
238 configure_display_ = false; 275 configure_display_ = false;
239 } 276 }
240 277
241 bool OutputConfigurator::SetDisplayPower(DisplayPowerState power_state, 278 bool OutputConfigurator::SetDisplayPower(DisplayPowerState power_state,
242 int flags) { 279 int flags) {
243 if (!configure_display_) 280 if (!configure_display_)
244 return false; 281 return false;
245 282
246 VLOG(1) << "SetDisplayPower: power_state=" 283 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) / 736 float width_ratio = static_cast<float>(mirror_mode_info->width) /
700 static_cast<float>(native_mode_info->width); 737 static_cast<float>(native_mode_info->width);
701 float height_ratio = static_cast<float>(mirror_mode_info->height) / 738 float height_ratio = static_cast<float>(mirror_mode_info->height) /
702 static_cast<float>(native_mode_info->height); 739 static_cast<float>(native_mode_info->height);
703 740
704 area_ratio = width_ratio * height_ratio; 741 area_ratio = width_ratio * height_ratio;
705 return area_ratio; 742 return area_ratio;
706 } 743 }
707 744
708 } // namespace chromeos 745 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698