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 "content/public/browser/web_contents_observer.h" | |
23 #include "ui/app_list/speech_ui_model_observer.h" | 24 #include "ui/app_list/speech_ui_model_observer.h" |
24 | 25 |
25 namespace content { | 26 namespace content { |
27 struct FrameNavigateParams; | |
28 struct LoadCommittedDetails; | |
26 struct SpeechRecognitionSessionPreamble; | 29 struct SpeechRecognitionSessionPreamble; |
27 } | 30 } |
28 | 31 |
29 namespace extensions { | 32 namespace extensions { |
30 class Extension; | 33 class Extension; |
31 } | 34 } |
32 | 35 |
33 class Profile; | 36 class Profile; |
34 | 37 |
35 namespace app_list { | 38 namespace app_list { |
36 | 39 |
37 class RecommendedApps; | 40 class RecommendedApps; |
38 class SpeechAuthHelper; | 41 class SpeechAuthHelper; |
39 class SpeechRecognizer; | 42 class SpeechRecognizer; |
40 class StartPageObserver; | 43 class StartPageObserver; |
41 | 44 |
42 // StartPageService collects data to be displayed in app list's start page | 45 // StartPageService collects data to be displayed in app list's start page |
43 // and hosts the start page contents. | 46 // and hosts the start page contents. |
44 class StartPageService : public KeyedService, | 47 class StartPageService : public KeyedService, |
48 public content::WebContentsObserver, | |
45 public SpeechRecognizerDelegate { | 49 public SpeechRecognizerDelegate { |
46 public: | 50 public: |
47 typedef std::vector<scoped_refptr<const extensions::Extension> > | 51 typedef std::vector<scoped_refptr<const extensions::Extension> > |
48 ExtensionList; | 52 ExtensionList; |
49 // Gets the instance for the given profile. | 53 // Gets the instance for the given profile. |
50 static StartPageService* Get(Profile* profile); | 54 static StartPageService* Get(Profile* profile); |
51 | 55 |
52 void AddObserver(StartPageObserver* observer); | 56 void AddObserver(StartPageObserver* observer); |
53 void RemoveObserver(StartPageObserver* observer); | 57 void RemoveObserver(StartPageObserver* observer); |
54 | 58 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
106 // This class observes network change events and disables/enables voice search | 110 // This class observes network change events and disables/enables voice search |
107 // based on network connectivity. | 111 // based on network connectivity. |
108 class NetworkChangeObserver; | 112 class NetworkChangeObserver; |
109 | 113 |
110 void LoadContents(); | 114 void LoadContents(); |
111 void UnloadContents(); | 115 void UnloadContents(); |
112 | 116 |
113 // KeyedService overrides: | 117 // KeyedService overrides: |
114 void Shutdown() override; | 118 void Shutdown() override; |
115 | 119 |
120 // contents::WebContentsObserver overrides; | |
121 void DidNavigateMainFrame(const content::LoadCommittedDetails& details, | |
122 const content::FrameNavigateParams& params) override; | |
Matt Giuca
2015/01/20 07:15:01
Very weird wrapping; has this been clang formatted
benwells
2015/01/20 07:31:09
Oops, I thought I formatted it but turns out I did
| |
123 | |
116 // Change the known microphone availability. |available| should be true if | 124 // Change the known microphone availability. |available| should be true if |
117 // the microphone exists and is available for use. | 125 // the microphone exists and is available for use. |
118 void OnMicrophoneChanged(bool available); | 126 void OnMicrophoneChanged(bool available); |
119 // Change the known network connectivity state. |available| should be true if | 127 // Change the known network connectivity state. |available| should be true if |
120 // at least one network is connected to. | 128 // at least one network is connected to. |
121 void OnNetworkChanged(bool available); | 129 void OnNetworkChanged(bool available); |
122 // Enables/disables voice recognition based on network and microphone state. | 130 // Enables/disables voice recognition based on network and microphone state. |
123 void UpdateRecognitionState(); | 131 void UpdateRecognitionState(); |
124 | 132 |
125 Profile* profile_; | 133 Profile* profile_; |
(...skipping 21 matching lines...) Expand all Loading... | |
147 scoped_ptr<NetworkChangeObserver> network_change_observer_; | 155 scoped_ptr<NetworkChangeObserver> network_change_observer_; |
148 | 156 |
149 base::WeakPtrFactory<StartPageService> weak_factory_; | 157 base::WeakPtrFactory<StartPageService> weak_factory_; |
150 | 158 |
151 DISALLOW_COPY_AND_ASSIGN(StartPageService); | 159 DISALLOW_COPY_AND_ASSIGN(StartPageService); |
152 }; | 160 }; |
153 | 161 |
154 } // namespace app_list | 162 } // namespace app_list |
155 | 163 |
156 #endif // CHROME_BROWSER_UI_APP_LIST_START_PAGE_SERVICE_H_ | 164 #endif // CHROME_BROWSER_UI_APP_LIST_START_PAGE_SERVICE_H_ |
OLD | NEW |