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

Side by Side Diff: components/payments/payment_request.mojom

Issue 2500183002: Do not parse JSON in the browser. (Closed)
Patch Set: Created 4 years, 1 month 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 [JavaPackage="org.chromium.payments.mojom"] 5 [JavaPackage="org.chromium.payments.mojom"]
6 module payments.mojom; 6 module payments.mojom;
7 7
8 // The shipping address that the browser process provides to the renderer 8 // The shipping address that the browser process provides to the renderer
9 // process. Built either by the browser or a payment app. 9 // process. Built either by the browser or a payment app.
10 struct PaymentAddress { 10 struct PaymentAddress {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 }; 120 };
121 121
122 struct PaymentOptions { 122 struct PaymentOptions {
123 bool request_payer_name; 123 bool request_payer_name;
124 bool request_payer_email; 124 bool request_payer_email;
125 bool request_payer_phone; 125 bool request_payer_phone;
126 bool request_shipping; 126 bool request_shipping;
127 PaymentShippingType shipping_type; 127 PaymentShippingType shipping_type;
128 }; 128 };
129 129
130 enum AndroidPayEnvironment {
131 PRODUCTION,
132 TEST
133 };
134
135 enum AndroidPayCardNetwork {
136 UNKNOWN,
137 AMEX,
138 DISCOVER,
139 MASTERCARD,
140 VISA
141 };
142
143 enum AndroidPayTokenization {
144 UNSPECIFIED,
145 GATEWAY_TOKEN,
146 NETWORK_TOKEN
147 };
148
149 struct AndroidPayTokenizationParameter {
150 string? key;
151 string? value;
152 };
153
130 struct PaymentMethodData { 154 struct PaymentMethodData {
131 array<string> supported_methods; 155 array<string> supported_methods;
156
132 // A JSON string built by the renderer from a JavaScript object that the 157 // A JSON string built by the renderer from a JavaScript object that the
133 // merchant website provides. The renderer uses 158 // merchant website provides. The renderer uses
134 // blink::JSONObject::toJSONString() to generate this string. The browser 159 // blink::JSONObject::toJSONString() to generate this string. The browser does
135 // parses the string via JSONObject(JsonSanitizer.sanitize(stringified_data)) 160 // not parse the string and passes it as-is directly to payment apps. There's
136 // and passes a part of the JSON object to the payment app, for example 161 // no one format for this object, so richer types cannot be used. A simple
137 // Android Pay. There's no one format for this object, so richer types cannot 162 // example:
138 // be used. A simple example:
139 // 163 //
140 // {"gateway": "stripe"} 164 // {"gateway": "stripe"}
141 string stringified_data; 165 string stringified_data;
166
167 // Android Pay specific method data is parsed in the renderer.
168 // https://developers.google.com/web/fundamentals/getting-started/primers/paym ent-request/android-pay
169 // TODO(rouslan): Stop parsing Android Pay data. http://crbug.com/620173
170 AndroidPayEnvironment environment;
171 string? merchant_name;
172 string? merchant_id;
173 array<AndroidPayCardNetwork> allowed_card_networks;
174 AndroidPayTokenization tokenization_type;
175 array<AndroidPayTokenizationParameter?> parameters;
142 }; 176 };
143 177
144 enum PaymentComplete { 178 enum PaymentComplete {
145 SUCCESS, 179 SUCCESS,
146 FAIL, 180 FAIL,
147 UNKNOWN 181 UNKNOWN
148 }; 182 };
149 183
150 interface PaymentRequest { 184 interface PaymentRequest {
151 Init(PaymentRequestClient client, 185 Init(PaymentRequestClient client,
152 array<PaymentMethodData> methodData, 186 array<PaymentMethodData> methodData,
153 PaymentDetails details, 187 PaymentDetails details,
154 PaymentOptions options); 188 PaymentOptions options);
155 Show(); 189 Show();
156 UpdateWith(PaymentDetails details); 190 UpdateWith(PaymentDetails details);
157 Abort(); 191 Abort();
158 Complete(PaymentComplete result); 192 Complete(PaymentComplete result);
159 }; 193 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698