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

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: tweaks conditional compile conditions 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 bool OutputConfigurator::QueryOutputProtectionStatus(
238 const chrome::PepperOutputProtectionHost* client,
239 uint32_t* link_mask,
240 uint32_t* protection_mask) {
241 if (!configure_display_)
242 return false;
243
244 delegate_->GrabServer();
245 bool result = delegate_->QueryOutputProtectionStatus(client, link_mask,
246 protection_mask);
247 delegate_->UngrabServer();
248 return result;
249 }
250
251 bool OutputConfigurator::EnableOutputProtection(
252 const chrome::PepperOutputProtectionHost* client,
253 uint32_t desired_method_mask) {
254 if (!configure_display_)
255 return false;
256
257 delegate_->GrabServer();
258 bool result = delegate_->EnableOutputProtection(client, desired_method_mask);
259 delegate_->UngrabServer();
260 return result;
261 }
262
237 void OutputConfigurator::Stop() { 263 void OutputConfigurator::Stop() {
238 configure_display_ = false; 264 configure_display_ = false;
239 } 265 }
240 266
241 bool OutputConfigurator::SetDisplayPower(DisplayPowerState power_state, 267 bool OutputConfigurator::SetDisplayPower(DisplayPowerState power_state,
242 int flags) { 268 int flags) {
243 if (!configure_display_) 269 if (!configure_display_)
244 return false; 270 return false;
245 271
246 VLOG(1) << "SetDisplayPower: power_state=" 272 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) / 725 float width_ratio = static_cast<float>(mirror_mode_info->width) /
700 static_cast<float>(native_mode_info->width); 726 static_cast<float>(native_mode_info->width);
701 float height_ratio = static_cast<float>(mirror_mode_info->height) / 727 float height_ratio = static_cast<float>(mirror_mode_info->height) /
702 static_cast<float>(native_mode_info->height); 728 static_cast<float>(native_mode_info->height);
703 729
704 area_ratio = width_ratio * height_ratio; 730 area_ratio = width_ratio * height_ratio;
705 return area_ratio; 731 return area_ratio;
706 } 732 }
707 733
708 } // namespace chromeos 734 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698