| 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_UI_WEBUI_HELP_HELP_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_HELP_HELP_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_HELP_HELP_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_HELP_HELP_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/help/version_updater.h" | 11 #include "chrome/browser/ui/webui/help/version_updater.h" |
| 12 #include "content/public/browser/web_ui_message_handler.h" | 12 #include "content/public/browser/web_ui_message_handler.h" |
| 13 | 13 |
| 14 #if defined(OS_CHROMEOS) |
| 15 #include "chrome/browser/chromeos/version_loader.h" |
| 16 #endif // defined(OS_CHROMEOS) |
| 17 |
| 14 // WebUI message handler for the help page. | 18 // WebUI message handler for the help page. |
| 15 class HelpHandler : public content::WebUIMessageHandler { | 19 class HelpHandler : public content::WebUIMessageHandler { |
| 16 public: | 20 public: |
| 17 HelpHandler(); | 21 HelpHandler(); |
| 18 virtual ~HelpHandler(); | 22 virtual ~HelpHandler(); |
| 19 | 23 |
| 20 // WebUIMessageHandler implementation. | 24 // WebUIMessageHandler implementation. |
| 21 virtual void RegisterMessages() OVERRIDE; | 25 virtual void RegisterMessages() OVERRIDE; |
| 22 | 26 |
| 23 // Fills |localized_strings| with string values for the UI. | 27 // Fills |localized_strings| with string values for the UI. |
| 24 void GetLocalizedValues(base::DictionaryValue* localized_strings); | 28 void GetLocalizedValues(base::DictionaryValue* localized_strings); |
| 25 | 29 |
| 26 private: | 30 private: |
| 27 // Initiates the update process. | 31 // Initializes querying values for the page. |
| 28 void CheckForUpdate(const base::ListValue* args); | 32 void OnPageLoaded(const base::ListValue* args); |
| 29 | 33 |
| 30 // Relaunches the browser. | 34 // Relaunches the browser. |
| 31 void RelaunchNow(const base::ListValue* args); | 35 void RelaunchNow(const base::ListValue* args); |
| 32 | 36 |
| 33 // Callback method which forwards status updates to the page. | 37 // Callback method which forwards status updates to the page. |
| 34 void UpdateStatus(VersionUpdater::Status status, int progress); | 38 void UpdateStatus(VersionUpdater::Status status, int progress); |
| 35 | 39 |
| 40 #if defined(OS_CHROMEOS) |
| 41 // Callbacks from VersionLoader. |
| 42 void OnOSVersion(chromeos::VersionLoader::Handle handle, std::string version); |
| 43 void OnOSFirmware(chromeos::VersionLoader::Handle handle, |
| 44 std::string firmware); |
| 45 #endif |
| 46 |
| 36 // Specialized instance of the VersionUpdater used to update the browser. | 47 // Specialized instance of the VersionUpdater used to update the browser. |
| 37 scoped_ptr<VersionUpdater> version_updater_; | 48 scoped_ptr<VersionUpdater> version_updater_; |
| 38 | 49 |
| 50 #if defined(OS_CHROMEOS) |
| 51 // Handles asynchronously loading the CrOS version info. |
| 52 chromeos::VersionLoader loader_; |
| 53 |
| 54 // Used to request the version. |
| 55 CancelableRequestConsumer consumer_; |
| 56 #endif // defined(OS_CHROMEOS) |
| 57 |
| 39 DISALLOW_COPY_AND_ASSIGN(HelpHandler); | 58 DISALLOW_COPY_AND_ASSIGN(HelpHandler); |
| 40 }; | 59 }; |
| 41 | 60 |
| 42 #endif // CHROME_BROWSER_UI_WEBUI_HELP_HELP_HANDLER_H_ | 61 #endif // CHROME_BROWSER_UI_WEBUI_HELP_HELP_HANDLER_H_ |
| OLD | NEW |