OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_APP_LIST_START_PAGE_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_APP_LIST_START_PAGE_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_APP_LIST_START_PAGE_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_APP_LIST_START_PAGE_HANDLER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/prefs/pref_change_registrar.h" | 10 #include "base/prefs/pref_change_registrar.h" |
11 #include "base/scoped_observer.h" | |
12 #include "content/public/browser/web_ui_message_handler.h" | 11 #include "content/public/browser/web_ui_message_handler.h" |
13 #include "extensions/browser/extension_registry_observer.h" | |
14 | 12 |
15 namespace base { | 13 namespace base { |
16 class ListValue; | 14 class ListValue; |
17 } | 15 } |
18 | 16 |
19 namespace extensions { | |
20 class ExtensionRegistry; | |
21 } | |
22 | |
23 namespace app_list { | 17 namespace app_list { |
24 | 18 |
25 // Handler for the app launcher start page. | 19 // Handler for the app launcher start page. |
26 class StartPageHandler : public content::WebUIMessageHandler, | 20 class StartPageHandler : public content::WebUIMessageHandler { |
27 public extensions::ExtensionRegistryObserver { | |
28 public: | 21 public: |
29 StartPageHandler(); | 22 StartPageHandler(); |
30 ~StartPageHandler() override; | 23 ~StartPageHandler() override; |
31 | 24 |
32 private: | 25 private: |
33 // content::WebUIMessageHandler overrides: | 26 // content::WebUIMessageHandler overrides: |
34 void RegisterMessages() override; | 27 void RegisterMessages() override; |
35 | 28 |
36 // extensions::ExtensionRegistryObserver implementation. | |
37 void OnExtensionLoaded(content::BrowserContext* browser_context, | |
38 const extensions::Extension* extension) override; | |
39 void OnExtensionUnloaded( | |
40 content::BrowserContext* browser_context, | |
41 const extensions::Extension* extension, | |
42 extensions::UnloadedExtensionInfo::Reason reason) override; | |
43 | |
44 #if defined(OS_CHROMEOS) | |
45 // Called when the pref has been changed. | |
46 void OnHotwordEnabledChanged(); | |
47 #endif | |
48 | |
49 // JS callbacks. | 29 // JS callbacks. |
50 void HandleAppListShown(const base::ListValue* args); | 30 void HandleAppListShown(const base::ListValue* args); |
51 void HandleDoodleClicked(const base::ListValue* args); | 31 void HandleDoodleClicked(const base::ListValue* args); |
52 void HandleInitialize(const base::ListValue* args); | 32 void HandleInitialize(const base::ListValue* args); |
53 void HandleLaunchApp(const base::ListValue* args); | 33 void HandleLaunchApp(const base::ListValue* args); |
54 void HandleSpeechResult(const base::ListValue* args); | |
55 void HandleSpeechSoundLevel(const base::ListValue* args); | |
56 void HandleSpeechRecognition(const base::ListValue* args); | |
57 | 34 |
58 PrefChangeRegistrar pref_change_registrar_; | 35 PrefChangeRegistrar pref_change_registrar_; |
59 | 36 |
60 ScopedObserver<extensions::ExtensionRegistry, | |
61 extensions::ExtensionRegistryObserver> | |
62 extension_registry_observer_; | |
63 | |
64 DISALLOW_COPY_AND_ASSIGN(StartPageHandler); | 37 DISALLOW_COPY_AND_ASSIGN(StartPageHandler); |
65 }; | 38 }; |
66 | 39 |
67 } // namespace app_list | 40 } // namespace app_list |
68 | 41 |
69 #endif // CHROME_BROWSER_UI_WEBUI_APP_LIST_START_PAGE_HANDLER_H_ | 42 #endif // CHROME_BROWSER_UI_WEBUI_APP_LIST_START_PAGE_HANDLER_H_ |
OLD | NEW |