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

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

Issue 838753004: Re-enable always-on hotwording for m42 on supported hardware. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 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
40 } 40 }
41 41
42 // static 42 // static
43 bool HotwordServiceFactory::IsHotwordAllowed(BrowserContext* context) { 43 bool HotwordServiceFactory::IsHotwordAllowed(BrowserContext* context) {
44 HotwordService* hotword_service = GetForProfile(context); 44 HotwordService* hotword_service = GetForProfile(context);
45 return hotword_service && hotword_service->IsHotwordAllowed(); 45 return hotword_service && hotword_service->IsHotwordAllowed();
46 } 46 }
47 47
48 // static 48 // static
49 bool HotwordServiceFactory::IsHotwordHardwareAvailable() { 49 bool HotwordServiceFactory::IsHotwordHardwareAvailable() {
50 // Temporarily disabling hotword hardware check for M41. Will be
51 // re-enabled for M42.
52 #if 0
53 #if defined(OS_CHROMEOS) 50 #if defined(OS_CHROMEOS)
54 if (chromeos::CrasAudioHandler::IsInitialized()) { 51 if (chromeos::CrasAudioHandler::IsInitialized()) {
55 chromeos::AudioDeviceList devices; 52 chromeos::AudioDeviceList devices;
56 chromeos::CrasAudioHandler::Get()->GetAudioDevices(&devices); 53 chromeos::CrasAudioHandler::Get()->GetAudioDevices(&devices);
57 for (size_t i = 0; i < devices.size(); ++i) { 54 for (size_t i = 0; i < devices.size(); ++i) {
58 if (devices[i].type == chromeos::AUDIO_TYPE_AOKR) { 55 if (devices[i].type == chromeos::AUDIO_TYPE_AOKR) {
59 DCHECK(devices[i].is_input); 56 DCHECK(devices[i].is_input);
60 return true; 57 return true;
61 } 58 }
62 } 59 }
63 } 60 }
64 #endif 61 #endif
65 #endif // 0
66 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 62 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
67 return command_line->HasSwitch(switches::kEnableExperimentalHotwordHardware); 63 return command_line->HasSwitch(switches::kEnableExperimentalHotwordHardware);
68 } 64 }
69 65
70 // static 66 // static
71 int HotwordServiceFactory::GetCurrentError(BrowserContext* context) { 67 int HotwordServiceFactory::GetCurrentError(BrowserContext* context) {
72 HotwordService* hotword_service = GetForProfile(context); 68 HotwordService* hotword_service = GetForProfile(context);
73 if (!hotword_service) 69 if (!hotword_service)
74 return 0; 70 return 0;
75 return hotword_service->error_message(); 71 return hotword_service->error_message();
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 133 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
138 prefs->RegisterBooleanPref(prefs::kHotwordAlwaysOnNotificationSeen, 134 prefs->RegisterBooleanPref(prefs::kHotwordAlwaysOnNotificationSeen,
139 false, 135 false,
140 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 136 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
141 } 137 }
142 138
143 KeyedService* HotwordServiceFactory::BuildServiceInstanceFor( 139 KeyedService* HotwordServiceFactory::BuildServiceInstanceFor(
144 BrowserContext* context) const { 140 BrowserContext* context) const {
145 return new HotwordService(Profile::FromBrowserContext(context)); 141 return new HotwordService(Profile::FromBrowserContext(context));
146 } 142 }
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