| 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 "chrome/browser/ui/app_list/recommended_apps_observer.h" | 11 #include "chrome/browser/ui/app_list/recommended_apps_observer.h" |
| 11 #include "content/public/browser/web_ui_message_handler.h" | 12 #include "content/public/browser/web_ui_message_handler.h" |
| 12 | 13 |
| 13 namespace base { | 14 namespace base { |
| 14 class ListValue; | 15 class ListValue; |
| 15 } | 16 } |
| 16 | 17 |
| 17 namespace app_list { | 18 namespace app_list { |
| 18 | 19 |
| 19 class RecommendedApps; | 20 class RecommendedApps; |
| 20 | 21 |
| 21 // Handler for the app launcher start page. | 22 // Handler for the app launcher start page. |
| 22 class StartPageHandler : public content::WebUIMessageHandler, | 23 class StartPageHandler : public content::WebUIMessageHandler, |
| 23 public RecommendedAppsObserver { | 24 public RecommendedAppsObserver { |
| 24 public: | 25 public: |
| 25 StartPageHandler(); | 26 StartPageHandler(); |
| 26 virtual ~StartPageHandler(); | 27 virtual ~StartPageHandler(); |
| 27 | 28 |
| 28 private: | 29 private: |
| 29 // content::WebUIMessageHandler overrides: | 30 // content::WebUIMessageHandler overrides: |
| 30 virtual void RegisterMessages() OVERRIDE; | 31 virtual void RegisterMessages() OVERRIDE; |
| 31 | 32 |
| 32 // RecommendedAppsObserver overrdies: | 33 // RecommendedAppsObserver overrdies: |
| 33 virtual void OnRecommendedAppsChanged() OVERRIDE; | 34 virtual void OnRecommendedAppsChanged() OVERRIDE; |
| 34 | 35 |
| 35 // Creates a ListValue for the recommended apps and sends it to js side. | 36 // Creates a ListValue for the recommended apps and sends it to js side. |
| 36 void SendRecommendedApps(); | 37 void SendRecommendedApps(); |
| 37 | 38 |
| 39 #if defined(OS_CHROMEOS) |
| 40 // Returns true if the hotword is enabled. |
| 41 bool HotwordEnabled(); |
| 42 |
| 43 // Called when the pref has been changed. |
| 44 void OnHotwordEnabledChanged(); |
| 45 |
| 46 // Called when the availability of the hotword for NTP is changed. The new |
| 47 // value has to be propagated. |
| 48 void SynchronizeHotwordEnabled(); |
| 49 #endif |
| 50 |
| 38 // JS callbacks. | 51 // JS callbacks. |
| 39 void HandleInitialize(const base::ListValue* args); | 52 void HandleInitialize(const base::ListValue* args); |
| 40 void HandleLaunchApp(const base::ListValue* args); | 53 void HandleLaunchApp(const base::ListValue* args); |
| 41 void HandleSpeechResult(const base::ListValue* args); | 54 void HandleSpeechResult(const base::ListValue* args); |
| 42 void HandleSpeechSoundLevel(const base::ListValue* args); | 55 void HandleSpeechSoundLevel(const base::ListValue* args); |
| 43 void HandleSpeechRecognition(const base::ListValue* args); | 56 void HandleSpeechRecognition(const base::ListValue* args); |
| 44 | 57 |
| 45 RecommendedApps* recommended_apps_; // Not owned. | 58 RecommendedApps* recommended_apps_; // Not owned. |
| 59 PrefChangeRegistrar pref_change_registrar_; |
| 46 | 60 |
| 47 DISALLOW_COPY_AND_ASSIGN(StartPageHandler); | 61 DISALLOW_COPY_AND_ASSIGN(StartPageHandler); |
| 48 }; | 62 }; |
| 49 | 63 |
| 50 } // namespace app_list | 64 } // namespace app_list |
| 51 | 65 |
| 52 #endif // CHROME_BROWSER_UI_WEBUI_APP_LIST_START_PAGE_HANDLER_H_ | 66 #endif // CHROME_BROWSER_UI_WEBUI_APP_LIST_START_PAGE_HANDLER_H_ |
| OLD | NEW |