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

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

Issue 24039002: Pepper API implementation for output protection. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: avoid PostTask methods in dtor 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 #ifndef CHROMEOS_DISPLAY_OUTPUT_CONFIGURATOR_H_ 5 #ifndef CHROMEOS_DISPLAY_OUTPUT_CONFIGURATOR_H_
6 #define CHROMEOS_DISPLAY_OUTPUT_CONFIGURATOR_H_ 6 #define CHROMEOS_DISPLAY_OUTPUT_CONFIGURATOR_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/event_types.h" 13 #include "base/event_types.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
16 #include "base/observer_list.h" 16 #include "base/observer_list.h"
17 #include "base/timer/timer.h" 17 #include "base/timer/timer.h"
18 #include "chromeos/chromeos_export.h" 18 #include "chromeos/chromeos_export.h"
19 #include "third_party/cros_system_api/dbus/service_constants.h" 19 #include "third_party/cros_system_api/dbus/service_constants.h"
20 20
21 // Forward declarations for Xlib and Xrandr. 21 // Forward declarations for Xlib and Xrandr.
22 // This is so unused X definitions don't pollute the namespace. 22 // This is so unused X definitions don't pollute the namespace.
23 typedef unsigned long XID; 23 typedef unsigned long XID;
24 typedef XID RROutput; 24 typedef XID RROutput;
25 typedef XID RRCrtc; 25 typedef XID RRCrtc;
26 typedef XID RRMode; 26 typedef XID RRMode;
27 27
28 namespace chrome {
29 class PepperOutputProtectionHost;
30 } // namespace chrome
31
28 namespace chromeos { 32 namespace chromeos {
29 33
30 // Used to describe the state of a multi-display configuration. 34 // Used to describe the state of a multi-display configuration.
31 enum OutputState { 35 enum OutputState {
32 STATE_INVALID, 36 STATE_INVALID,
33 STATE_HEADLESS, 37 STATE_HEADLESS,
34 STATE_SINGLE, 38 STATE_SINGLE,
35 STATE_DUAL_MIRROR, 39 STATE_DUAL_MIRROR,
36 STATE_DUAL_EXTENDED, 40 STATE_DUAL_EXTENDED,
37 }; 41 };
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 // |touch_device_id| the ID of the touchscreen device to configure. 215 // |touch_device_id| the ID of the touchscreen device to configure.
212 // |ctm| contains the desired transformation parameters. The offsets 216 // |ctm| contains the desired transformation parameters. The offsets
213 // in it should be normalized so that 1 corresponds to the X or Y axis 217 // in it should be normalized so that 1 corresponds to the X or Y axis
214 // size for the corresponding offset. 218 // size for the corresponding offset.
215 virtual void ConfigureCTM(int touch_device_id, 219 virtual void ConfigureCTM(int touch_device_id,
216 const CoordinateTransformation& ctm) = 0; 220 const CoordinateTransformation& ctm) = 0;
217 221
218 // Sends a D-Bus message to the power manager telling it that the 222 // Sends a D-Bus message to the power manager telling it that the
219 // machine is or is not projecting. 223 // machine is or is not projecting.
220 virtual void SendProjectingStateToPowerManager(bool projecting) = 0; 224 virtual void SendProjectingStateToPowerManager(bool projecting) = 0;
225
226 // Query link status and protection status. Returns true on success.
227 virtual bool QueryOutputProtectionStatus(
228 chrome::PepperOutputProtectionHost* client,
229 uint32_t* link_mask,
230 uint32_t* protection_mask) = 0;
231
232 // Set desired protection methods. Returns true when the protection request
233 // has been made.
234 virtual bool EnableOutputProtection(
235 chrome::PepperOutputProtectionHost* client,
236 uint32_t desired_method_mask) = 0;
221 }; 237 };
222 238
223 // Helper class used by tests. 239 // Helper class used by tests.
224 class TestApi { 240 class TestApi {
225 public: 241 public:
226 TestApi(OutputConfigurator* configurator, int xrandr_event_base) 242 TestApi(OutputConfigurator* configurator, int xrandr_event_base)
227 : configurator_(configurator), 243 : configurator_(configurator),
228 xrandr_event_base_(xrandr_event_base) {} 244 xrandr_event_base_(xrandr_event_base) {}
229 ~TestApi() {} 245 ~TestApi() {}
230 246
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 void ResumeDisplays(); 357 void ResumeDisplays();
342 358
343 const std::map<int, float>& GetMirroredDisplayAreaRatioMap() { 359 const std::map<int, float>& GetMirroredDisplayAreaRatioMap() {
344 return mirrored_display_area_ratio_map_; 360 return mirrored_display_area_ratio_map_;
345 } 361 }
346 362
347 // Configure outputs with |kConfigureDelayMs| delay, 363 // Configure outputs with |kConfigureDelayMs| delay,
348 // so that time-consuming ConfigureOutputs() won't be called multiple times. 364 // so that time-consuming ConfigureOutputs() won't be called multiple times.
349 void ScheduleConfigureOutputs(); 365 void ScheduleConfigureOutputs();
350 366
367 // Query link status and protection status.
368 // |link_mask| is the type of connected output links, which is a bit-mask
369 // of PP_OutputProtectionLinkType_Private values. |protection_mask| is the
370 // desired protection methods, which is a bit-mask of the
371 // PP_OutputProtectionMethod_Private values.
372 // Returns true on success.
373 virtual bool QueryOutputProtectionStatus(
374 chrome::PepperOutputProtectionHost* client,
dmichael (off chromium) 2013/09/09 20:37:15 should this be const? Same question for |client| i
kcwu 2013/09/10 12:50:21 Done.
375 uint32_t* link_mask,
376 uint32_t* protection_mask);
377
378 // Set desired protection methods.
379 // |protection_mask| is the desired protection methods, which is a bit-mask
380 // of the PP_OutputProtectionMethod_Private values.
381 // Returns true when the protection request has been made.
382 virtual bool EnableOutputProtection(
383 chrome::PepperOutputProtectionHost* client,
384 uint32_t desired_method_mask);
385
351 private: 386 private:
352 // Configure outputs. 387 // Configure outputs.
353 void ConfigureOutputs(); 388 void ConfigureOutputs();
354 389
355 // Notifies observers about an attempted state change. 390 // Notifies observers about an attempted state change.
356 void NotifyObservers(bool success, OutputState attempted_state); 391 void NotifyObservers(bool success, OutputState attempted_state);
357 392
358 // Switches to the state specified in |output_state| and |power_state|. 393 // Switches to the state specified in |output_state| and |power_state|.
359 // If the hardware mirroring failed and |mirroring_controller_| is set, 394 // If the hardware mirroring failed and |mirroring_controller_| is set,
360 // it switches to |STATE_DUAL_EXTENDED| and calls |SetSoftwareMirroring()| 395 // it switches to |STATE_DUAL_EXTENDED| and calls |SetSoftwareMirroring()|
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 scoped_ptr<base::OneShotTimer<OutputConfigurator> > configure_timer_; 464 scoped_ptr<base::OneShotTimer<OutputConfigurator> > configure_timer_;
430 465
431 DISALLOW_COPY_AND_ASSIGN(OutputConfigurator); 466 DISALLOW_COPY_AND_ASSIGN(OutputConfigurator);
432 }; 467 };
433 468
434 typedef std::vector<OutputConfigurator::OutputSnapshot> OutputSnapshotList; 469 typedef std::vector<OutputConfigurator::OutputSnapshot> OutputSnapshotList;
435 470
436 } // namespace chromeos 471 } // namespace chromeos
437 472
438 #endif // CHROMEOS_DISPLAY_OUTPUT_CONFIGURATOR_H_ 473 #endif // CHROMEOS_DISPLAY_OUTPUT_CONFIGURATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698