| 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 #include "chrome/browser/ui/app_list/start_page_service.h" | 5 #include "chrome/browser/ui/app_list/start_page_service.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 | 195 |
| 196 speech_recognizer_->Start(); | 196 speech_recognizer_->Start(); |
| 197 return; | 197 return; |
| 198 } | 198 } |
| 199 | 199 |
| 200 contents_->GetWebUI()->CallJavascriptFunction( | 200 contents_->GetWebUI()->CallJavascriptFunction( |
| 201 "appList.startPage.toggleSpeechRecognition"); | 201 "appList.startPage.toggleSpeechRecognition"); |
| 202 } | 202 } |
| 203 | 203 |
| 204 bool StartPageService::HotwordEnabled() { | 204 bool StartPageService::HotwordEnabled() { |
| 205 // Voice input for the launcher is unsupported on non-ChromeOS platforms. |
| 206 // TODO(amistry): Make speech input, and hotwording, work on non-ChromeOS. |
| 207 #if defined(OS_CHROMEOS) |
| 205 if (HotwordService::IsExperimentalHotwordingEnabled()) { | 208 if (HotwordService::IsExperimentalHotwordingEnabled()) { |
| 206 auto prefs = profile_->GetPrefs(); | 209 auto prefs = profile_->GetPrefs(); |
| 207 return HotwordServiceFactory::IsServiceAvailable(profile_) && | 210 return HotwordServiceFactory::IsServiceAvailable(profile_) && |
| 208 (prefs->GetBoolean(prefs::kHotwordSearchEnabled) || | 211 (prefs->GetBoolean(prefs::kHotwordSearchEnabled) || |
| 209 prefs->GetBoolean(prefs::kHotwordAlwaysOnSearchEnabled)); | 212 prefs->GetBoolean(prefs::kHotwordAlwaysOnSearchEnabled)); |
| 210 } | 213 } |
| 211 #if defined(OS_CHROMEOS) | |
| 212 return HotwordServiceFactory::IsServiceAvailable(profile_) && | 214 return HotwordServiceFactory::IsServiceAvailable(profile_) && |
| 213 profile_->GetPrefs()->GetBoolean(prefs::kHotwordSearchEnabled); | 215 profile_->GetPrefs()->GetBoolean(prefs::kHotwordSearchEnabled); |
| 214 #else | 216 #else |
| 215 return false; | 217 return false; |
| 216 #endif | 218 #endif |
| 217 } | 219 } |
| 218 | 220 |
| 219 content::WebContents* StartPageService::GetStartPageContents() { | 221 content::WebContents* StartPageService::GetStartPageContents() { |
| 220 return app_list::switches::IsExperimentalAppListEnabled() ? contents_.get() | 222 return app_list::switches::IsExperimentalAppListEnabled() ? contents_.get() |
| 221 : NULL; | 223 : NULL; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, | 316 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, |
| 315 std::string()); | 317 std::string()); |
| 316 } | 318 } |
| 317 | 319 |
| 318 void StartPageService::UnloadContents() { | 320 void StartPageService::UnloadContents() { |
| 319 contents_.reset(); | 321 contents_.reset(); |
| 320 webui_finished_loading_ = false; | 322 webui_finished_loading_ = false; |
| 321 } | 323 } |
| 322 | 324 |
| 323 } // namespace app_list | 325 } // namespace app_list |
| OLD | NEW |