| 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_factory.h" | 5 #include "chrome/browser/search/hotword_service_factory.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/search/hotword_service.h" | 10 #include "chrome/browser/search/hotword_service.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 HotwordService* hotword_service = GetForProfile(context); | 40 HotwordService* hotword_service = GetForProfile(context); |
| 41 return hotword_service && hotword_service->IsHotwordAllowed(); | 41 return hotword_service && hotword_service->IsHotwordAllowed(); |
| 42 } | 42 } |
| 43 | 43 |
| 44 // static | 44 // static |
| 45 bool HotwordServiceFactory::IsHotwordHardwareAvailable() { | 45 bool HotwordServiceFactory::IsHotwordHardwareAvailable() { |
| 46 // TODO(rlp, dgreid): return has_hotword_hardware() | 46 // TODO(rlp, dgreid): return has_hotword_hardware() |
| 47 // Fill in once the hardware has the correct interface implemented. | 47 // Fill in once the hardware has the correct interface implemented. |
| 48 // In the meantime, this function can be used to get other parts moving | 48 // In the meantime, this function can be used to get other parts moving |
| 49 // based on a flag. | 49 // based on a flag. |
| 50 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 50 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 51 return command_line->HasSwitch(switches::kEnableExperimentalHotwordHardware); | 51 return command_line->HasSwitch(switches::kEnableExperimentalHotwordHardware); |
| 52 } | 52 } |
| 53 | 53 |
| 54 // static | 54 // static |
| 55 int HotwordServiceFactory::GetCurrentError(BrowserContext* context) { | 55 int HotwordServiceFactory::GetCurrentError(BrowserContext* context) { |
| 56 HotwordService* hotword_service = GetForProfile(context); | 56 HotwordService* hotword_service = GetForProfile(context); |
| 57 if (!hotword_service) | 57 if (!hotword_service) |
| 58 return 0; | 58 return 0; |
| 59 return hotword_service->error_message(); | 59 return hotword_service->error_message(); |
| 60 } | 60 } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 121 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 122 prefs->RegisterBooleanPref(prefs::kHotwordAlwaysOnNotificationSeen, | 122 prefs->RegisterBooleanPref(prefs::kHotwordAlwaysOnNotificationSeen, |
| 123 false, | 123 false, |
| 124 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 124 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 125 } | 125 } |
| 126 | 126 |
| 127 KeyedService* HotwordServiceFactory::BuildServiceInstanceFor( | 127 KeyedService* HotwordServiceFactory::BuildServiceInstanceFor( |
| 128 BrowserContext* context) const { | 128 BrowserContext* context) const { |
| 129 return new HotwordService(Profile::FromBrowserContext(context)); | 129 return new HotwordService(Profile::FromBrowserContext(context)); |
| 130 } | 130 } |
| OLD | NEW |