| OLD | NEW |
| 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 CHROME_BROWSER_EXTENSIONS_API_SYSTEM_INFO_DISPLAY_DISPLAY_INFO_PROVIDER_
H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_SYSTEM_INFO_DISPLAY_DISPLAY_INFO_PROVIDER_
H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_SYSTEM_INFO_DISPLAY_DISPLAY_INFO_PROVIDER_
H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_SYSTEM_INFO_DISPLAY_DISPLAY_INFO_PROVIDER_
H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "chrome/browser/extensions/api/system_info/system_info_provider.h" | 10 #include "chrome/browser/extensions/api/system_info/system_info_provider.h" |
| 11 #include "chrome/common/extensions/api/system_info_display.h" | 11 #include "chrome/common/extensions/api/system_info_display.h" |
| 12 | 12 |
| 13 namespace extensions { | 13 namespace extensions { |
| 14 | 14 |
| 15 typedef std::vector<linked_ptr< | 15 typedef std::vector<linked_ptr< |
| 16 api::system_info_display::DisplayUnitInfo> > DisplayInfo; | 16 api::system_info_display::DisplayUnitInfo> > DisplayInfo; |
| 17 | 17 |
| 18 class DisplayInfoProvider : public SystemInfoProvider<DisplayInfo> { | 18 class DisplayInfoProvider : public SystemInfoProvider<DisplayInfo> { |
| 19 public: | 19 public: |
| 20 typedef base::Callback<void(const DisplayInfo& info, bool success)> | 20 typedef base::Callback<void(bool success)> |
| 21 RequestInfoCallback; | 21 RequestInfoCallback; |
| 22 typedef base::Callback<void(bool success, const std::string& error)> | 22 typedef base::Callback<void(bool success, const std::string& error)> |
| 23 SetInfoCallback; | 23 SetInfoCallback; |
| 24 | 24 |
| 25 // Gets a DisplayInfoProvider instance. | 25 // Gets a DisplayInfoProvider instance. |
| 26 static DisplayInfoProvider* GetProvider(); | 26 static DisplayInfoProvider* GetProvider(); |
| 27 | 27 |
| 28 // Starts request for the display info, redirecting the request to a worker | 28 // Starts request for the display info, redirecting the request to a worker |
| 29 // thread if needed (using SystemInfoProvider<DisplayInfo>::StartQuery()). | 29 // thread if needed (using SystemInfoProvider<DisplayInfo>::StartQuery()). |
| 30 // The callback will be called asynchronously. | 30 // The callback will be called asynchronously. |
| 31 // The implementation is platform specific. | 31 // The implementation is platform specific. |
| 32 void RequestInfo(const RequestInfoCallback& callback); | 32 void RequestInfo(const RequestInfoCallback& callback); |
| 33 | 33 |
| 34 // Updates the display parameters for a display with the provided id. | 34 // Updates the display parameters for a display with the provided id. |
| 35 // The parameters are updated according to content of |info|. After the | 35 // The parameters are updated according to content of |info|. After the |
| 36 // display is updated, callback is called with the success status, and error | 36 // display is updated, callback is called with the success status, and error |
| 37 // message. If the method succeeds, the error message is empty. | 37 // message. If the method succeeds, the error message is empty. |
| 38 // The callback will be called asynchronously. | 38 // The callback will be called asynchronously. |
| 39 // This functionality is exposed only on ChromeOS. | 39 // This functionality is exposed only on ChromeOS. |
| 40 virtual void SetInfo( | 40 virtual void SetInfo( |
| 41 const std::string& display_id, | 41 const std::string& display_id, |
| 42 const api::system_info_display::DisplayProperties& info, | 42 const api::system_info_display::DisplayProperties& info, |
| 43 const SetInfoCallback& callback); | 43 const SetInfoCallback& callback); |
| 44 | 44 |
| 45 const DisplayInfo& display_info() const; |
| 46 |
| 45 protected: | 47 protected: |
| 46 // Overriden from SystemInfoProvider<DisplayInfo>. | 48 // Overriden from SystemInfoProvider<DisplayInfo>. |
| 47 // The implementation is platform specific. | 49 // The implementation is platform specific. |
| 48 virtual bool QueryInfo(DisplayInfo* info) OVERRIDE; | 50 virtual bool QueryInfo() OVERRIDE; |
| 49 | 51 |
| 50 friend class SystemInfoProvider<DisplayInfo>; | 52 friend class SystemInfoProvider<DisplayInfo>; |
| 51 | 53 |
| 52 DisplayInfoProvider() {} | 54 DisplayInfoProvider() {} |
| 53 virtual ~DisplayInfoProvider() {} | 55 virtual ~DisplayInfoProvider() {} |
| 54 | 56 |
| 55 DISALLOW_COPY_AND_ASSIGN(DisplayInfoProvider); | 57 DISALLOW_COPY_AND_ASSIGN(DisplayInfoProvider); |
| 56 }; | 58 }; |
| 57 | 59 |
| 58 } // namespace extensions | 60 } // namespace extensions |
| 59 | 61 |
| 60 #endif // CHROME_BROWSER_EXTENSIONS_API_SYSTEM_INFO_DISPLAY_DISPLAY_INFO_PROVID
ER_H_ | 62 #endif // CHROME_BROWSER_EXTENSIONS_API_SYSTEM_INFO_DISPLAY_DISPLAY_INFO_PROVID
ER_H_ |
| OLD | NEW |