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