OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/extensions/api/hotword_private/hotword_private_api.h" | 5 #include "chrome/browser/extensions/api/hotword_private/hotword_private_api.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 namespace hotword_private_constants { | 38 namespace hotword_private_constants { |
39 const char kHotwordServiceUnavailable[] = "Hotword Service is unavailable."; | 39 const char kHotwordServiceUnavailable[] = "Hotword Service is unavailable."; |
40 const char kHotwordEventServiceUnavailable[] = | 40 const char kHotwordEventServiceUnavailable[] = |
41 "Hotword Private Event Service is unavailable."; | 41 "Hotword Private Event Service is unavailable."; |
42 } // hotword_private_constants | 42 } // hotword_private_constants |
43 | 43 |
44 namespace OnEnabledChanged = | 44 namespace OnEnabledChanged = |
45 api::hotword_private::OnEnabledChanged; | 45 api::hotword_private::OnEnabledChanged; |
46 | 46 |
47 static base::LazyInstance< | 47 static base::LazyInstance< |
48 BrowserContextKeyedAPIFactory<HotwordPrivateEventService> > g_factory = | 48 BrowserContextKeyedAPIFactory<HotwordPrivateEventService>>::DestructorAtExit |
49 LAZY_INSTANCE_INITIALIZER; | 49 g_factory = LAZY_INSTANCE_INITIALIZER; |
50 | 50 |
51 HotwordPrivateEventService::HotwordPrivateEventService( | 51 HotwordPrivateEventService::HotwordPrivateEventService( |
52 content::BrowserContext* context) | 52 content::BrowserContext* context) |
53 : profile_(Profile::FromBrowserContext(context)) { | 53 : profile_(Profile::FromBrowserContext(context)) { |
54 pref_change_registrar_.Init(profile_->GetPrefs()); | 54 pref_change_registrar_.Init(profile_->GetPrefs()); |
55 pref_change_registrar_.Add( | 55 pref_change_registrar_.Add( |
56 prefs::kHotwordSearchEnabled, | 56 prefs::kHotwordSearchEnabled, |
57 base::Bind(&HotwordPrivateEventService::OnEnabledChanged, | 57 base::Bind(&HotwordPrivateEventService::OnEnabledChanged, |
58 base::Unretained(this))); | 58 base::Unretained(this))); |
59 pref_change_registrar_.Add( | 59 pref_change_registrar_.Add( |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 HotwordService* hotword_service = HotwordServiceFactory::GetForProfile( | 531 HotwordService* hotword_service = HotwordServiceFactory::GetForProfile( |
532 Profile::FromBrowserContext(browser_context())); | 532 Profile::FromBrowserContext(browser_context())); |
533 if (!hotword_service) | 533 if (!hotword_service) |
534 return RespondNow(Error(kUnknownErrorDoNotUse)); | 534 return RespondNow(Error(kUnknownErrorDoNotUse)); |
535 | 535 |
536 hotword_service->SpeakerModelExistsComplete(params->exists); | 536 hotword_service->SpeakerModelExistsComplete(params->exists); |
537 return RespondNow(NoArguments()); | 537 return RespondNow(NoArguments()); |
538 } | 538 } |
539 | 539 |
540 } // namespace extensions | 540 } // namespace extensions |
OLD | NEW |