Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / webui / app_list / start_page_handler.h
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_WEBUI_APP_LIST_START_PAGE_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_APP_LIST_START_PAGE_HANDLER_H_
7
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/prefs/pref_change_registrar.h"
11 #include "chrome/browser/ui/app_list/recommended_apps_observer.h"
12 #include "content/public/browser/web_ui_message_handler.h"
13
14 namespace base {
15 class ListValue;
16 }
17
18 namespace app_list {
19
20 class RecommendedApps;
21
22 // Handler for the app launcher start page.
23 class StartPageHandler : public content::WebUIMessageHandler,
24                          public RecommendedAppsObserver {
25  public:
26   StartPageHandler();
27   virtual ~StartPageHandler();
28
29  private:
30   // content::WebUIMessageHandler overrides:
31   virtual void RegisterMessages() OVERRIDE;
32
33   // RecommendedAppsObserver overrdies:
34   virtual void OnRecommendedAppsChanged() OVERRIDE;
35
36   // Creates a ListValue for the recommended apps and sends it to js side.
37   void SendRecommendedApps();
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
51   // JS callbacks.
52   void HandleInitialize(const base::ListValue* args);
53   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
58   RecommendedApps* recommended_apps_;  // Not owned.
59   PrefChangeRegistrar pref_change_registrar_;
60
61   DISALLOW_COPY_AND_ASSIGN(StartPageHandler);
62 };
63
64 }  // namespace app_list
65
66 #endif  // CHROME_BROWSER_UI_WEBUI_APP_LIST_START_PAGE_HANDLER_H_