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 17 matching lines...) Expand all Loading... |
28 #include "chrome/browser/ui/web_applications/web_app_ui.h" | 28 #include "chrome/browser/ui/web_applications/web_app_ui.h" |
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/search_box_model.h" | 37 #include "ui/app_list/search_box_model.h" |
| 38 #include "ui/app_list/speech_ui_model.h" |
38 | 39 |
39 #if defined(USE_ASH) | 40 #if defined(USE_ASH) |
40 #include "chrome/browser/ui/ash/app_list/app_sync_ui_state_watcher.h" | 41 #include "chrome/browser/ui/ash/app_list/app_sync_ui_state_watcher.h" |
41 #endif | 42 #endif |
42 | 43 |
43 #if defined(OS_WIN) | 44 #if defined(OS_WIN) |
44 #include "chrome/browser/web_applications/web_app_win.h" | 45 #include "chrome/browser/web_applications/web_app_win.h" |
45 #endif | 46 #endif |
46 | 47 |
47 namespace { | 48 namespace { |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 } | 164 } |
164 | 165 |
165 app_list::AppListModel* AppListViewDelegate::GetModel() { | 166 app_list::AppListModel* AppListViewDelegate::GetModel() { |
166 return model_; | 167 return model_; |
167 } | 168 } |
168 | 169 |
169 app_list::SigninDelegate* AppListViewDelegate::GetSigninDelegate() { | 170 app_list::SigninDelegate* AppListViewDelegate::GetSigninDelegate() { |
170 return &signin_delegate_; | 171 return &signin_delegate_; |
171 } | 172 } |
172 | 173 |
| 174 app_list::SpeechUIModel* AppListViewDelegate::GetSpeechUI() { |
| 175 return &speech_ui_; |
| 176 } |
| 177 |
173 void AppListViewDelegate::GetShortcutPathForApp( | 178 void AppListViewDelegate::GetShortcutPathForApp( |
174 const std::string& app_id, | 179 const std::string& app_id, |
175 const base::Callback<void(const base::FilePath&)>& callback) { | 180 const base::Callback<void(const base::FilePath&)>& callback) { |
176 #if defined(OS_WIN) | 181 #if defined(OS_WIN) |
177 ExtensionService* service = profile_->GetExtensionService(); | 182 ExtensionService* service = profile_->GetExtensionService(); |
178 DCHECK(service); | 183 DCHECK(service); |
179 const extensions::Extension* extension = | 184 const extensions::Extension* extension = |
180 service->GetInstalledExtension(app_id); | 185 service->GetInstalledExtension(app_id); |
181 if (!extension) { | 186 if (!extension) { |
182 callback.Run(base::FilePath()); | 187 callback.Run(base::FilePath()); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 app_list::StartPageService::Get(profile_); | 274 app_list::StartPageService::Get(profile_); |
270 if (service) | 275 if (service) |
271 service->ToggleSpeechRecognition(); | 276 service->ToggleSpeechRecognition(); |
272 } | 277 } |
273 | 278 |
274 void AppListViewDelegate::ShowForProfileByPath( | 279 void AppListViewDelegate::ShowForProfileByPath( |
275 const base::FilePath& profile_path) { | 280 const base::FilePath& profile_path) { |
276 controller_->ShowForProfileByPath(profile_path); | 281 controller_->ShowForProfileByPath(profile_path); |
277 } | 282 } |
278 | 283 |
279 void AppListViewDelegate::OnSearch(const base::string16& query) { | 284 void AppListViewDelegate::OnSpeechResult(const base::string16& result, |
280 model_->search_box()->SetText(query); | 285 bool is_final) { |
| 286 speech_ui_.SetSpeechResult(result, is_final); |
| 287 if (is_final) |
| 288 model_->search_box()->SetText(result); |
281 } | 289 } |
282 | 290 |
283 void AppListViewDelegate::OnSpeechRecognitionStateChanged(bool recognizing) { | 291 void AppListViewDelegate::OnSpeechSoundLevelChanged(int16 level) { |
284 model_->search_box()->SetSpeechRecognitionButtonState(recognizing); | 292 speech_ui_.UpdateSoundLevel(level); |
| 293 } |
| 294 |
| 295 void AppListViewDelegate::OnSpeechRecognitionStateChanged( |
| 296 app_list::SpeechRecognitionState new_state) { |
| 297 speech_ui_.SetSpeechRecognitionState(new_state); |
285 } | 298 } |
286 | 299 |
287 void AppListViewDelegate::Observe( | 300 void AppListViewDelegate::Observe( |
288 int type, | 301 int type, |
289 const content::NotificationSource& source, | 302 const content::NotificationSource& source, |
290 const content::NotificationDetails& details) { | 303 const content::NotificationDetails& details) { |
291 OnProfileChanged(); | 304 OnProfileChanged(); |
292 } | 305 } |
293 | 306 |
294 void AppListViewDelegate::OnProfileAdded(const base::FilePath& profile_path) { | 307 void AppListViewDelegate::OnProfileAdded(const base::FilePath& profile_path) { |
(...skipping 17 matching lines...) Expand all Loading... |
312 if (!service) | 325 if (!service) |
313 return NULL; | 326 return NULL; |
314 | 327 |
315 return service->contents(); | 328 return service->contents(); |
316 } | 329 } |
317 | 330 |
318 const app_list::AppListViewDelegate::Users& | 331 const app_list::AppListViewDelegate::Users& |
319 AppListViewDelegate::GetUsers() const { | 332 AppListViewDelegate::GetUsers() const { |
320 return users_; | 333 return users_; |
321 } | 334 } |
OLD | NEW |