| 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/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/search/hotword_service.h" | 9 #include "chrome/browser/search/hotword_service.h" |
| 10 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 return hotword_service && hotword_service->IsServiceAvailable(); | 37 return hotword_service && hotword_service->IsServiceAvailable(); |
| 38 } | 38 } |
| 39 | 39 |
| 40 // static | 40 // static |
| 41 bool HotwordServiceFactory::IsHotwordAllowed(BrowserContext* context) { | 41 bool HotwordServiceFactory::IsHotwordAllowed(BrowserContext* context) { |
| 42 HotwordService* hotword_service = GetForProfile(context); | 42 HotwordService* hotword_service = GetForProfile(context); |
| 43 return hotword_service && hotword_service->IsHotwordAllowed(); | 43 return hotword_service && hotword_service->IsHotwordAllowed(); |
| 44 } | 44 } |
| 45 | 45 |
| 46 // static | 46 // static |
| 47 bool HotwordServiceFactory::RetryHotwordExtension(Profile* profile) { | 47 int HotwordServiceFactory::GetCurrentError(BrowserContext* context) { |
| 48 HotwordService* hotword_service = GetForProfile(profile); | 48 HotwordService* hotword_service = GetForProfile(context); |
| 49 return hotword_service && hotword_service->RetryHotwordExtension(); | 49 if (!hotword_service) |
| 50 return 0; |
| 51 return hotword_service->error_message(); |
| 50 } | 52 } |
| 51 | 53 |
| 52 HotwordServiceFactory::HotwordServiceFactory() | 54 HotwordServiceFactory::HotwordServiceFactory() |
| 53 : BrowserContextKeyedServiceFactory( | 55 : BrowserContextKeyedServiceFactory( |
| 54 "HotwordService", | 56 "HotwordService", |
| 55 BrowserContextDependencyManager::GetInstance()) { | 57 BrowserContextDependencyManager::GetInstance()) { |
| 56 // No dependencies. | 58 // No dependencies. |
| 57 } | 59 } |
| 58 | 60 |
| 59 HotwordServiceFactory::~HotwordServiceFactory() { | 61 HotwordServiceFactory::~HotwordServiceFactory() { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 72 // also confirm that they wish this preference to be true or opt out of it. | 74 // also confirm that they wish this preference to be true or opt out of it. |
| 73 prefs->RegisterBooleanPref(prefs::kHotwordAudioLoggingEnabled, | 75 prefs->RegisterBooleanPref(prefs::kHotwordAudioLoggingEnabled, |
| 74 true, | 76 true, |
| 75 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 77 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
| 76 } | 78 } |
| 77 | 79 |
| 78 KeyedService* HotwordServiceFactory::BuildServiceInstanceFor( | 80 KeyedService* HotwordServiceFactory::BuildServiceInstanceFor( |
| 79 BrowserContext* context) const { | 81 BrowserContext* context) const { |
| 80 return new HotwordService(Profile::FromBrowserContext(context)); | 82 return new HotwordService(Profile::FromBrowserContext(context)); |
| 81 } | 83 } |
| OLD | NEW |