Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(513)

Side by Side Diff: content/browser/payments/payment_manager.cc

Issue 2785523003: PaymentHandler: Rename PaymentAppManager to PaymentManager. (Closed)
Patch Set: PaymentHandler: Rename PaymentAppManager to PaymentManager. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_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"
11 #include "content/browser/payments/payment_app.pb.h" 11 #include "content/browser/payments/payment_app.pb.h"
12 #include "content/browser/payments/payment_app_context_impl.h" 12 #include "content/browser/payments/payment_app_context_impl.h"
13 #include "content/browser/payments/payment_app_database.h" 13 #include "content/browser/payments/payment_app_database.h"
14 #include "content/browser/service_worker/service_worker_context_wrapper.h" 14 #include "content/browser/service_worker/service_worker_context_wrapper.h"
15 #include "content/browser/service_worker/service_worker_registration.h" 15 #include "content/browser/service_worker/service_worker_registration.h"
16 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
17 17
18 namespace content { 18 namespace content {
19 19
20 PaymentAppManager::~PaymentAppManager() { 20 PaymentManager::~PaymentManager() {
21 DCHECK_CURRENTLY_ON(BrowserThread::IO); 21 DCHECK_CURRENTLY_ON(BrowserThread::IO);
22 } 22 }
23 23
24 PaymentAppManager::PaymentAppManager( 24 PaymentManager::PaymentManager(
25 PaymentAppContextImpl* payment_app_context, 25 PaymentAppContextImpl* payment_app_context,
26 mojo::InterfaceRequest<payments::mojom::PaymentAppManager> request) 26 mojo::InterfaceRequest<payments::mojom::PaymentManager> request)
27 : payment_app_context_(payment_app_context), 27 : payment_app_context_(payment_app_context),
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(&PaymentManager::OnConnectionError, base::Unretained(this)));
35 base::Unretained(this)));
36 } 35 }
37 36
38 void PaymentAppManager::Init(const std::string& scope) { 37 void PaymentManager::Init(const std::string& scope) {
39 DCHECK_CURRENTLY_ON(BrowserThread::IO); 38 DCHECK_CURRENTLY_ON(BrowserThread::IO);
40 scope_ = GURL(scope); 39 scope_ = GURL(scope);
41 } 40 }
42 41
43 void PaymentAppManager::SetManifest( 42 void PaymentManager::SetManifest(
44 payments::mojom::PaymentAppManifestPtr manifest, 43 payments::mojom::PaymentAppManifestPtr manifest,
45 const SetManifestCallback& callback) { 44 const SetManifestCallback& callback) {
46 DCHECK_CURRENTLY_ON(BrowserThread::IO); 45 DCHECK_CURRENTLY_ON(BrowserThread::IO);
47 46
48 // TODO(zino): Should implement requesting a permission for users to allow 47 // TODO(zino): Should implement requesting a permission for users to allow
49 // 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.
50 49
51 payment_app_context_->payment_app_database()->WriteManifest( 50 payment_app_context_->payment_app_database()->WriteManifest(
52 scope_, std::move(manifest), callback); 51 scope_, std::move(manifest), callback);
53 } 52 }
54 53
55 void PaymentAppManager::GetManifest(const GetManifestCallback& callback) { 54 void PaymentManager::GetManifest(const GetManifestCallback& callback) {
56 DCHECK_CURRENTLY_ON(BrowserThread::IO); 55 DCHECK_CURRENTLY_ON(BrowserThread::IO);
57 56
58 payment_app_context_->payment_app_database()->ReadManifest(scope_, callback); 57 payment_app_context_->payment_app_database()->ReadManifest(scope_, callback);
59 } 58 }
60 59
61 void PaymentAppManager::OnConnectionError() { 60 void PaymentManager::OnConnectionError() {
62 DCHECK_CURRENTLY_ON(BrowserThread::IO); 61 DCHECK_CURRENTLY_ON(BrowserThread::IO);
63 payment_app_context_->PaymentAppManagerHadConnectionError(this); 62 payment_app_context_->PaymentManagerHadConnectionError(this);
64 } 63 }
65 64
66 } // namespace content 65 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/payments/payment_manager.h ('k') | content/browser/payments/payment_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698