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