OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/ui/app_list/app_list_view_delegate.h" | 5 #include "chrome/browser/ui/app_list/app_list_view_delegate.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "chrome/browser/web_applications/web_app.h" | 29 #include "chrome/browser/web_applications/web_app.h" |
30 #include "chrome/common/extensions/extension_constants.h" | 30 #include "chrome/common/extensions/extension_constants.h" |
31 #include "chrome/common/url_constants.h" | 31 #include "chrome/common/url_constants.h" |
32 #include "content/public/browser/browser_thread.h" | 32 #include "content/public/browser/browser_thread.h" |
33 #include "content/public/browser/notification_service.h" | 33 #include "content/public/browser/notification_service.h" |
34 #include "content/public/browser/notification_source.h" | 34 #include "content/public/browser/notification_source.h" |
35 #include "content/public/browser/page_navigator.h" | 35 #include "content/public/browser/page_navigator.h" |
36 #include "content/public/browser/user_metrics.h" | 36 #include "content/public/browser/user_metrics.h" |
37 #include "ui/app_list/app_list_view_delegate_observer.h" | 37 #include "ui/app_list/app_list_view_delegate_observer.h" |
38 #include "ui/app_list/search_box_model.h" | 38 #include "ui/app_list/search_box_model.h" |
| 39 #include "ui/app_list/speech_ui_model.h" |
39 | 40 |
40 #if defined(USE_ASH) | 41 #if defined(USE_ASH) |
41 #include "chrome/browser/ui/ash/app_list/app_sync_ui_state_watcher.h" | 42 #include "chrome/browser/ui/ash/app_list/app_sync_ui_state_watcher.h" |
42 #endif | 43 #endif |
43 | 44 |
44 #if defined(OS_WIN) | 45 #if defined(OS_WIN) |
45 #include "chrome/browser/web_applications/web_app_win.h" | 46 #include "chrome/browser/web_applications/web_app_win.h" |
46 #endif | 47 #endif |
47 | 48 |
48 namespace { | 49 namespace { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 } | 167 } |
167 | 168 |
168 app_list::AppListModel* AppListViewDelegate::GetModel() { | 169 app_list::AppListModel* AppListViewDelegate::GetModel() { |
169 return model_; | 170 return model_; |
170 } | 171 } |
171 | 172 |
172 app_list::SigninDelegate* AppListViewDelegate::GetSigninDelegate() { | 173 app_list::SigninDelegate* AppListViewDelegate::GetSigninDelegate() { |
173 return &signin_delegate_; | 174 return &signin_delegate_; |
174 } | 175 } |
175 | 176 |
| 177 app_list::SpeechUIModel* AppListViewDelegate::GetSpeechUI() { |
| 178 return &speech_ui_; |
| 179 } |
| 180 |
176 void AppListViewDelegate::GetShortcutPathForApp( | 181 void AppListViewDelegate::GetShortcutPathForApp( |
177 const std::string& app_id, | 182 const std::string& app_id, |
178 const base::Callback<void(const base::FilePath&)>& callback) { | 183 const base::Callback<void(const base::FilePath&)>& callback) { |
179 #if defined(OS_WIN) | 184 #if defined(OS_WIN) |
180 ExtensionService* service = profile_->GetExtensionService(); | 185 ExtensionService* service = profile_->GetExtensionService(); |
181 DCHECK(service); | 186 DCHECK(service); |
182 const extensions::Extension* extension = | 187 const extensions::Extension* extension = |
183 service->GetInstalledExtension(app_id); | 188 service->GetInstalledExtension(app_id); |
184 if (!extension) { | 189 if (!extension) { |
185 callback.Run(base::FilePath()); | 190 callback.Run(base::FilePath()); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 app_list::StartPageService::Get(profile_); | 277 app_list::StartPageService::Get(profile_); |
273 if (service) | 278 if (service) |
274 service->ToggleSpeechRecognition(); | 279 service->ToggleSpeechRecognition(); |
275 } | 280 } |
276 | 281 |
277 void AppListViewDelegate::ShowForProfileByPath( | 282 void AppListViewDelegate::ShowForProfileByPath( |
278 const base::FilePath& profile_path) { | 283 const base::FilePath& profile_path) { |
279 controller_->ShowForProfileByPath(profile_path); | 284 controller_->ShowForProfileByPath(profile_path); |
280 } | 285 } |
281 | 286 |
282 void AppListViewDelegate::OnSearch(const base::string16& query) { | 287 void AppListViewDelegate::OnSpeechResult(const base::string16& result, |
283 model_->search_box()->SetText(query); | 288 bool is_final) { |
| 289 speech_ui_.SetSpeechResult(result, is_final); |
| 290 if (is_final) |
| 291 model_->search_box()->SetText(result); |
284 } | 292 } |
285 | 293 |
286 void AppListViewDelegate::OnSpeechRecognitionStateChanged(bool recognizing) { | 294 void AppListViewDelegate::OnSpeechSoundLevelChanged(int16 level) { |
287 model_->search_box()->SetSpeechRecognitionButtonState(recognizing); | 295 speech_ui_.UpdateSoundLevel(level); |
| 296 } |
| 297 |
| 298 void AppListViewDelegate::OnSpeechRecognitionStateChanged( |
| 299 app_list::SpeechRecognitionState new_state) { |
| 300 speech_ui_.SetSpeechRecognitionState(new_state); |
288 } | 301 } |
289 | 302 |
290 void AppListViewDelegate::Observe( | 303 void AppListViewDelegate::Observe( |
291 int type, | 304 int type, |
292 const content::NotificationSource& source, | 305 const content::NotificationSource& source, |
293 const content::NotificationDetails& details) { | 306 const content::NotificationDetails& details) { |
294 OnProfileChanged(); | 307 OnProfileChanged(); |
295 } | 308 } |
296 | 309 |
297 void AppListViewDelegate::OnProfileAdded(const base::FilePath& profile_path) { | 310 void AppListViewDelegate::OnProfileAdded(const base::FilePath& profile_path) { |
(...skipping 27 matching lines...) Expand all Loading... |
325 | 338 |
326 void AppListViewDelegate::AddObserver( | 339 void AppListViewDelegate::AddObserver( |
327 app_list::AppListViewDelegateObserver* observer) { | 340 app_list::AppListViewDelegateObserver* observer) { |
328 observers_.AddObserver(observer); | 341 observers_.AddObserver(observer); |
329 } | 342 } |
330 | 343 |
331 void AppListViewDelegate::RemoveObserver( | 344 void AppListViewDelegate::RemoveObserver( |
332 app_list::AppListViewDelegateObserver* observer) { | 345 app_list::AppListViewDelegateObserver* observer) { |
333 observers_.RemoveObserver(observer); | 346 observers_.RemoveObserver(observer); |
334 } | 347 } |
OLD | NEW |