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 |
| 10 #include <memory> |
9 #include <string> | 11 #include <string> |
10 #include <vector> | 12 #include <vector> |
11 | 13 |
12 #include "base/callback.h" | 14 #include "base/callback.h" |
13 #include "base/macros.h" | 15 #include "base/macros.h" |
14 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | |
16 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
17 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
18 #include "base/strings/string16.h" | 19 #include "base/strings/string16.h" |
19 #include "base/time/default_clock.h" | 20 #include "base/time/default_clock.h" |
20 #include "build/build_config.h" | 21 #include "build/build_config.h" |
21 #include "chrome/browser/ui/app_list/speech_recognizer_delegate.h" | 22 #include "chrome/browser/ui/app_list/speech_recognizer_delegate.h" |
22 #include "components/keyed_service/core/keyed_service.h" | 23 #include "components/keyed_service/core/keyed_service.h" |
23 #include "content/public/browser/web_contents.h" | 24 #include "content/public/browser/web_contents.h" |
24 #include "content/public/browser/web_contents_observer.h" | 25 #include "content/public/browser/web_contents_observer.h" |
25 #include "net/base/backoff_entry.h" | 26 #include "net/base/backoff_entry.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 // Change the known network connectivity state. |available| should be true if | 159 // Change the known network connectivity state. |available| should be true if |
159 // at least one network is connected to. | 160 // at least one network is connected to. |
160 void OnNetworkChanged(bool available); | 161 void OnNetworkChanged(bool available); |
161 // Enables/disables voice recognition based on network and microphone state. | 162 // Enables/disables voice recognition based on network and microphone state. |
162 void UpdateRecognitionState(); | 163 void UpdateRecognitionState(); |
163 // Determines whether speech recognition should be enabled, based on the | 164 // Determines whether speech recognition should be enabled, based on the |
164 // current state of the StartPageService. | 165 // current state of the StartPageService. |
165 bool ShouldEnableSpeechRecognition() const; | 166 bool ShouldEnableSpeechRecognition() const; |
166 | 167 |
167 Profile* profile_; | 168 Profile* profile_; |
168 scoped_ptr<content::WebContents> contents_; | 169 std::unique_ptr<content::WebContents> contents_; |
169 scoped_ptr<StartPageWebContentsDelegate> contents_delegate_; | 170 std::unique_ptr<StartPageWebContentsDelegate> contents_delegate_; |
170 scoped_ptr<ProfileDestroyObserver> profile_destroy_observer_; | 171 std::unique_ptr<ProfileDestroyObserver> profile_destroy_observer_; |
171 SpeechRecognitionState state_; | 172 SpeechRecognitionState state_; |
172 base::ObserverList<StartPageObserver> observers_; | 173 base::ObserverList<StartPageObserver> observers_; |
173 bool speech_button_toggled_manually_; | 174 bool speech_button_toggled_manually_; |
174 bool speech_result_obtained_; | 175 bool speech_result_obtained_; |
175 | 176 |
176 bool webui_finished_loading_; | 177 bool webui_finished_loading_; |
177 std::vector<base::Closure> pending_webui_callbacks_; | 178 std::vector<base::Closure> pending_webui_callbacks_; |
178 | 179 |
179 base::DefaultClock clock_; | 180 base::DefaultClock clock_; |
180 scoped_ptr<SpeechRecognizer> speech_recognizer_; | 181 std::unique_ptr<SpeechRecognizer> speech_recognizer_; |
181 scoped_ptr<SpeechAuthHelper> speech_auth_helper_; | 182 std::unique_ptr<SpeechAuthHelper> speech_auth_helper_; |
182 | 183 |
183 bool network_available_; | 184 bool network_available_; |
184 bool microphone_available_; | 185 bool microphone_available_; |
185 #if defined(OS_CHROMEOS) | 186 #if defined(OS_CHROMEOS) |
186 scoped_ptr<AudioStatus> audio_status_; | 187 std::unique_ptr<AudioStatus> audio_status_; |
187 #endif | 188 #endif |
188 scoped_ptr<NetworkChangeObserver> network_change_observer_; | 189 std::unique_ptr<NetworkChangeObserver> network_change_observer_; |
189 | 190 |
190 bool search_engine_is_google_; | 191 bool search_engine_is_google_; |
191 scoped_ptr<net::URLFetcher> doodle_fetcher_; | 192 std::unique_ptr<net::URLFetcher> doodle_fetcher_; |
192 net::BackoffEntry backoff_entry_; | 193 net::BackoffEntry backoff_entry_; |
193 | 194 |
194 base::WeakPtrFactory<StartPageService> weak_factory_; | 195 base::WeakPtrFactory<StartPageService> weak_factory_; |
195 | 196 |
196 DISALLOW_COPY_AND_ASSIGN(StartPageService); | 197 DISALLOW_COPY_AND_ASSIGN(StartPageService); |
197 }; | 198 }; |
198 | 199 |
199 } // namespace app_list | 200 } // namespace app_list |
200 | 201 |
201 #endif // CHROME_BROWSER_UI_APP_LIST_START_PAGE_SERVICE_H_ | 202 #endif // CHROME_BROWSER_UI_APP_LIST_START_PAGE_SERVICE_H_ |
OLD | NEW |