OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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/payments/ios_can_make_payment_query_factory.h" |
| 6 |
| 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/memory/singleton.h" |
| 9 #include "components/keyed_service/ios/browser_state_dependency_manager.h" |
| 10 #include "components/payments/core/can_make_payment_query.h" |
| 11 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| 12 #include "ios/web/public/browser_state.h" |
| 13 |
| 14 // static |
| 15 IOSCanMakePaymentQueryFactory* IOSCanMakePaymentQueryFactory::GetInstance() { |
| 16 return base::Singleton<IOSCanMakePaymentQueryFactory>::get(); |
| 17 } |
| 18 |
| 19 payments::CanMakePaymentQuery* |
| 20 IOSCanMakePaymentQueryFactory::GetForBrowserState( |
| 21 ios::ChromeBrowserState* browser_state) { |
| 22 return static_cast<payments::CanMakePaymentQuery*>( |
| 23 GetInstance()->GetServiceForBrowserState(browser_state, true)); |
| 24 } |
| 25 |
| 26 IOSCanMakePaymentQueryFactory::IOSCanMakePaymentQueryFactory() |
| 27 : BrowserStateKeyedServiceFactory( |
| 28 "CanMakePaymentQuery", |
| 29 BrowserStateDependencyManager::GetInstance()) {} |
| 30 |
| 31 IOSCanMakePaymentQueryFactory::~IOSCanMakePaymentQueryFactory() {} |
| 32 |
| 33 std::unique_ptr<KeyedService> |
| 34 IOSCanMakePaymentQueryFactory::BuildServiceInstanceFor( |
| 35 web::BrowserState* context) const { |
| 36 return base::WrapUnique(new payments::CanMakePaymentQuery); |
| 37 } |
OLD | NEW |