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 "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/strings/string16.h" |
12 #include "chrome/browser/ui/webui/help/version_updater.h" | 13 #include "chrome/browser/ui/webui/help/version_updater.h" |
13 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
14 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
15 #include "content/public/browser/web_ui_message_handler.h" | 16 #include "content/public/browser/web_ui_message_handler.h" |
16 | 17 |
17 #if defined(OS_CHROMEOS) | 18 #if defined(OS_CHROMEOS) |
| 19 #include "base/task/cancelable_task_tracker.h" |
18 #include "chrome/browser/chromeos/version_loader.h" | 20 #include "chrome/browser/chromeos/version_loader.h" |
19 #endif // defined(OS_CHROMEOS) | 21 #endif // defined(OS_CHROMEOS) |
20 | 22 |
21 namespace content { | 23 namespace base { |
22 class WebUIDataSource; | 24 class DictionaryValue; |
| 25 class ListValue; |
23 } | 26 } |
24 | 27 |
25 // WebUI message handler for the help page. | 28 // WebUI message handler for the help page. |
26 class HelpHandler : public content::WebUIMessageHandler, | 29 class HelpHandler : public content::WebUIMessageHandler, |
27 public content::NotificationObserver { | 30 public content::NotificationObserver { |
28 public: | 31 public: |
29 HelpHandler(); | 32 HelpHandler(); |
30 virtual ~HelpHandler(); | 33 virtual ~HelpHandler(); |
31 | 34 |
32 // WebUIMessageHandler implementation. | 35 // WebUIMessageHandler implementation. |
33 virtual void RegisterMessages() OVERRIDE; | 36 virtual void RegisterMessages() OVERRIDE; |
34 | 37 |
35 // Fills |source| with string values for the UI. | 38 // Adds string values for the UI to |localized_strings|. |
36 void GetLocalizedValues(content::WebUIDataSource* source); | 39 static void GetLocalizedValues(base::DictionaryValue* localized_strings); |
37 | 40 |
38 // NotificationObserver implementation. | 41 // NotificationObserver implementation. |
39 virtual void Observe(int type, const content::NotificationSource& source, | 42 virtual void Observe(int type, const content::NotificationSource& source, |
40 const content::NotificationDetails& details) OVERRIDE; | 43 const content::NotificationDetails& details) OVERRIDE; |
41 | 44 |
| 45 // Returns the browser version as a string. |
| 46 static base::string16 BuildBrowserVersionString(); |
| 47 |
42 private: | 48 private: |
43 // Initializes querying values for the page. | 49 // Initializes querying values for the page. |
44 void OnPageLoaded(const base::ListValue* args); | 50 void OnPageLoaded(const base::ListValue* args); |
45 | 51 |
46 #if defined(OS_MACOSX) | 52 #if defined(OS_MACOSX) |
47 // Promotes the updater for all users. | 53 // Promotes the updater for all users. |
48 void PromoteUpdater(const base::ListValue* args); | 54 void PromoteUpdater(const base::ListValue* args); |
49 #endif | 55 #endif |
50 | 56 |
51 // Relaunches the browser. |args| must be empty. | 57 // Relaunches the browser. |args| must be empty. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 base::CancelableTaskTracker tracker_; | 102 base::CancelableTaskTracker tracker_; |
97 #endif // defined(OS_CHROMEOS) | 103 #endif // defined(OS_CHROMEOS) |
98 | 104 |
99 // Used for callbacks. | 105 // Used for callbacks. |
100 base::WeakPtrFactory<HelpHandler> weak_factory_; | 106 base::WeakPtrFactory<HelpHandler> weak_factory_; |
101 | 107 |
102 DISALLOW_COPY_AND_ASSIGN(HelpHandler); | 108 DISALLOW_COPY_AND_ASSIGN(HelpHandler); |
103 }; | 109 }; |
104 | 110 |
105 #endif // CHROME_BROWSER_UI_WEBUI_HELP_HELP_HANDLER_H_ | 111 #endif // CHROME_BROWSER_UI_WEBUI_HELP_HELP_HANDLER_H_ |
OLD | NEW |