Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: chrome/browser/ui/webui/app_list/start_page_handler.cc

Issue 970863003: app_list::StartPageService: Document and check nulls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/ash/app_list/app_list_service_ash.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/app_list/app_list_service_ash.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698