| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 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. | |
| 4 | |
| 5 #include "ios/chrome/browser/enhanced_bookmarks/bookmark_image_service_factory.h
" | |
| 6 | |
| 7 #include "base/memory/singleton.h" | |
| 8 #include "components/keyed_service/ios/browser_state_dependency_manager.h" | |
| 9 #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h" | |
| 10 #include "ios/chrome/browser/enhanced_bookmarks/bookmark_image_service_ios.h" | |
| 11 #include "ios/chrome/browser/enhanced_bookmarks/enhanced_bookmark_model_factory.
h" | |
| 12 #include "ios/public/provider/chrome/browser/browser_state/chrome_browser_state.
h" | |
| 13 #include "ios/web/public/web_thread.h" | |
| 14 | |
| 15 // static | |
| 16 BookmarkImageServiceIOS* BookmarkImageServiceFactory::GetForBrowserState( | |
| 17 ios::ChromeBrowserState* browser_state) { | |
| 18 return static_cast<BookmarkImageServiceIOS*>( | |
| 19 GetInstance()->GetServiceForBrowserState(browser_state, true)); | |
| 20 } | |
| 21 | |
| 22 // static | |
| 23 BookmarkImageServiceFactory* BookmarkImageServiceFactory::GetInstance() { | |
| 24 return Singleton<BookmarkImageServiceFactory>::get(); | |
| 25 } | |
| 26 | |
| 27 BookmarkImageServiceFactory::BookmarkImageServiceFactory() | |
| 28 : BrowserStateKeyedServiceFactory( | |
| 29 "BookmarkImageService", | |
| 30 BrowserStateDependencyManager::GetInstance()) { | |
| 31 DependsOn(enhanced_bookmarks::EnhancedBookmarkModelFactory::GetInstance()); | |
| 32 } | |
| 33 | |
| 34 BookmarkImageServiceFactory::~BookmarkImageServiceFactory() { | |
| 35 } | |
| 36 | |
| 37 scoped_ptr<KeyedService> BookmarkImageServiceFactory::BuildServiceInstanceFor( | |
| 38 web::BrowserState* context) const { | |
| 39 DCHECK(!context->IsOffTheRecord()); | |
| 40 ios::ChromeBrowserState* browser_state = | |
| 41 ios::ChromeBrowserState::FromBrowserState(context); | |
| 42 return make_scoped_ptr(new BookmarkImageServiceIOS( | |
| 43 browser_state->GetStatePath(), | |
| 44 enhanced_bookmarks::EnhancedBookmarkModelFactory::GetForBrowserState( | |
| 45 browser_state), | |
| 46 browser_state->GetRequestContext(), web::WebThread::GetBlockingPool())); | |
| 47 } | |
| 48 | |
| 49 web::BrowserState* BookmarkImageServiceFactory::GetBrowserStateToUse( | |
| 50 web::BrowserState* context) const { | |
| 51 return context; | |
| 52 } | |
| OLD | NEW |