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

Side by Side Diff: chrome/browser/ui/webui/voicesearch_ui.cc

Issue 554603002: Fix a browser crash on opening 'chrome://voicesearch' in guest mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed review comment. Created 6 years, 3 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 | « no previous file | 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/voicesearch_ui.h" 5 #include "chrome/browser/ui/webui/voicesearch_ui.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/field_trial.h" 8 #include "base/metrics/field_trial.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 void AddHotwordInfo(base::ListValue* list) { 238 void AddHotwordInfo(base::ListValue* list) {
239 std::string search_enabled = "No"; 239 std::string search_enabled = "No";
240 if (profile_->GetPrefs()->GetBoolean(prefs::kHotwordSearchEnabled)) 240 if (profile_->GetPrefs()->GetBoolean(prefs::kHotwordSearchEnabled))
241 search_enabled = "Yes"; 241 search_enabled = "Yes";
242 AddPair(list, ASCIIToUTF16("Hotword Search Enabled"), 242 AddPair(list, ASCIIToUTF16("Hotword Search Enabled"),
243 ASCIIToUTF16(search_enabled)); 243 ASCIIToUTF16(search_enabled));
244 244
245 std::string audio_logging_enabled = "No"; 245 std::string audio_logging_enabled = "No";
246 HotwordService* hotword_service = 246 HotwordService* hotword_service =
247 HotwordServiceFactory::GetForProfile(profile_); 247 HotwordServiceFactory::GetForProfile(profile_);
248 if (hotword_service->IsOptedIntoAudioLogging()) 248 if (hotword_service && hotword_service->IsOptedIntoAudioLogging())
249 audio_logging_enabled = "Yes"; 249 audio_logging_enabled = "Yes";
250 AddPair(list, ASCIIToUTF16("Hotword Audio Logging Enabled"), 250 AddPair(list, ASCIIToUTF16("Hotword Audio Logging Enabled"),
251 ASCIIToUTF16(audio_logging_enabled)); 251 ASCIIToUTF16(audio_logging_enabled));
252 252
253 std::string group = base::FieldTrialList::FindFullName( 253 std::string group = base::FieldTrialList::FindFullName(
254 hotword_internal::kHotwordFieldTrialName); 254 hotword_internal::kHotwordFieldTrialName);
255 AddPair(list, ASCIIToUTF16("Field trial"), ASCIIToUTF16(group)); 255 AddPair(list, ASCIIToUTF16("Field trial"), ASCIIToUTF16(group));
256 256
257 AddLineBreak(list); 257 AddLineBreak(list);
258 } 258 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 VoiceSearchUI::VoiceSearchUI(content::WebUI* web_ui) 364 VoiceSearchUI::VoiceSearchUI(content::WebUI* web_ui)
365 : content::WebUIController(web_ui) { 365 : content::WebUIController(web_ui) {
366 Profile* profile = Profile::FromWebUI(web_ui); 366 Profile* profile = Profile::FromWebUI(web_ui);
367 web_ui->AddMessageHandler(new VoiceSearchDomHandler(profile)); 367 web_ui->AddMessageHandler(new VoiceSearchDomHandler(profile));
368 368
369 // Set up the about:voicesearch source. 369 // Set up the about:voicesearch source.
370 content::WebUIDataSource::Add(profile, CreateVoiceSearchUiHtmlSource()); 370 content::WebUIDataSource::Add(profile, CreateVoiceSearchUiHtmlSource());
371 } 371 }
372 372
373 VoiceSearchUI::~VoiceSearchUI() {} 373 VoiceSearchUI::~VoiceSearchUI() {}
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698