12a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
22a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
32a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// found in the LICENSE file.
42a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
52a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer_factory.h"
62a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
72a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.h"
82a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "chrome/browser/extensions/extension_system_factory.h"
9c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#include "chrome/browser/profiles/profile.h"
102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "chrome/browser/sync_file_system/sync_file_system_service_factory.h"
1190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace extensions {
142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// static
162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)ExtensionSyncEventObserver*
172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)ExtensionSyncEventObserverFactory::GetForProfile(Profile* profile) {
182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  return static_cast<ExtensionSyncEventObserver*>(
1990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)      GetInstance()->GetServiceForBrowserContext(profile, true));
202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}
212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// static
232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)ExtensionSyncEventObserverFactory*
242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)ExtensionSyncEventObserverFactory::GetInstance() {
252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  return Singleton<ExtensionSyncEventObserverFactory>::get();
262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}
272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)ExtensionSyncEventObserverFactory::ExtensionSyncEventObserverFactory()
2990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)    : BrowserContextKeyedServiceFactory(
3090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)        "ExtensionSyncEventObserver",
3190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)        BrowserContextDependencyManager::GetInstance()) {
322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  DependsOn(sync_file_system::SyncFileSystemServiceFactory::GetInstance());
332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  DependsOn(ExtensionSystemFactory::GetInstance());
342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}
352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)ExtensionSyncEventObserverFactory::~ExtensionSyncEventObserverFactory() {}
372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
3890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)BrowserContextKeyedService*
3990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)ExtensionSyncEventObserverFactory::BuildServiceInstanceFor(
40c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)    content::BrowserContext* profile) const {
41c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  return new ExtensionSyncEventObserver(static_cast<Profile*>(profile));
422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}
432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}  // namespace extensions
45