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/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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 // static | 268 // static |
269 bool HotwordService::IsExperimentalHotwordingEnabled() { | 269 bool HotwordService::IsExperimentalHotwordingEnabled() { |
270 std::string group = base::FieldTrialList::FindFullName( | 270 std::string group = base::FieldTrialList::FindFullName( |
271 hotword_internal::kHotwordFieldTrialName); | 271 hotword_internal::kHotwordFieldTrialName); |
272 if (!group.empty() && | 272 if (!group.empty() && |
273 group == hotword_internal::kHotwordFieldTrialExperimentalGroupName) { | 273 group == hotword_internal::kHotwordFieldTrialExperimentalGroupName) { |
274 return true; | 274 return true; |
275 } | 275 } |
276 | 276 |
277 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 277 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
278 return command_line->HasSwitch(switches::kEnableExperimentalHotwording); | 278 return !command_line->HasSwitch(switches::kDisableExperimentalHotwording); |
279 } | 279 } |
280 | 280 |
281 #if defined(OS_CHROMEOS) | 281 #if defined(OS_CHROMEOS) |
282 class HotwordService::HotwordUserSessionStateObserver | 282 class HotwordService::HotwordUserSessionStateObserver |
283 : public user_manager::UserManager::UserSessionStateObserver { | 283 : public user_manager::UserManager::UserSessionStateObserver { |
284 public: | 284 public: |
285 explicit HotwordUserSessionStateObserver(HotwordService* service) | 285 explicit HotwordUserSessionStateObserver(HotwordService* service) |
286 : service_(service) {} | 286 : service_(service) {} |
287 | 287 |
288 // Overridden from UserSessionStateObserver: | 288 // Overridden from UserSessionStateObserver: |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 HotwordPrivateEventService* event_service = | 814 HotwordPrivateEventService* event_service = |
815 BrowserContextKeyedAPIFactory<HotwordPrivateEventService>::Get(profile_); | 815 BrowserContextKeyedAPIFactory<HotwordPrivateEventService>::Get(profile_); |
816 // "enabled" isn't being changed, but piggy-back off the notification anyway. | 816 // "enabled" isn't being changed, but piggy-back off the notification anyway. |
817 if (event_service) | 817 if (event_service) |
818 event_service->OnEnabledChanged(prefs::kHotwordSearchEnabled); | 818 event_service->OnEnabledChanged(prefs::kHotwordSearchEnabled); |
819 } | 819 } |
820 | 820 |
821 bool HotwordService::UserIsActive() { | 821 bool HotwordService::UserIsActive() { |
822 return profile_ == ProfileManager::GetActiveUserProfile(); | 822 return profile_ == ProfileManager::GetActiveUserProfile(); |
823 } | 823 } |
OLD | NEW |