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 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 40 scope_ = GURL(scope); |
| 41 } |
| 42 |
38 void PaymentAppManager::SetManifest( | 43 void PaymentAppManager::SetManifest( |
39 const std::string& scope, | |
40 payments::mojom::PaymentAppManifestPtr manifest, | 44 payments::mojom::PaymentAppManifestPtr manifest, |
41 const SetManifestCallback& callback) { | 45 const SetManifestCallback& callback) { |
42 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 46 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
43 | 47 |
44 // TODO(zino): Should implement requesting a permission for users to allow | 48 // TODO(zino): Should implement requesting a permission for users to allow |
45 // the payment app to be registered. Please see http://crbug.com/665949. | 49 // the payment app to be registered. Please see http://crbug.com/665949. |
46 | 50 |
47 payment_app_context_->payment_app_database()->WriteManifest( | 51 payment_app_context_->payment_app_database()->WriteManifest( |
48 GURL(scope), std::move(manifest), callback); | 52 scope_, std::move(manifest), callback); |
49 } | 53 } |
50 | 54 |
51 void PaymentAppManager::GetManifest(const std::string& scope, | 55 void PaymentAppManager::GetManifest(const GetManifestCallback& callback) { |
52 const GetManifestCallback& callback) { | |
53 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 56 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
54 | 57 |
55 payment_app_context_->payment_app_database()->ReadManifest(GURL(scope), | 58 payment_app_context_->payment_app_database()->ReadManifest(scope_, callback); |
56 callback); | |
57 } | 59 } |
58 | 60 |
59 void PaymentAppManager::OnConnectionError() { | 61 void PaymentAppManager::OnConnectionError() { |
60 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 62 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
61 payment_app_context_->PaymentAppManagerHadConnectionError(this); | 63 payment_app_context_->PaymentAppManagerHadConnectionError(this); |
62 } | 64 } |
63 | 65 |
64 } // namespace content | 66 } // namespace content |
OLD | NEW |