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_APP_LIST_START_PAGE_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_LIST_START_PAGE_SERVICE_H_ |
6 #define CHROME_BROWSER_UI_APP_LIST_START_PAGE_SERVICE_H_ | 6 #define CHROME_BROWSER_UI_APP_LIST_START_PAGE_SERVICE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
18 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
19 #include "base/time/default_clock.h" | 19 #include "base/time/default_clock.h" |
20 #include "chrome/browser/ui/app_list/speech_recognizer_delegate.h" | 20 #include "chrome/browser/ui/app_list/speech_recognizer_delegate.h" |
21 #include "components/keyed_service/core/keyed_service.h" | 21 #include "components/keyed_service/core/keyed_service.h" |
22 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
23 #include "ui/app_list/speech_ui_model_observer.h" | 23 #include "ui/app_list/speech_ui_model_observer.h" |
24 | 24 |
| 25 namespace content { |
| 26 struct SpeechRecognitionSessionPreamble; |
| 27 } |
| 28 |
25 namespace extensions { | 29 namespace extensions { |
26 class Extension; | 30 class Extension; |
27 } | 31 } |
28 | 32 |
29 class Profile; | 33 class Profile; |
30 | 34 |
31 namespace app_list { | 35 namespace app_list { |
32 | 36 |
33 class RecommendedApps; | 37 class RecommendedApps; |
34 class SpeechAuthHelper; | 38 class SpeechAuthHelper; |
35 class SpeechRecognizer; | 39 class SpeechRecognizer; |
36 class StartPageObserver; | 40 class StartPageObserver; |
37 | 41 |
38 // StartPageService collects data to be displayed in app list's start page | 42 // StartPageService collects data to be displayed in app list's start page |
39 // and hosts the start page contents. | 43 // and hosts the start page contents. |
40 class StartPageService : public KeyedService, | 44 class StartPageService : public KeyedService, |
41 public SpeechRecognizerDelegate { | 45 public SpeechRecognizerDelegate { |
42 public: | 46 public: |
43 typedef std::vector<scoped_refptr<const extensions::Extension> > | 47 typedef std::vector<scoped_refptr<const extensions::Extension> > |
44 ExtensionList; | 48 ExtensionList; |
45 // Gets the instance for the given profile. | 49 // Gets the instance for the given profile. |
46 static StartPageService* Get(Profile* profile); | 50 static StartPageService* Get(Profile* profile); |
47 | 51 |
48 void AddObserver(StartPageObserver* observer); | 52 void AddObserver(StartPageObserver* observer); |
49 void RemoveObserver(StartPageObserver* observer); | 53 void RemoveObserver(StartPageObserver* observer); |
50 | 54 |
51 void AppListShown(); | 55 void AppListShown(); |
52 void AppListHidden(); | 56 void AppListHidden(); |
53 void ToggleSpeechRecognition(); | 57 void ToggleSpeechRecognition( |
| 58 const scoped_refptr<content::SpeechRecognitionSessionPreamble>& preamble); |
54 | 59 |
55 // Called when the WebUI has finished loading. | 60 // Called when the WebUI has finished loading. |
56 void WebUILoaded(); | 61 void WebUILoaded(); |
57 | 62 |
58 // Returns true if the hotword is enabled in the app-launcher. | 63 // Returns true if the hotword is enabled in the app-launcher. |
59 bool HotwordEnabled(); | 64 bool HotwordEnabled(); |
60 | 65 |
61 // They return essentially the same web contents but might return NULL when | 66 // They return essentially the same web contents but might return NULL when |
62 // some flag disables the feature. | 67 // some flag disables the feature. |
63 content::WebContents* GetStartPageContents(); | 68 content::WebContents* GetStartPageContents(); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 #endif | 131 #endif |
127 | 132 |
128 base::WeakPtrFactory<StartPageService> weak_factory_; | 133 base::WeakPtrFactory<StartPageService> weak_factory_; |
129 | 134 |
130 DISALLOW_COPY_AND_ASSIGN(StartPageService); | 135 DISALLOW_COPY_AND_ASSIGN(StartPageService); |
131 }; | 136 }; |
132 | 137 |
133 } // namespace app_list | 138 } // namespace app_list |
134 | 139 |
135 #endif // CHROME_BROWSER_UI_APP_LIST_START_PAGE_SERVICE_H_ | 140 #endif // CHROME_BROWSER_UI_APP_LIST_START_PAGE_SERVICE_H_ |
OLD | NEW |