Chromium Code Reviews| Index: chrome/browser/ui/webui/settings/about_handler.h |
| diff --git a/chrome/browser/ui/webui/help/help_handler.h b/chrome/browser/ui/webui/settings/about_handler.h |
| similarity index 56% |
| copy from chrome/browser/ui/webui/help/help_handler.h |
| copy to chrome/browser/ui/webui/settings/about_handler.h |
| index 95e41f614c2d82d03868f82d33ecedf427633e3f..d9a8ccb36e9d20b0bc48dbb830a4ee8c7e913531 100644 |
| --- a/chrome/browser/ui/webui/help/help_handler.h |
| +++ b/chrome/browser/ui/webui/settings/about_handler.h |
| @@ -1,9 +1,9 @@ |
| -// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#ifndef CHROME_BROWSER_UI_WEBUI_HELP_HELP_HANDLER_H_ |
| -#define CHROME_BROWSER_UI_WEBUI_HELP_HELP_HANDLER_H_ |
| +#ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_ABOUT_HANDLER_H_ |
| +#define CHROME_BROWSER_UI_WEBUI_SETTINGS_ABOUT_HANDLER_H_ |
| #include <string> |
| @@ -13,6 +13,7 @@ |
| #include "base/strings/string16.h" |
| #include "build/build_config.h" |
| #include "chrome/browser/ui/webui/help/version_updater.h" |
| +#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" |
| #include "components/policy/core/common/policy_service.h" |
| #include "content/public/browser/notification_observer.h" |
| #include "content/public/browser/notification_registrar.h" |
| @@ -29,19 +30,27 @@ class FilePath; |
| class ListValue; |
| } |
| +namespace content { |
| +class WebUIDataSource; |
| +} |
| + |
| +class Profile; |
| + |
| +namespace settings { |
| + |
| // WebUI message handler for the help page. |
| -class HelpHandler : public content::WebUIMessageHandler, |
| - public content::NotificationObserver { |
| +class AboutHandler : public settings::SettingsPageUIHandler, |
|
tommycli
2016/05/10 20:45:40
This could use a unit test. I see that the origina
dpapad
2016/05/10 22:03:02
Acknowledged. I prefer to first make progress on t
tommycli
2016/05/10 22:14:52
SGTM
|
| + public content::NotificationObserver { |
| public: |
| - HelpHandler(); |
| - ~HelpHandler() override; |
| + AboutHandler(); |
| + ~AboutHandler() override; |
| + |
| + static AboutHandler* Create(content::WebUIDataSource* html_source, |
| + Profile* profile); |
| // WebUIMessageHandler implementation. |
| void RegisterMessages() override; |
| - // Adds string values for the UI to |localized_strings|. |
| - static void GetLocalizedValues(base::DictionaryValue* localized_strings); |
| - |
| // NotificationObserver implementation. |
| void Observe(int type, |
| const content::NotificationSource& source, |
| @@ -56,10 +65,7 @@ class HelpHandler : public content::WebUIMessageHandler, |
| // On ChromeOS, this gets the current update status. On other platforms, it |
| // will request and perform an update (if one is available). |
| - void RefreshUpdateStatus(); |
| - |
| - // Initializes querying values for the page. |
| - void OnPageLoaded(const base::ListValue* args); |
| + void HandleRefreshUpdateStatus(const base::ListValue* args); |
| #if defined(OS_MACOSX) |
| // Promotes the updater for all users. |
| @@ -67,24 +73,37 @@ class HelpHandler : public content::WebUIMessageHandler, |
| #endif |
| // Relaunches the browser. |args| must be empty. |
| - void RelaunchNow(const base::ListValue* args); |
| + void HandleRelaunchNow(const base::ListValue* args); |
| // Opens the feedback dialog. |args| must be empty. |
| - void OpenFeedbackDialog(const base::ListValue* args); |
| + void HandleOpenFeedbackDialog(const base::ListValue* args); |
| // Opens the help page. |args| must be empty. |
| - void OpenHelpPage(const base::ListValue* args); |
| + void HandleOpenHelpPage(const base::ListValue* args); |
| #if defined(OS_CHROMEOS) |
| // Sets the release track version. |
| void SetChannel(const base::ListValue* args); |
|
tommycli
2016/05/10 20:45:40
Can we rename this to HandleSetChannel?
dpapad
2016/05/10 22:03:02
Done.
|
| - // Performs relaunch and powerwash. |
| - void RelaunchAndPowerwash(const base::ListValue* args); |
| + // Checks for and applies update, triggered by JS. |
| + void HandleRequestUpdate(const base::ListValue* args); |
| + |
| + void HandleGetOsVersion(const base::ListValue* args); |
| + void HandleGetArcVersion(const base::ListValue* args); |
| + void HandleGetOsFirmware(const base::ListValue* args); |
| + // C++ callback for either of |HandleGetOsVersion|, |HandleGetArcVersion|, |
| + // |HandleGetOsFirmware|. |
| + void OnVersionReady(std::string callback_id, std::string version); |
| + |
| + void HandleGetCurrentChannel(const base::ListValue* args); |
| + void HandleGetTargetChannel(const base::ListValue* args); |
| + // C++ callback for either of |HandleGetCurrentChannel| or |
| + // |HandleGetTargetChannel|, |
| + void OnGetChannelReady(std::string callback_id, const std::string& channel); |
| #endif |
| // Checks for and applies update. |
| - void RequestUpdate(const base::ListValue* args); |
| + void RequestUpdate(); |
| // Callback method which forwards status updates to the page. |
| void SetUpdateStatus(VersionUpdater::Status status, |
| @@ -97,22 +116,17 @@ class HelpHandler : public content::WebUIMessageHandler, |
| #endif |
| #if defined(OS_CHROMEOS) |
| - // Callbacks from VersionLoader. |
| - void OnOSVersion(const std::string& version); |
| - void OnARCVersion(const std::string& firmware); |
| - void OnOSFirmware(const std::string& firmware); |
| - void OnCurrentChannel(const std::string& channel); |
| - void OnTargetChannel(const std::string& channel); |
| + void HandleGetRegulatoryInfo(const base::ListValue* args); |
| // Callback for when the directory with the regulatory label image and alt |
| // text has been found. |
| - void OnRegulatoryLabelDirFound(const base::FilePath& path); |
| + void OnRegulatoryLabelDirFound(std::string callback_id, |
| + const base::FilePath& path); |
| - // Callback for setting the regulatory label source. |
| - void OnRegulatoryLabelImageFound(const base::FilePath& path); |
| - |
| - // Callback for setting the regulatory label alt text. |
| - void OnRegulatoryLabelTextRead(const std::string& text); |
| + // Callback for when the regulatory text has been read. |
| + void OnRegulatoryLabelTextRead(std::string callback_id, |
| + const base::FilePath& path, |
| + const std::string& text); |
| #endif |
| // Specialized instance of the VersionUpdater used to update the browser. |
| @@ -125,9 +139,11 @@ class HelpHandler : public content::WebUIMessageHandler, |
| policy::PolicyChangeRegistrar policy_registrar_; |
| // Used for callbacks. |
| - base::WeakPtrFactory<HelpHandler> weak_factory_; |
| + base::WeakPtrFactory<AboutHandler> weak_factory_; |
| - DISALLOW_COPY_AND_ASSIGN(HelpHandler); |
| + DISALLOW_COPY_AND_ASSIGN(AboutHandler); |
| }; |
| -#endif // CHROME_BROWSER_UI_WEBUI_HELP_HELP_HANDLER_H_ |
| +} // namespace settings |
| + |
| +#endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_ABOUT_HANDLER_H_ |