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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 const extensions::Extension* hotword_extension = | 120 const extensions::Extension* hotword_extension = |
121 registry->GetExtensionById(extension_misc::kHotwordExtensionId, | 121 registry->GetExtensionById(extension_misc::kHotwordExtensionId, |
122 extensions::ExtensionRegistry::ENABLED); | 122 extensions::ExtensionRegistry::ENABLED); |
123 if (hotword_extension && | 123 if (hotword_extension && |
124 hotword_extension->version()->CompareTo( | 124 hotword_extension->version()->CompareTo( |
125 base::Version(kOldHotwordExtensionVersionString)) <= 0 && | 125 base::Version(kOldHotwordExtensionVersionString)) <= 0 && |
126 !HotwordService::IsExperimentalHotwordingEnabled()) { | 126 !HotwordService::IsExperimentalHotwordingEnabled()) { |
127 StartPageService* service = StartPageService::Get(profile); | 127 StartPageService* service = StartPageService::Get(profile); |
128 web_ui()->CallJavascriptFunction( | 128 web_ui()->CallJavascriptFunction( |
129 "appList.startPage.setHotwordEnabled", | 129 "appList.startPage.setHotwordEnabled", |
130 base::FundamentalValue(service->HotwordEnabled())); | 130 base::FundamentalValue(service && service->HotwordEnabled())); |
131 } | 131 } |
132 } | 132 } |
133 #endif | 133 #endif |
134 | 134 |
135 void StartPageHandler::HandleAppListShown(const base::ListValue* args) { | 135 void StartPageHandler::HandleAppListShown(const base::ListValue* args) { |
136 bool doodle_shown = false; | 136 bool doodle_shown = false; |
137 if (args->GetBoolean(0, &doodle_shown) && doodle_shown) { | 137 if (args->GetBoolean(0, &doodle_shown) && doodle_shown) { |
138 UMA_HISTOGRAM_ENUMERATION(kAppListDoodleActionHistogram, DOODLE_SHOWN, | 138 UMA_HISTOGRAM_ENUMERATION(kAppListDoodleActionHistogram, DOODLE_SHOWN, |
139 DOODLE_ACTION_LAST); | 139 DOODLE_ACTION_LAST); |
140 } | 140 } |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 else if (state_string == "NETWORK_ERROR") | 254 else if (state_string == "NETWORK_ERROR") |
255 new_state = SPEECH_RECOGNITION_NETWORK_ERROR; | 255 new_state = SPEECH_RECOGNITION_NETWORK_ERROR; |
256 | 256 |
257 StartPageService* service = | 257 StartPageService* service = |
258 StartPageService::Get(Profile::FromWebUI(web_ui())); | 258 StartPageService::Get(Profile::FromWebUI(web_ui())); |
259 if (service) | 259 if (service) |
260 service->OnSpeechRecognitionStateChanged(new_state); | 260 service->OnSpeechRecognitionStateChanged(new_state); |
261 } | 261 } |
262 | 262 |
263 } // namespace app_list | 263 } // namespace app_list |
OLD | NEW |