Upstream version 7.36.149.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/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h"
14 #include "content/public/browser/web_ui_message_handler.h"
15
16 namespace base {
17 class ListValue;
18 }
19
20 namespace app_list {
21
22 class RecommendedApps;
23
24 // Handler for the app launcher start page.
25 class StartPageHandler : public content::WebUIMessageHandler,
26                          public content::NotificationObserver,
27                          public RecommendedAppsObserver {
28  public:
29   StartPageHandler();
30   virtual ~StartPageHandler();
31
32  private:
33   // content::WebUIMessageHandler overrides:
34   virtual void RegisterMessages() OVERRIDE;
35
36   // Overridden from content::NotificationObserver:
37   virtual void Observe(int type,
38                        const content::NotificationSource& source,
39                        const content::NotificationDetails& details) OVERRIDE;
40
41   // RecommendedAppsObserver overrdies:
42   virtual void OnRecommendedAppsChanged() OVERRIDE;
43
44   // Creates a ListValue for the recommended apps and sends it to js side.
45   void SendRecommendedApps();
46
47 #if defined(OS_CHROMEOS)
48   // Called when the pref has been changed.
49   void OnHotwordEnabledChanged();
50 #endif
51
52   // JS callbacks.
53   void HandleInitialize(const base::ListValue* args);
54   void HandleLaunchApp(const base::ListValue* args);
55   void HandleSpeechResult(const base::ListValue* args);
56   void HandleSpeechSoundLevel(const base::ListValue* args);
57   void HandleSpeechRecognition(const base::ListValue* args);
58
59   RecommendedApps* recommended_apps_;  // Not owned.
60   PrefChangeRegistrar pref_change_registrar_;
61   content::NotificationRegistrar registrar_;
62
63   DISALLOW_COPY_AND_ASSIGN(StartPageHandler);
64 };
65
66 }  // namespace app_list
67
68 #endif  // CHROME_BROWSER_UI_WEBUI_APP_LIST_START_PAGE_HANDLER_H_