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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 OnHotwordEnabledChanged(); | 170 OnHotwordEnabledChanged(); |
171 pref_change_registrar_.Init(profile->GetPrefs()); | 171 pref_change_registrar_.Init(profile->GetPrefs()); |
172 pref_change_registrar_.Add( | 172 pref_change_registrar_.Add( |
173 prefs::kHotwordSearchEnabled, | 173 prefs::kHotwordSearchEnabled, |
174 base::Bind(&StartPageHandler::OnHotwordEnabledChanged, | 174 base::Bind(&StartPageHandler::OnHotwordEnabledChanged, |
175 base::Unretained(this))); | 175 base::Unretained(this))); |
176 | 176 |
177 extension_registry_observer_.Add( | 177 extension_registry_observer_.Add( |
178 extensions::ExtensionRegistry::Get(profile)); | 178 extensions::ExtensionRegistry::Get(profile)); |
179 } | 179 } |
| 180 |
| 181 extensions::ExtensionRegistry* registry = |
| 182 extensions::ExtensionRegistry::Get(profile); |
| 183 const extensions::Extension* hotword_extension = |
| 184 registry->GetExtensionById(extension_misc::kHotwordExtensionId, |
| 185 extensions::ExtensionRegistry::ENABLED); |
| 186 if (hotword_extension && |
| 187 hotword_extension->version()->CompareTo( |
| 188 base::Version(kOldHotwordExtensionVersionString)) <= 0) { |
| 189 web_ui()->CallJavascriptFunction( |
| 190 "appList.startPage.setNaclArch", |
| 191 base::StringValue(omaha_query_params::OmahaQueryParams::GetNaclArch())); |
| 192 } |
180 #endif | 193 #endif |
181 | 194 |
182 web_ui()->CallJavascriptFunction( | |
183 "appList.startPage.setNaclArch", | |
184 base::StringValue(omaha_query_params::OmahaQueryParams::GetNaclArch())); | |
185 | |
186 if (!app_list::switches::IsExperimentalAppListEnabled()) { | 195 if (!app_list::switches::IsExperimentalAppListEnabled()) { |
187 web_ui()->CallJavascriptFunction( | 196 web_ui()->CallJavascriptFunction( |
188 "appList.startPage.onAppListShown", | 197 "appList.startPage.onAppListShown", |
189 base::FundamentalValue(service->HotwordEnabled())); | 198 base::FundamentalValue(service->HotwordEnabled())); |
190 } | 199 } |
191 } | 200 } |
192 | 201 |
193 void StartPageHandler::HandleLaunchApp(const base::ListValue* args) { | 202 void StartPageHandler::HandleLaunchApp(const base::ListValue* args) { |
194 std::string app_id; | 203 std::string app_id; |
195 CHECK(args->GetString(0, &app_id)); | 204 CHECK(args->GetString(0, &app_id)); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 else if (state_string == "NETWORK_ERROR") | 260 else if (state_string == "NETWORK_ERROR") |
252 new_state = SPEECH_RECOGNITION_NETWORK_ERROR; | 261 new_state = SPEECH_RECOGNITION_NETWORK_ERROR; |
253 | 262 |
254 StartPageService* service = | 263 StartPageService* service = |
255 StartPageService::Get(Profile::FromWebUI(web_ui())); | 264 StartPageService::Get(Profile::FromWebUI(web_ui())); |
256 if (service) | 265 if (service) |
257 service->OnSpeechRecognitionStateChanged(new_state); | 266 service->OnSpeechRecognitionStateChanged(new_state); |
258 } | 267 } |
259 | 268 |
260 } // namespace app_list | 269 } // namespace app_list |
OLD | NEW |