| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_UI_WEBUI_OPTIONS_CHROMEOS_ABOUT_PAGE_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_ABOUT_PAGE_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_ABOUT_PAGE_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_ABOUT_PAGE_HANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "chrome/browser/ui/webui/options/options_ui.h" | 10 #include "chrome/browser/ui/webui/options/options_ui.h" |
| 11 | 11 |
| 12 #include "chrome/browser/ui/webui/options/chromeos/cros_options_page_ui_handler.
h" | 12 #include "chrome/browser/ui/webui/options/chromeos/cros_options_page_ui_handler.
h" |
| 13 #include "chrome/browser/chromeos/cros/update_library.h" | 13 #include "chrome/browser/chromeos/dbus/update_engine_client.h" |
| 14 #include "chrome/browser/chromeos/version_loader.h" | 14 #include "chrome/browser/chromeos/version_loader.h" |
| 15 | 15 |
| 16 namespace chromeos { | 16 namespace chromeos { |
| 17 | 17 |
| 18 // ChromeOS about page UI handler. | 18 // ChromeOS about page UI handler. |
| 19 class AboutPageHandler : public CrosOptionsPageUIHandler { | 19 class AboutPageHandler : public CrosOptionsPageUIHandler { |
| 20 | 20 |
| 21 public: | 21 public: |
| 22 AboutPageHandler(); | 22 AboutPageHandler(); |
| 23 virtual ~AboutPageHandler(); | 23 virtual ~AboutPageHandler(); |
| 24 | 24 |
| 25 // OptionsPageUIHandler implementation. | 25 // OptionsPageUIHandler implementation. |
| 26 virtual void GetLocalizedValues(base::DictionaryValue* localized_strings); | 26 virtual void GetLocalizedValues(base::DictionaryValue* localized_strings); |
| 27 virtual void RegisterMessages(); | 27 virtual void RegisterMessages(); |
| 28 | 28 |
| 29 private: | 29 private: |
| 30 class UpdateObserver; |
| 31 |
| 30 // The function is called from JavaScript when the about page is ready. | 32 // The function is called from JavaScript when the about page is ready. |
| 31 void PageReady(const base::ListValue* args); | 33 void PageReady(const base::ListValue* args); |
| 32 | 34 |
| 33 // The function is called from JavaScript to set the release track like | 35 // The function is called from JavaScript to set the release track like |
| 34 // "beta-channel" and "dev-channel". | 36 // "beta-channel" and "dev-channel". |
| 35 void SetReleaseTrack(const base::ListValue* args); | 37 void SetReleaseTrack(const base::ListValue* args); |
| 36 | 38 |
| 37 // Initiates update check. | 39 // Initiates update check. |
| 38 void CheckNow(const base::ListValue* args); | 40 void CheckNow(const base::ListValue* args); |
| 39 | 41 |
| 40 // Restarts the system. | 42 // Restarts the system. |
| 41 void RestartNow(const base::ListValue* args); | 43 void RestartNow(const base::ListValue* args); |
| 42 | 44 |
| 43 // Callback from VersionLoader giving the version. | 45 // Callback from VersionLoader giving the version. |
| 44 void OnOSVersion(VersionLoader::Handle handle, | 46 void OnOSVersion(VersionLoader::Handle handle, |
| 45 std::string version); | 47 std::string version); |
| 46 void OnOSFirmware(VersionLoader::Handle handle, | 48 void OnOSFirmware(VersionLoader::Handle handle, |
| 47 std::string firmware); | 49 std::string firmware); |
| 48 void UpdateStatus(const UpdateLibrary::Status& status); | 50 void UpdateStatus(const UpdateEngineClient::Status& status); |
| 49 | 51 |
| 50 // UpdateEngine Callback handler. | 52 // UpdateEngine Callback handler. |
| 51 static void UpdateSelectedChannel(void* user_data, const char* channel); | 53 static void UpdateSelectedChannel(UpdateObserver* observer, |
| 54 const std::string& channel); |
| 52 | 55 |
| 53 // Handles asynchronously loading the version. | 56 // Handles asynchronously loading the version. |
| 54 VersionLoader loader_; | 57 VersionLoader loader_; |
| 55 | 58 |
| 56 // Used to request the version. | 59 // Used to request the version. |
| 57 CancelableRequestConsumer consumer_; | 60 CancelableRequestConsumer consumer_; |
| 58 | 61 |
| 59 // Update Observer | 62 // Update Observer |
| 60 class UpdateObserver; | |
| 61 scoped_ptr<UpdateObserver> update_observer_; | 63 scoped_ptr<UpdateObserver> update_observer_; |
| 62 | 64 |
| 63 int progress_; | 65 int progress_; |
| 64 bool sticky_; | 66 bool sticky_; |
| 65 bool started_; | 67 bool started_; |
| 66 | 68 |
| 67 DISALLOW_COPY_AND_ASSIGN(AboutPageHandler); | 69 DISALLOW_COPY_AND_ASSIGN(AboutPageHandler); |
| 68 }; | 70 }; |
| 69 | 71 |
| 70 } // namespace chromeos | 72 } // namespace chromeos |
| 71 | 73 |
| 72 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_ABOUT_PAGE_HANDLER_H_ | 74 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_ABOUT_PAGE_HANDLER_H_ |
| OLD | NEW |