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

Side by Side Diff: chrome/browser/search/hotword_service.cc

Issue 816403003: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years, 12 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
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/search/hotword_service.h" 5 #include "chrome/browser/search/hotword_service.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/i18n/case_conversion.h" 10 #include "base/i18n/case_conversion.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 270
271 // static 271 // static
272 bool HotwordService::IsExperimentalHotwordingEnabled() { 272 bool HotwordService::IsExperimentalHotwordingEnabled() {
273 std::string group = base::FieldTrialList::FindFullName( 273 std::string group = base::FieldTrialList::FindFullName(
274 hotword_internal::kHotwordFieldTrialName); 274 hotword_internal::kHotwordFieldTrialName);
275 if (!group.empty() && 275 if (!group.empty() &&
276 group == hotword_internal::kHotwordFieldTrialExperimentalGroupName) { 276 group == hotword_internal::kHotwordFieldTrialExperimentalGroupName) {
277 return true; 277 return true;
278 } 278 }
279 279
280 CommandLine* command_line = CommandLine::ForCurrentProcess(); 280 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
281 return !command_line->HasSwitch(switches::kDisableExperimentalHotwording); 281 return !command_line->HasSwitch(switches::kDisableExperimentalHotwording);
282 } 282 }
283 283
284 #if defined(OS_CHROMEOS) 284 #if defined(OS_CHROMEOS)
285 class HotwordService::HotwordUserSessionStateObserver 285 class HotwordService::HotwordUserSessionStateObserver
286 : public user_manager::UserManager::UserSessionStateObserver { 286 : public user_manager::UserManager::UserSessionStateObserver {
287 public: 287 public:
288 explicit HotwordUserSessionStateObserver(HotwordService* service) 288 explicit HotwordUserSessionStateObserver(HotwordService* service)
289 : service_(service) {} 289 : service_(service) {}
290 290
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 348
349 SetAudioHistoryHandler(new HotwordAudioHistoryHandler( 349 SetAudioHistoryHandler(new HotwordAudioHistoryHandler(
350 profile_, base::MessageLoop::current()->task_runner())); 350 profile_, base::MessageLoop::current()->task_runner()));
351 351
352 if (HotwordServiceFactory::IsHotwordHardwareAvailable() && 352 if (HotwordServiceFactory::IsHotwordHardwareAvailable() &&
353 IsHotwordAllowed() && 353 IsHotwordAllowed() &&
354 IsExperimentalHotwordingEnabled()) { 354 IsExperimentalHotwordingEnabled()) {
355 // Show the hotword notification in 5 seconds if the experimental flag is 355 // Show the hotword notification in 5 seconds if the experimental flag is
356 // on, or in 30 minutes if not. We need to wait at least a few seconds 356 // on, or in 30 minutes if not. We need to wait at least a few seconds
357 // for the hotword extension to be installed. 357 // for the hotword extension to be installed.
358 CommandLine* command_line = CommandLine::ForCurrentProcess(); 358 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
359 if (command_line->HasSwitch(switches::kEnableExperimentalHotwordHardware)) { 359 if (command_line->HasSwitch(switches::kEnableExperimentalHotwordHardware)) {
360 base::MessageLoop::current()->PostDelayedTask( 360 base::MessageLoop::current()->PostDelayedTask(
361 FROM_HERE, 361 FROM_HERE,
362 base::Bind(&HotwordService::ShowHotwordNotification, 362 base::Bind(&HotwordService::ShowHotwordNotification,
363 weak_factory_.GetWeakPtr()), 363 weak_factory_.GetWeakPtr()),
364 base::TimeDelta::FromSeconds(5)); 364 base::TimeDelta::FromSeconds(5));
365 } else if (!profile_->GetPrefs()->GetBoolean( 365 } else if (!profile_->GetPrefs()->GetBoolean(
366 prefs::kHotwordAlwaysOnNotificationSeen)) { 366 prefs::kHotwordAlwaysOnNotificationSeen)) {
367 base::MessageLoop::current()->PostDelayedTask( 367 base::MessageLoop::current()->PostDelayedTask(
368 FROM_HERE, 368 FROM_HERE,
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 // Only support multiple profiles and profile switching in ChromeOS. 841 // Only support multiple profiles and profile switching in ChromeOS.
842 if (user_manager::UserManager::IsInitialized()) { 842 if (user_manager::UserManager::IsInitialized()) {
843 user_manager::User* user = 843 user_manager::User* user =
844 user_manager::UserManager::Get()->GetActiveUser(); 844 user_manager::UserManager::Get()->GetActiveUser();
845 if (user && user->is_profile_created()) 845 if (user && user->is_profile_created())
846 return profile_ == ProfileManager::GetActiveUserProfile(); 846 return profile_ == ProfileManager::GetActiveUserProfile();
847 } 847 }
848 #endif 848 #endif
849 return true; 849 return true;
850 } 850 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_test.cc ('k') | chrome/browser/search/hotword_service_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698