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" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "base/version.h" | 12 #include "base/version.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/search/hotword_service.h" | 14 #include "chrome/browser/search/hotword_service.h" |
15 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" | 15 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
16 #include "chrome/browser/ui/app_list/app_list_service.h" | 16 #include "chrome/browser/ui/app_list/app_list_service.h" |
17 #include "chrome/browser/ui/app_list/recommended_apps.h" | 17 #include "chrome/browser/ui/app_list/recommended_apps.h" |
18 #include "chrome/browser/ui/app_list/start_page_service.h" | 18 #include "chrome/browser/ui/app_list/start_page_service.h" |
19 #include "chrome/browser/ui/host_desktop.h" | 19 #include "chrome/browser/ui/host_desktop.h" |
20 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 20 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
21 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
22 #include "components/omaha_client/omaha_query_params.h" | 22 #include "components/update_client/update_query_params.h" |
23 #include "content/public/browser/web_ui.h" | 23 #include "content/public/browser/web_ui.h" |
24 #include "extensions/browser/extension_registry.h" | 24 #include "extensions/browser/extension_registry.h" |
25 #include "extensions/browser/extension_system.h" | 25 #include "extensions/browser/extension_system.h" |
26 #include "extensions/common/constants.h" | 26 #include "extensions/common/constants.h" |
27 #include "extensions/common/extension.h" | 27 #include "extensions/common/extension.h" |
28 #include "extensions/common/extension_icon_set.h" | 28 #include "extensions/common/extension_icon_set.h" |
29 #include "ui/app_list/app_list_switches.h" | 29 #include "ui/app_list/app_list_switches.h" |
30 #include "ui/app_list/speech_ui_model_observer.h" | 30 #include "ui/app_list/speech_ui_model_observer.h" |
31 #include "ui/events/event_constants.h" | 31 #include "ui/events/event_constants.h" |
32 | 32 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 extensions::ExtensionRegistry* registry = | 184 extensions::ExtensionRegistry* registry = |
185 extensions::ExtensionRegistry::Get(profile); | 185 extensions::ExtensionRegistry::Get(profile); |
186 const extensions::Extension* hotword_extension = | 186 const extensions::Extension* hotword_extension = |
187 registry->GetExtensionById(extension_misc::kHotwordExtensionId, | 187 registry->GetExtensionById(extension_misc::kHotwordExtensionId, |
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(update_client::UpdateQueryParams::GetNaclArch())); |
195 } | 195 } |
196 #endif | 196 #endif |
197 | 197 |
198 // If v2 hotwording is enabled, don't tell the start page that the app list is | 198 // If v2 hotwording is enabled, don't tell the start page that the app list is |
199 // being shown. V2 hotwording doesn't use the start page for anything. | 199 // being shown. V2 hotwording doesn't use the start page for anything. |
200 if (!app_list::switches::IsExperimentalAppListEnabled() && | 200 if (!app_list::switches::IsExperimentalAppListEnabled() && |
201 !HotwordService::IsExperimentalHotwordingEnabled()) { | 201 !HotwordService::IsExperimentalHotwordingEnabled()) { |
202 web_ui()->CallJavascriptFunction( | 202 web_ui()->CallJavascriptFunction( |
203 "appList.startPage.onAppListShown", | 203 "appList.startPage.onAppListShown", |
204 base::FundamentalValue(service->HotwordEnabled())); | 204 base::FundamentalValue(service->HotwordEnabled())); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 else if (state_string == "NETWORK_ERROR") | 266 else if (state_string == "NETWORK_ERROR") |
267 new_state = SPEECH_RECOGNITION_NETWORK_ERROR; | 267 new_state = SPEECH_RECOGNITION_NETWORK_ERROR; |
268 | 268 |
269 StartPageService* service = | 269 StartPageService* service = |
270 StartPageService::Get(Profile::FromWebUI(web_ui())); | 270 StartPageService::Get(Profile::FromWebUI(web_ui())); |
271 if (service) | 271 if (service) |
272 service->OnSpeechRecognitionStateChanged(new_state); | 272 service->OnSpeechRecognitionStateChanged(new_state); |
273 } | 273 } |
274 | 274 |
275 } // namespace app_list | 275 } // namespace app_list |
OLD | NEW |