cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / ios / chrome / browser / bookmarks / bookmark_client_factory.cc
blobfbb1fa6907210410731e934a2fe8c38db7dfe310
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/bookmark_client_factory.h"
7 #include "base/memory/singleton.h"
8 #include "components/keyed_service/core/service_access_type.h"
9 #include "components/keyed_service/ios/browser_state_dependency_manager.h"
10 #include "ios/chrome/browser/bookmarks/bookmark_client_impl.h"
11 #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h"
12 #include "ios/public/provider/chrome/browser/browser_state/chrome_browser_state.h"
13 #include "ios/public/provider/chrome/browser/keyed_service_provider.h"
15 namespace {
17 scoped_ptr<KeyedService> BuildBookmarkClientImpl(web::BrowserState* context) {
18 ios::ChromeBrowserState* browser_state =
19 ios::ChromeBrowserState::FromBrowserState(context);
20 return make_scoped_ptr(new BookmarkClientImpl(
21 browser_state,
22 ios::GetKeyedServiceProvider()->GetManagedBookmarkServiceForBrowserState(
23 browser_state)));
26 } // namespace
28 // static
29 BookmarkClientImpl* BookmarkClientFactory::GetForBrowserState(
30 ios::ChromeBrowserState* browser_state) {
31 return static_cast<BookmarkClientImpl*>(
32 GetInstance()->GetServiceForBrowserState(browser_state, true));
35 // static
36 BookmarkClientFactory* BookmarkClientFactory::GetInstance() {
37 return Singleton<BookmarkClientFactory>::get();
40 // static
41 BrowserStateKeyedServiceFactory::TestingFactoryFunction
42 BookmarkClientFactory::GetDefaultFactory() {
43 return &BuildBookmarkClientImpl;
46 BookmarkClientFactory::BookmarkClientFactory()
47 : BrowserStateKeyedServiceFactory(
48 "BookmarkClient",
49 BrowserStateDependencyManager::GetInstance()) {
50 DependsOn(ios::GetKeyedServiceProvider()->GetManagedBookmarkServiceFactory());
53 BookmarkClientFactory::~BookmarkClientFactory() {}
55 scoped_ptr<KeyedService> BookmarkClientFactory::BuildServiceInstanceFor(
56 web::BrowserState* context) const {
57 return BuildBookmarkClientImpl(context).Pass();
60 web::BrowserState* BookmarkClientFactory::GetBrowserStateToUse(
61 web::BrowserState* context) const {
62 return GetBrowserStateRedirectedInIncognito(context);
65 bool BookmarkClientFactory::ServiceIsNULLWhileTesting() const {
66 return true;