190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// found in the LICENSE file.
490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "apps/saved_files_service_factory.h"
690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "apps/saved_files_service.h"
890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "chrome/browser/profiles/profile.h"
9a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "components/keyed_service/content/browser_context_dependency_manager.h"
1090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
1190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)namespace apps {
1290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
1390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// static
1490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)SavedFilesService* SavedFilesServiceFactory::GetForProfile(Profile* profile) {
1590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  return static_cast<SavedFilesService*>(
1690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)      GetInstance()->GetServiceForBrowserContext(profile, true));
1790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)}
1890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
1990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// static
2090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)SavedFilesServiceFactory* SavedFilesServiceFactory::GetInstance() {
2190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  return Singleton<SavedFilesServiceFactory>::get();
2290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)}
2390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
2490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)SavedFilesServiceFactory::SavedFilesServiceFactory()
2590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)    : BrowserContextKeyedServiceFactory(
2690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)          "SavedFilesService",
2790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)          BrowserContextDependencyManager::GetInstance()) {}
2890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
2990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)SavedFilesServiceFactory::~SavedFilesServiceFactory() {}
3090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
31a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)KeyedService* SavedFilesServiceFactory::BuildServiceInstanceFor(
3290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)    content::BrowserContext* profile) const {
3390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  return new SavedFilesService(static_cast<Profile*>(profile));
3490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)}
3590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
3690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)}  // namespace apps
37