OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 EXTENSIONS_BROWSER_API_SYSTEM_DISPLAY_DISPLAY_INFO_PROVIDER_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_SYSTEM_DISPLAY_DISPLAY_INFO_PROVIDER_H_ |
6 #define EXTENSIONS_BROWSER_API_SYSTEM_DISPLAY_DISPLAY_INFO_PROVIDER_H_ | 6 #define EXTENSIONS_BROWSER_API_SYSTEM_DISPLAY_DISPLAY_INFO_PROVIDER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
13 | 13 |
14 namespace gfx { | 14 namespace gfx { |
15 class Display; | 15 class Display; |
16 class Screen; | 16 class Screen; |
17 } | 17 } |
18 | 18 |
19 namespace extensions { | 19 namespace extensions { |
20 | 20 |
21 namespace core_api { | 21 namespace api { |
22 namespace system_display { | 22 namespace system_display { |
23 struct DisplayProperties; | 23 struct DisplayProperties; |
24 struct DisplayUnitInfo; | 24 struct DisplayUnitInfo; |
25 } | 25 } |
26 } | 26 } |
27 | 27 |
28 typedef std::vector<linked_ptr<core_api::system_display::DisplayUnitInfo> > | 28 typedef std::vector<linked_ptr<api::system_display::DisplayUnitInfo>> |
29 DisplayInfo; | 29 DisplayInfo; |
30 | 30 |
31 class DisplayInfoProvider { | 31 class DisplayInfoProvider { |
32 public: | 32 public: |
33 virtual ~DisplayInfoProvider(); | 33 virtual ~DisplayInfoProvider(); |
34 | 34 |
35 // Returns a pointer to DisplayInfoProvider or NULL if Create() | 35 // Returns a pointer to DisplayInfoProvider or NULL if Create() |
36 // or InitializeForTesting() or not called yet. | 36 // or InitializeForTesting() or not called yet. |
37 static DisplayInfoProvider* Get(); | 37 static DisplayInfoProvider* Get(); |
38 | 38 |
39 // This is for tests that run in its own process (e.g. browser_tests). | 39 // This is for tests that run in its own process (e.g. browser_tests). |
40 // Using this in other tests (e.g. unit_tests) will result in DCHECK failure. | 40 // Using this in other tests (e.g. unit_tests) will result in DCHECK failure. |
41 static void InitializeForTesting(DisplayInfoProvider* display_info_provider); | 41 static void InitializeForTesting(DisplayInfoProvider* display_info_provider); |
42 | 42 |
43 // Updates the display with |display_id| according to |info|. Returns whether | 43 // Updates the display with |display_id| according to |info|. Returns whether |
44 // the display was successfully updated. On failure, no display parameters | 44 // the display was successfully updated. On failure, no display parameters |
45 // should be changed, and |error| should be set to the error string. | 45 // should be changed, and |error| should be set to the error string. |
46 virtual bool SetInfo(const std::string& display_id, | 46 virtual bool SetInfo(const std::string& display_id, |
47 const core_api::system_display::DisplayProperties& info, | 47 const api::system_display::DisplayProperties& info, |
48 std::string* error) = 0; | 48 std::string* error) = 0; |
49 | 49 |
50 // Get the screen that is always active, which will be used for monitoring | 50 // Get the screen that is always active, which will be used for monitoring |
51 // display changes events. | 51 // display changes events. |
52 virtual gfx::Screen* GetActiveScreen() = 0; | 52 virtual gfx::Screen* GetActiveScreen() = 0; |
53 | 53 |
54 DisplayInfo GetAllDisplaysInfo(); | 54 DisplayInfo GetAllDisplaysInfo(); |
55 | 55 |
56 protected: | 56 protected: |
57 DisplayInfoProvider(); | 57 DisplayInfoProvider(); |
58 | 58 |
59 private: | 59 private: |
60 static DisplayInfoProvider* Create(); | 60 static DisplayInfoProvider* Create(); |
61 | 61 |
62 // Update the content of the |unit| obtained for |display| using | 62 // Update the content of the |unit| obtained for |display| using |
63 // platform specific method. | 63 // platform specific method. |
64 virtual void UpdateDisplayUnitInfoForPlatform( | 64 virtual void UpdateDisplayUnitInfoForPlatform( |
65 const gfx::Display& display, | 65 const gfx::Display& display, |
66 core_api::system_display::DisplayUnitInfo* unit) = 0; | 66 api::system_display::DisplayUnitInfo* unit) = 0; |
67 | 67 |
68 DISALLOW_COPY_AND_ASSIGN(DisplayInfoProvider); | 68 DISALLOW_COPY_AND_ASSIGN(DisplayInfoProvider); |
69 }; | 69 }; |
70 | 70 |
71 } // namespace extensions | 71 } // namespace extensions |
72 | 72 |
73 #endif // EXTENSIONS_BROWSER_API_SYSTEM_DISPLAY_DISPLAY_INFO_PROVIDER_H_ | 73 #endif // EXTENSIONS_BROWSER_API_SYSTEM_DISPLAY_DISPLAY_INFO_PROVIDER_H_ |
OLD | NEW |