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

Side by Side Diff: third_party/WebKit/Source/modules/payments/PaymentRequest.cpp

Issue 2131963002: Early return if we find selected shipping option from last. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "modules/payments/PaymentRequest.h" 5 #include "modules/payments/PaymentRequest.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "bindings/core/v8/JSONValuesForV8.h" 8 #include "bindings/core/v8/JSONValuesForV8.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "bindings/core/v8/ScriptState.h" 10 #include "bindings/core/v8/ScriptState.h"
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 methodData->append(PaymentRequest::MethodData(pmd.supportedMethods(), st ringifiedData)); 330 methodData->append(PaymentRequest::MethodData(pmd.supportedMethods(), st ringifiedData));
331 } 331 }
332 } 332 }
333 333
334 String getSelectedShippingOption(const PaymentDetails& details) 334 String getSelectedShippingOption(const PaymentDetails& details)
335 { 335 {
336 String result; 336 String result;
337 if (!details.hasShippingOptions()) 337 if (!details.hasShippingOptions())
338 return result; 338 return result;
339 339
340 for (size_t i = 0; i < details.shippingOptions().size(); ++i) { 340 for (int i = details.shippingOptions().size() - 1; i >= 0; --i) {
341 if (details.shippingOptions()[i].hasSelected() && details.shippingOption s()[i].selected()) { 341 if (details.shippingOptions()[i].hasSelected() && details.shippingOption s()[i].selected()) {
342 result = details.shippingOptions()[i].id(); 342 result = details.shippingOptions()[i].id();
please use gerrit instead 2016/07/08 13:53:47 return details.shippingOption()[i].id();
pals 2016/07/08 13:58:57 Done.
343 return result;
343 } 344 }
344 } 345 }
345 346
346 return result; 347 return result;
347 } 348 }
348 349
349 } // namespace 350 } // namespace
350 351
351 PaymentRequest* PaymentRequest::create(ScriptState* scriptState, const HeapVecto r<PaymentMethodData>& methodData, const PaymentDetails& details, ExceptionState& exceptionState) 352 PaymentRequest* PaymentRequest::create(ScriptState* scriptState, const HeapVecto r<PaymentMethodData>& methodData, const PaymentDetails& details, ExceptionState& exceptionState)
352 { 353 {
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 { 625 {
625 m_completeResolver.clear(); 626 m_completeResolver.clear();
626 m_showResolver.clear(); 627 m_showResolver.clear();
627 m_abortResolver.clear(); 628 m_abortResolver.clear();
628 if (m_clientBinding.is_bound()) 629 if (m_clientBinding.is_bound())
629 m_clientBinding.Close(); 630 m_clientBinding.Close();
630 m_paymentProvider.reset(); 631 m_paymentProvider.reset();
631 } 632 }
632 633
633 } // namespace blink 634 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698