Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / ios / chrome / browser / bookmarks / startup_task_runner_service_factory.cc
blob79614509ded3a18e7dfbbf3e839c1b7a1e9da0eb
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ios/chrome/browser/bookmarks/startup_task_runner_service_factory.h"
7 #include "base/memory/singleton.h"
8 #include "base/sequenced_task_runner.h"
9 #include "components/bookmarks/browser/startup_task_runner_service.h"
10 #include "components/keyed_service/ios/browser_state_dependency_manager.h"
11 #include "ios/public/provider/chrome/browser/browser_state/chrome_browser_state.h"
13 namespace ios {
15 // static
16 bookmarks::StartupTaskRunnerService*
17 StartupTaskRunnerServiceFactory::GetForBrowserState(
18 ios::ChromeBrowserState* browser_state) {
19 return static_cast<bookmarks::StartupTaskRunnerService*>(
20 GetInstance()->GetServiceForBrowserState(browser_state, true));
23 // static
24 StartupTaskRunnerServiceFactory*
25 StartupTaskRunnerServiceFactory::GetInstance() {
26 return Singleton<StartupTaskRunnerServiceFactory>::get();
29 StartupTaskRunnerServiceFactory::StartupTaskRunnerServiceFactory()
30 : BrowserStateKeyedServiceFactory(
31 "StartupTaskRunnerService",
32 BrowserStateDependencyManager::GetInstance()) {
35 StartupTaskRunnerServiceFactory::~StartupTaskRunnerServiceFactory() {
38 scoped_ptr<KeyedService>
39 StartupTaskRunnerServiceFactory::BuildServiceInstanceFor(
40 web::BrowserState* context) const {
41 ios::ChromeBrowserState* browser_state =
42 ios::ChromeBrowserState::FromBrowserState(context);
43 return make_scoped_ptr(new bookmarks::StartupTaskRunnerService(
44 browser_state->GetIOTaskRunner()));
47 } // namespace ios