| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/payments/payment_app_manager.h" | 5 #include "content/browser/payments/payment_app_manager.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/optional.h" | 10 #include "base/optional.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 binding_(this, std::move(request)), | 28 binding_(this, std::move(request)), |
| 29 weak_ptr_factory_(this) { | 29 weak_ptr_factory_(this) { |
| 30 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 30 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 31 DCHECK(payment_app_context); | 31 DCHECK(payment_app_context); |
| 32 | 32 |
| 33 binding_.set_connection_error_handler( | 33 binding_.set_connection_error_handler( |
| 34 base::Bind(&PaymentAppManager::OnConnectionError, | 34 base::Bind(&PaymentAppManager::OnConnectionError, |
| 35 base::Unretained(this))); | 35 base::Unretained(this))); |
| 36 } | 36 } |
| 37 | 37 |
| 38 void PaymentAppManager::Init(const std::string& scope) { |
| 39 m_scope = GURL(scope); |
| 40 } |
| 41 |
| 38 void PaymentAppManager::SetManifest( | 42 void PaymentAppManager::SetManifest( |
| 39 const std::string& scope, | |
| 40 payments::mojom::PaymentAppManifestPtr manifest, | 43 payments::mojom::PaymentAppManifestPtr manifest, |
| 41 const SetManifestCallback& callback) { | 44 const SetManifestCallback& callback) { |
| 42 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 45 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 43 | 46 |
| 44 // TODO(zino): Should implement requesting a permission for users to allow | 47 // TODO(zino): Should implement requesting a permission for users to allow |
| 45 // the payment app to be registered. Please see http://crbug.com/665949. | 48 // the payment app to be registered. Please see http://crbug.com/665949. |
| 46 | 49 |
| 47 payment_app_context_->payment_app_database()->WriteManifest( | 50 payment_app_context_->payment_app_database()->WriteManifest( |
| 48 GURL(scope), std::move(manifest), callback); | 51 m_scope, std::move(manifest), callback); |
| 49 } | 52 } |
| 50 | 53 |
| 51 void PaymentAppManager::GetManifest(const std::string& scope, | 54 void PaymentAppManager::GetManifest(const GetManifestCallback& callback) { |
| 52 const GetManifestCallback& callback) { | |
| 53 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 55 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 54 | 56 |
| 55 payment_app_context_->payment_app_database()->ReadManifest(GURL(scope), | 57 payment_app_context_->payment_app_database()->ReadManifest(m_scope, callback); |
| 56 callback); | |
| 57 } | 58 } |
| 58 | 59 |
| 59 void PaymentAppManager::OnConnectionError() { | 60 void PaymentAppManager::OnConnectionError() { |
| 60 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 61 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 61 payment_app_context_->PaymentAppManagerHadConnectionError(this); | 62 payment_app_context_->PaymentAppManagerHadConnectionError(this); |
| 62 } | 63 } |
| 63 | 64 |
| 64 } // namespace content | 65 } // namespace content |
| OLD | NEW |