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 "content/shell/browser/layout_test/layout_test_payment_app_provider_imp l.h" | |
6 | |
7 #include <string> | |
8 | |
9 #include "base/memory/ptr_util.h" | |
10 #include "content/public/browser/payment_app_provider.h" | |
11 #include "content/public/test/layouttest_support.h" | |
12 #include "content/shell/browser/layout_test/layout_test_content_browser_client.h " | |
13 #include "content/shell/browser/shell_browser_context.h" | |
14 #include "mojo/public/cpp/bindings/strong_binding.h" | |
15 | |
16 namespace content { | |
17 namespace { | |
18 | |
19 void GetAllManifestsCallback( | |
20 const LayoutTestPaymentAppProviderImpl::GetAllPaymentAppIDsCallback& | |
21 callback, | |
22 PaymentAppProvider::Manifests manifests) { | |
23 std::vector<int64_t> ids; | |
please use gerrit instead
2017/01/23 13:28:07
#include <vector>
zino
2017/01/23 17:31:08
Done.
| |
24 for (const auto& manifest : manifests) { | |
25 ids.push_back(manifest.first); | |
26 } | |
27 callback.Run(ids); | |
28 } | |
29 | |
30 } // namespace | |
31 | |
32 LayoutTestPaymentAppProviderImpl::LayoutTestPaymentAppProviderImpl() {} | |
33 | |
34 LayoutTestPaymentAppProviderImpl::~LayoutTestPaymentAppProviderImpl() {} | |
35 | |
36 // static | |
37 void LayoutTestPaymentAppProviderImpl::Create( | |
38 mojom::LayoutTestPaymentAppProviderRequest request) { | |
39 mojo::MakeStrongBinding(base::MakeUnique<LayoutTestPaymentAppProviderImpl>(), | |
40 std::move(request)); | |
please use gerrit instead
2017/01/23 13:28:07
#include <utility>
zino
2017/01/23 17:31:08
Done.
| |
41 } | |
42 | |
43 void LayoutTestPaymentAppProviderImpl::GetAllPaymentAppIDs( | |
44 const GetAllPaymentAppIDsCallback& callback) { | |
45 BrowserContext* browser_context = | |
46 LayoutTestContentBrowserClient::Get()->browser_context(); | |
47 PaymentAppProvider::GetInstance()->GetAllManifests( | |
48 browser_context, base::Bind(&GetAllManifestsCallback, callback)); | |
49 } | |
50 | |
51 void LayoutTestPaymentAppProviderImpl::InvokePaymentApp( | |
52 int64_t registration_id) { | |
53 payments::mojom::PaymentAppRequestDataPtr data = | |
54 payments::mojom::PaymentAppRequestData::New(); | |
55 data->methodData.push_back(payments::mojom::PaymentMethodData::New()); | |
56 data->total = payments::mojom::PaymentItem::New(); | |
57 data->total->amount = payments::mojom::PaymentCurrencyAmount::New(); | |
58 | |
59 content::PaymentAppProvider::GetInstance()->InvokePaymentApp( | |
60 LayoutTestContentBrowserClient::Get()->browser_context(), registration_id, | |
61 std::move(data)); | |
62 } | |
63 | |
64 } // namespace content | |
OLD | NEW |