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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
15 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" | 15 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" |
16 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 17 #include "ui/app_list/speech_ui_model_observer.h" |
17 | 18 |
18 namespace extensions { | 19 namespace extensions { |
19 class Extension; | 20 class Extension; |
20 } | 21 } |
21 | 22 |
22 class Profile; | 23 class Profile; |
23 | 24 |
24 namespace app_list { | 25 namespace app_list { |
25 | 26 |
26 class RecommendedApps; | 27 class RecommendedApps; |
27 class StartPageObserver; | 28 class StartPageObserver; |
28 | 29 |
29 // StartPageService collects data to be displayed in app list's start page | 30 // StartPageService collects data to be displayed in app list's start page |
30 // and hosts the start page contents. | 31 // and hosts the start page contents. |
31 class StartPageService : public BrowserContextKeyedService { | 32 class StartPageService : public BrowserContextKeyedService { |
32 public: | 33 public: |
33 typedef std::vector<scoped_refptr<const extensions::Extension> > | 34 typedef std::vector<scoped_refptr<const extensions::Extension> > |
34 ExtensionList; | 35 ExtensionList; |
35 // Gets the instance for the given profile. | 36 // Gets the instance for the given profile. |
36 static StartPageService* Get(Profile* profile); | 37 static StartPageService* Get(Profile* profile); |
37 | 38 |
38 void AddObserver(StartPageObserver* observer); | 39 void AddObserver(StartPageObserver* observer); |
39 void RemoveObserver(StartPageObserver* observer); | 40 void RemoveObserver(StartPageObserver* observer); |
40 | 41 |
41 void ToggleSpeechRecognition(); | 42 void ToggleSpeechRecognition(); |
42 | 43 |
43 content::WebContents* contents() { return contents_.get(); } | 44 content::WebContents* contents() { return contents_.get(); } |
44 RecommendedApps* recommended_apps() { return recommended_apps_.get(); } | 45 RecommendedApps* recommended_apps() { return recommended_apps_.get(); } |
45 Profile* profile() { return profile_; } | 46 Profile* profile() { return profile_; } |
46 void OnSearch(const base::string16& query); | 47 void OnSpeechResult(const base::string16& query, bool is_final); |
47 void OnSpeechRecognitionStateChanged(bool recognizing); | 48 void OnSpeechSoundLevelChanged(int16 level); |
| 49 void OnSpeechRecognitionStateChanged(SpeechRecognitionState new_state); |
48 | 50 |
49 private: | 51 private: |
50 // A BrowserContextKeyedServiceFactory for this service. | 52 // A BrowserContextKeyedServiceFactory for this service. |
51 class Factory; | 53 class Factory; |
52 | 54 |
53 // ProfileDestroyObserver to shutdown the service on exiting. WebContents | 55 // ProfileDestroyObserver to shutdown the service on exiting. WebContents |
54 // depends on the profile and needs to be closed before the profile and its | 56 // depends on the profile and needs to be closed before the profile and its |
55 // keyed service shutdown. | 57 // keyed service shutdown. |
56 class ProfileDestroyObserver; | 58 class ProfileDestroyObserver; |
57 | 59 |
(...skipping 13 matching lines...) Expand all Loading... |
71 scoped_ptr<ProfileDestroyObserver> profile_destroy_observer_; | 73 scoped_ptr<ProfileDestroyObserver> profile_destroy_observer_; |
72 scoped_ptr<RecommendedApps> recommended_apps_; | 74 scoped_ptr<RecommendedApps> recommended_apps_; |
73 ObserverList<StartPageObserver> observers_; | 75 ObserverList<StartPageObserver> observers_; |
74 | 76 |
75 DISALLOW_COPY_AND_ASSIGN(StartPageService); | 77 DISALLOW_COPY_AND_ASSIGN(StartPageService); |
76 }; | 78 }; |
77 | 79 |
78 } // namespace app_list | 80 } // namespace app_list |
79 | 81 |
80 #endif // CHROME_BROWSER_UI_APP_LIST_START_PAGE_SERVICE_H_ | 82 #endif // CHROME_BROWSER_UI_APP_LIST_START_PAGE_SERVICE_H_ |
OLD | NEW |