| 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 "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
| 13 #include "chrome/browser/extensions/extension_service.h" | 13 #include "chrome/browser/extensions/extension_service.h" |
| 14 #include "chrome/browser/omaha_query_params/omaha_query_params.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/search/hotword_service.h" | 16 #include "chrome/browser/search/hotword_service.h" |
| 16 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" | 17 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
| 17 #include "chrome/browser/ui/app_list/app_list_service.h" | 18 #include "chrome/browser/ui/app_list/app_list_service.h" |
| 18 #include "chrome/browser/ui/app_list/recommended_apps.h" | 19 #include "chrome/browser/ui/app_list/recommended_apps.h" |
| 19 #include "chrome/browser/ui/app_list/start_page_service.h" | 20 #include "chrome/browser/ui/app_list/start_page_service.h" |
| 20 #include "chrome/browser/ui/host_desktop.h" | 21 #include "chrome/browser/ui/host_desktop.h" |
| 21 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 22 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
| 22 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
| 23 #include "content/public/browser/notification_details.h" | 24 #include "content/public/browser/notification_details.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 prefs::kHotwordSearchEnabled, | 160 prefs::kHotwordSearchEnabled, |
| 160 base::Bind(&StartPageHandler::OnHotwordEnabledChanged, | 161 base::Bind(&StartPageHandler::OnHotwordEnabledChanged, |
| 161 base::Unretained(this))); | 162 base::Unretained(this))); |
| 162 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, | 163 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, |
| 163 content::Source<Profile>(profile)); | 164 content::Source<Profile>(profile)); |
| 164 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, | 165 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
| 165 content::Source<Profile>(profile)); | 166 content::Source<Profile>(profile)); |
| 166 } | 167 } |
| 167 #endif | 168 #endif |
| 168 | 169 |
| 170 web_ui()->CallJavascriptFunction( |
| 171 "appList.startPage.setNaclArch", |
| 172 base::StringValue(chrome::OmahaQueryParams::GetNaclArch())); |
| 173 |
| 169 if (!app_list::switches::IsExperimentalAppListEnabled()) { | 174 if (!app_list::switches::IsExperimentalAppListEnabled()) { |
| 170 web_ui()->CallJavascriptFunction( | 175 web_ui()->CallJavascriptFunction( |
| 171 "appList.startPage.onAppListShown", | 176 "appList.startPage.onAppListShown", |
| 172 base::FundamentalValue(service->HotwordEnabled())); | 177 base::FundamentalValue(service->HotwordEnabled())); |
| 173 } | 178 } |
| 174 } | 179 } |
| 175 | 180 |
| 176 void StartPageHandler::HandleLaunchApp(const base::ListValue* args) { | 181 void StartPageHandler::HandleLaunchApp(const base::ListValue* args) { |
| 177 std::string app_id; | 182 std::string app_id; |
| 178 CHECK(args->GetString(0, &app_id)); | 183 CHECK(args->GetString(0, &app_id)); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 else if (state_string == "STOPPING") | 237 else if (state_string == "STOPPING") |
| 233 new_state = SPEECH_RECOGNITION_STOPPING; | 238 new_state = SPEECH_RECOGNITION_STOPPING; |
| 234 | 239 |
| 235 StartPageService* service = | 240 StartPageService* service = |
| 236 StartPageService::Get(Profile::FromWebUI(web_ui())); | 241 StartPageService::Get(Profile::FromWebUI(web_ui())); |
| 237 if (service) | 242 if (service) |
| 238 service->OnSpeechRecognitionStateChanged(new_state); | 243 service->OnSpeechRecognitionStateChanged(new_state); |
| 239 } | 244 } |
| 240 | 245 |
| 241 } // namespace app_list | 246 } // namespace app_list |
| OLD | NEW |