| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 base::Unretained(this))); | 86 base::Unretained(this))); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void StartPageHandler::Observe(int type, | 89 void StartPageHandler::Observe(int type, |
| 90 const content::NotificationSource& source, | 90 const content::NotificationSource& source, |
| 91 const content::NotificationDetails& details) { | 91 const content::NotificationDetails& details) { |
| 92 #if defined(OS_CHROMEOS) | 92 #if defined(OS_CHROMEOS) |
| 93 DCHECK_EQ(Profile::FromWebUI(web_ui()), | 93 DCHECK_EQ(Profile::FromWebUI(web_ui()), |
| 94 content::Source<Profile>(source).ptr()); | 94 content::Source<Profile>(source).ptr()); |
| 95 switch (type) { | 95 switch (type) { |
| 96 case chrome::NOTIFICATION_EXTENSION_LOADED: { | 96 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: { |
| 97 extensions::Extension* extension = | 97 extensions::Extension* extension = |
| 98 content::Details<extensions::Extension>(details).ptr(); | 98 content::Details<extensions::Extension>(details).ptr(); |
| 99 if (extension->id() == extension_misc::kHotwordExtensionId) | 99 if (extension->id() == extension_misc::kHotwordExtensionId) |
| 100 OnHotwordEnabledChanged(); | 100 OnHotwordEnabledChanged(); |
| 101 break; | 101 break; |
| 102 } | 102 } |
| 103 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { | 103 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { |
| 104 extensions::UnloadedExtensionInfo* info = | 104 extensions::UnloadedExtensionInfo* info = |
| 105 content::Details<extensions::UnloadedExtensionInfo>(details).ptr(); | 105 content::Details<extensions::UnloadedExtensionInfo>(details).ptr(); |
| 106 if (info->extension->id() == extension_misc::kHotwordExtensionId) | 106 if (info->extension->id() == extension_misc::kHotwordExtensionId) |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 153 |
| 154 #if defined(OS_CHROMEOS) | 154 #if defined(OS_CHROMEOS) |
| 155 if (app_list::switches::IsVoiceSearchEnabled() && | 155 if (app_list::switches::IsVoiceSearchEnabled() && |
| 156 HotwordService::DoesHotwordSupportLanguage(profile)) { | 156 HotwordService::DoesHotwordSupportLanguage(profile)) { |
| 157 OnHotwordEnabledChanged(); | 157 OnHotwordEnabledChanged(); |
| 158 pref_change_registrar_.Init(profile->GetPrefs()); | 158 pref_change_registrar_.Init(profile->GetPrefs()); |
| 159 pref_change_registrar_.Add( | 159 pref_change_registrar_.Add( |
| 160 prefs::kHotwordSearchEnabled, | 160 prefs::kHotwordSearchEnabled, |
| 161 base::Bind(&StartPageHandler::OnHotwordEnabledChanged, | 161 base::Bind(&StartPageHandler::OnHotwordEnabledChanged, |
| 162 base::Unretained(this))); | 162 base::Unretained(this))); |
| 163 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, | 163 registrar_.Add(this, |
| 164 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, |
| 164 content::Source<Profile>(profile)); | 165 content::Source<Profile>(profile)); |
| 165 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, | 166 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
| 166 content::Source<Profile>(profile)); | 167 content::Source<Profile>(profile)); |
| 167 } | 168 } |
| 168 #endif | 169 #endif |
| 169 | 170 |
| 170 web_ui()->CallJavascriptFunction( | 171 web_ui()->CallJavascriptFunction( |
| 171 "appList.startPage.setNaclArch", | 172 "appList.startPage.setNaclArch", |
| 172 base::StringValue(chrome::OmahaQueryParams::GetNaclArch())); | 173 base::StringValue(chrome::OmahaQueryParams::GetNaclArch())); |
| 173 | 174 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 else if (state_string == "STOPPING") | 238 else if (state_string == "STOPPING") |
| 238 new_state = SPEECH_RECOGNITION_STOPPING; | 239 new_state = SPEECH_RECOGNITION_STOPPING; |
| 239 | 240 |
| 240 StartPageService* service = | 241 StartPageService* service = |
| 241 StartPageService::Get(Profile::FromWebUI(web_ui())); | 242 StartPageService::Get(Profile::FromWebUI(web_ui())); |
| 242 if (service) | 243 if (service) |
| 243 service->OnSpeechRecognitionStateChanged(new_state); | 244 service->OnSpeechRecognitionStateChanged(new_state); |
| 244 } | 245 } |
| 245 | 246 |
| 246 } // namespace app_list | 247 } // namespace app_list |
| OLD | NEW |