Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / ui / webui / help / help_handler.h
blob34da48772af4b3e9f8acf991ea6f772ddffc0c34
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_WEBUI_HELP_HELP_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_HELP_HELP_HANDLER_H_
8 #include <string>
10 #include "base/compiler_specific.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/strings/string16.h"
13 #include "chrome/browser/ui/webui/help/version_updater.h"
14 #include "content/public/browser/notification_observer.h"
15 #include "content/public/browser/notification_registrar.h"
16 #include "content/public/browser/web_ui_message_handler.h"
18 #if defined(OS_CHROMEOS)
19 #include "base/task/cancelable_task_tracker.h"
20 #include "chromeos/system/version_loader.h"
21 #endif // defined(OS_CHROMEOS)
23 namespace base {
24 class DictionaryValue;
25 class ListValue;
28 // WebUI message handler for the help page.
29 class HelpHandler : public content::WebUIMessageHandler,
30 public content::NotificationObserver {
31 public:
32 HelpHandler();
33 ~HelpHandler() override;
35 // WebUIMessageHandler implementation.
36 void RegisterMessages() override;
38 // Adds string values for the UI to |localized_strings|.
39 static void GetLocalizedValues(base::DictionaryValue* localized_strings);
41 // NotificationObserver implementation.
42 void Observe(int type,
43 const content::NotificationSource& source,
44 const content::NotificationDetails& details) override;
46 // Returns the browser version as a string.
47 static base::string16 BuildBrowserVersionString();
49 private:
50 // Initializes querying values for the page.
51 void OnPageLoaded(const base::ListValue* args);
53 #if defined(OS_MACOSX)
54 // Promotes the updater for all users.
55 void PromoteUpdater(const base::ListValue* args);
56 #endif
58 // Relaunches the browser. |args| must be empty.
59 void RelaunchNow(const base::ListValue* args);
61 // Opens the feedback dialog. |args| must be empty.
62 void OpenFeedbackDialog(const base::ListValue* args);
64 // Opens the help page. |args| must be empty.
65 void OpenHelpPage(const base::ListValue* args);
67 #if defined(OS_CHROMEOS)
68 // Sets the release track version.
69 void SetChannel(const base::ListValue* args);
71 // Performs relaunch and powerwash.
72 void RelaunchAndPowerwash(const base::ListValue* args);
73 #endif
75 // Checks for and applies update.
76 void RequestUpdate(const base::ListValue* args);
78 // Callback method which forwards status updates to the page.
79 void SetUpdateStatus(VersionUpdater::Status status, int progress,
80 const base::string16& fail_message);
82 #if defined(OS_MACOSX)
83 // Callback method which forwards promotion state to the page.
84 void SetPromotionState(VersionUpdater::PromotionState state);
85 #endif
87 #if defined(OS_CHROMEOS)
88 // Callbacks from VersionLoader.
89 void OnOSVersion(const std::string& version);
90 void OnOSFirmware(const std::string& firmware);
91 void OnCurrentChannel(const std::string& channel);
92 void OnTargetChannel(const std::string& channel);
94 // Callback for setting the FCC label alt text.
95 void OnFCCLabelTextRead(const std::string& text);
96 #endif
98 // Specialized instance of the VersionUpdater used to update the browser.
99 scoped_ptr<VersionUpdater> version_updater_;
101 // Used to observe notifications.
102 content::NotificationRegistrar registrar_;
104 // Used for callbacks.
105 base::WeakPtrFactory<HelpHandler> weak_factory_;
107 DISALLOW_COPY_AND_ASSIGN(HelpHandler);
110 #endif // CHROME_BROWSER_UI_WEBUI_HELP_HELP_HANDLER_H_