| 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/webui/app_list/start_page_handler.h" | 5 #include "chrome/browser/ui/webui/app_list/start_page_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 extensions::ExtensionRegistry::ENABLED); | 188 extensions::ExtensionRegistry::ENABLED); |
| 189 if (hotword_extension && | 189 if (hotword_extension && |
| 190 hotword_extension->version()->CompareTo( | 190 hotword_extension->version()->CompareTo( |
| 191 base::Version(kOldHotwordExtensionVersionString)) <= 0) { | 191 base::Version(kOldHotwordExtensionVersionString)) <= 0) { |
| 192 web_ui()->CallJavascriptFunction( | 192 web_ui()->CallJavascriptFunction( |
| 193 "appList.startPage.setNaclArch", | 193 "appList.startPage.setNaclArch", |
| 194 base::StringValue(omaha_client::OmahaQueryParams::GetNaclArch())); | 194 base::StringValue(omaha_client::OmahaQueryParams::GetNaclArch())); |
| 195 } | 195 } |
| 196 #endif | 196 #endif |
| 197 | 197 |
| 198 if (!app_list::switches::IsExperimentalAppListEnabled()) { | 198 // If v2 hotwording is enabled, don't tell the start page that the app list is |
| 199 // If experimental hotwording is enabled, don't enable hotwording in the | 199 // being shown. V2 hotwording doesn't use the start page for anything. |
| 200 // start page, since the hotword extension is taking care of this. | 200 if (!app_list::switches::IsExperimentalAppListEnabled() && |
| 201 bool hotword_enabled = service->HotwordEnabled() && | 201 !HotwordService::IsExperimentalHotwordingEnabled()) { |
| 202 !HotwordService::IsExperimentalHotwordingEnabled(); | |
| 203 web_ui()->CallJavascriptFunction( | 202 web_ui()->CallJavascriptFunction( |
| 204 "appList.startPage.onAppListShown", | 203 "appList.startPage.onAppListShown", |
| 205 base::FundamentalValue(hotword_enabled)); | 204 base::FundamentalValue(service->HotwordEnabled())); |
| 206 } | 205 } |
| 207 } | 206 } |
| 208 | 207 |
| 209 void StartPageHandler::HandleLaunchApp(const base::ListValue* args) { | 208 void StartPageHandler::HandleLaunchApp(const base::ListValue* args) { |
| 210 std::string app_id; | 209 std::string app_id; |
| 211 CHECK(args->GetString(0, &app_id)); | 210 CHECK(args->GetString(0, &app_id)); |
| 212 | 211 |
| 213 Profile* profile = Profile::FromWebUI(web_ui()); | 212 Profile* profile = Profile::FromWebUI(web_ui()); |
| 214 const extensions::Extension* app = | 213 const extensions::Extension* app = |
| 215 extensions::ExtensionRegistry::Get(profile) | 214 extensions::ExtensionRegistry::Get(profile) |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 else if (state_string == "NETWORK_ERROR") | 266 else if (state_string == "NETWORK_ERROR") |
| 268 new_state = SPEECH_RECOGNITION_NETWORK_ERROR; | 267 new_state = SPEECH_RECOGNITION_NETWORK_ERROR; |
| 269 | 268 |
| 270 StartPageService* service = | 269 StartPageService* service = |
| 271 StartPageService::Get(Profile::FromWebUI(web_ui())); | 270 StartPageService::Get(Profile::FromWebUI(web_ui())); |
| 272 if (service) | 271 if (service) |
| 273 service->OnSpeechRecognitionStateChanged(new_state); | 272 service->OnSpeechRecognitionStateChanged(new_state); |
| 274 } | 273 } |
| 275 | 274 |
| 276 } // namespace app_list | 275 } // namespace app_list |
| OLD | NEW |