Chromium Code Reviews| Index: components/wifi_sync/wifi_credential_syncable_service_factory.cc |
| diff --git a/components/wifi_sync/wifi_credential_syncable_service_factory.cc b/components/wifi_sync/wifi_credential_syncable_service_factory.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c3b4aeffb9e2fc7406c9d3d917db6561fbfdc2d1 |
| --- /dev/null |
| +++ b/components/wifi_sync/wifi_credential_syncable_service_factory.cc |
| @@ -0,0 +1,42 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "components/wifi_sync/wifi_credential_syncable_service_factory.h" |
| + |
| +#include "chrome/browser/profiles/profile.h" |
| +#include "components/keyed_service/content/browser_context_dependency_manager.h" |
| +#include "components/wifi_sync/wifi_credential_syncable_service.h" |
| + |
| +namespace wifi_sync { |
| + |
| +// static |
| +WifiCredentialSyncableService* |
| +WifiCredentialSyncableServiceFactory::GetForProfile(Profile* profile) { |
| + return static_cast<WifiCredentialSyncableService*>( |
| + GetInstance()->GetServiceForBrowserContext(profile, true)); |
| +} |
| + |
| +// static |
| +WifiCredentialSyncableServiceFactory* |
| +WifiCredentialSyncableServiceFactory::GetInstance() { |
| + return Singleton<WifiCredentialSyncableServiceFactory>::get(); |
| +} |
| + |
| +WifiCredentialSyncableServiceFactory::WifiCredentialSyncableServiceFactory() |
| + : BrowserContextKeyedServiceFactory( |
| + "WifiCredentialSyncableService", |
| + BrowserContextDependencyManager::GetInstance()) { |
| +} |
| + |
| +WifiCredentialSyncableServiceFactory::~WifiCredentialSyncableServiceFactory() { |
| +} |
| + |
| +KeyedService* WifiCredentialSyncableServiceFactory::BuildServiceInstanceFor( |
| + content::BrowserContext* context) const { |
| + // TODO(quiche): Figure out if this behaves properly for multi-profile. |
| + // crbug.com/430681. |
|
stevenjb
2014/11/12 21:30:44
Hmm, we probably need to add a helper method to sr
mukesh agrawal
2014/11/13 16:24:59
I'd guess that asserting is too strong, because it
stevenjb
2014/11/13 22:55:35
Unfortunately ProfileHelper is in src/chrome so we
mukesh agrawal
2014/11/14 02:14:54
I take it the idea is that components shouldn't de
|
| + return new WifiCredentialSyncableService(context); |
| +} |
| + |
| +} // namespace wifi_sync |