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

Side by Side Diff: components/payments/content/payment_request_web_contents_manager.cc

Issue 2866623003: PaymentRequest.canMakePayment() query quota on desktop. (Closed)
Patch Set: frame Created 3 years, 7 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 2017 The Chromium Authors. All rights reserved. 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 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 "components/payments/content/payment_request_web_contents_manager.h" 5 #include "components/payments/content/payment_request_web_contents_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 10 matching lines...) Expand all
21 PaymentRequestWebContentsManager* 21 PaymentRequestWebContentsManager*
22 PaymentRequestWebContentsManager::GetOrCreateForWebContents( 22 PaymentRequestWebContentsManager::GetOrCreateForWebContents(
23 content::WebContents* web_contents) { 23 content::WebContents* web_contents) {
24 DCHECK(web_contents); 24 DCHECK(web_contents);
25 // CreateForWebContents does nothing if the manager instance already exists. 25 // CreateForWebContents does nothing if the manager instance already exists.
26 PaymentRequestWebContentsManager::CreateForWebContents(web_contents); 26 PaymentRequestWebContentsManager::CreateForWebContents(web_contents);
27 return PaymentRequestWebContentsManager::FromWebContents(web_contents); 27 return PaymentRequestWebContentsManager::FromWebContents(web_contents);
28 } 28 }
29 29
30 void PaymentRequestWebContentsManager::CreatePaymentRequest( 30 void PaymentRequestWebContentsManager::CreatePaymentRequest(
31 content::RenderFrameHost* render_frame_host,
31 content::WebContents* web_contents, 32 content::WebContents* web_contents,
32 std::unique_ptr<PaymentRequestDelegate> delegate, 33 std::unique_ptr<PaymentRequestDelegate> delegate,
33 mojo::InterfaceRequest<payments::mojom::PaymentRequest> request, 34 mojo::InterfaceRequest<payments::mojom::PaymentRequest> request,
34 PaymentRequest::ObserverForTest* observer_for_testing) { 35 PaymentRequest::ObserverForTest* observer_for_testing) {
35 auto new_request = base::MakeUnique<PaymentRequest>( 36 auto new_request = base::MakeUnique<PaymentRequest>(
36 web_contents, std::move(delegate), this, std::move(request), 37 render_frame_host, web_contents, std::move(delegate), this,
37 observer_for_testing); 38 std::move(request), observer_for_testing);
38 PaymentRequest* request_ptr = new_request.get(); 39 PaymentRequest* request_ptr = new_request.get();
39 payment_requests_.insert(std::make_pair(request_ptr, std::move(new_request))); 40 payment_requests_.insert(std::make_pair(request_ptr, std::move(new_request)));
40 } 41 }
41 42
42 void PaymentRequestWebContentsManager::DestroyRequest(PaymentRequest* request) { 43 void PaymentRequestWebContentsManager::DestroyRequest(PaymentRequest* request) {
43 if (request == showing_) 44 if (request == showing_)
44 showing_ = nullptr; 45 showing_ = nullptr;
45 payment_requests_.erase(request); 46 payment_requests_.erase(request);
46 } 47 }
47 48
48 bool PaymentRequestWebContentsManager::CanShow(PaymentRequest* request) { 49 bool PaymentRequestWebContentsManager::CanShow(PaymentRequest* request) {
49 DCHECK(request); 50 DCHECK(request);
50 DCHECK(payment_requests_.find(request) != payment_requests_.end()); 51 DCHECK(payment_requests_.find(request) != payment_requests_.end());
51 if (!showing_) { 52 if (!showing_) {
52 showing_ = request; 53 showing_ = request;
53 return true; 54 return true;
54 } else { 55 } else {
55 return false; 56 return false;
56 } 57 }
57 } 58 }
58 59
59 PaymentRequestWebContentsManager::PaymentRequestWebContentsManager( 60 PaymentRequestWebContentsManager::PaymentRequestWebContentsManager(
60 content::WebContents* web_contents) 61 content::WebContents* web_contents)
61 : showing_(nullptr) {} 62 : showing_(nullptr) {}
62 63
63 } // namespace payments 64 } // namespace payments
OLDNEW
« no previous file with comments | « components/payments/content/payment_request_web_contents_manager.h ('k') | components/payments/core/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698