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

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

Issue 2668903003: Replace WTF::emptyString{16Bit}() with a static global (Closed)
Patch Set: Replace WTF::emptyString{16Bit}() with a static global Created 3 years, 10 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 "modules/payments/PaymentAppManager.h" 5 #include "modules/payments/PaymentAppManager.h"
6 6
7 #include "bindings/core/v8/ScriptPromise.h" 7 #include "bindings/core/v8/ScriptPromise.h"
8 #include "bindings/core/v8/ScriptState.h" 8 #include "bindings/core/v8/ScriptState.h"
9 #include "core/dom/DOMException.h" 9 #include "core/dom/DOMException.h"
10 #include "modules/payments/PaymentAppManifest.h" 10 #include "modules/payments/PaymentAppManifest.h"
11 #include "modules/payments/PaymentAppOption.h" 11 #include "modules/payments/PaymentAppOption.h"
12 #include "modules/serviceworkers/ServiceWorkerRegistration.h" 12 #include "modules/serviceworkers/ServiceWorkerRegistration.h"
13 #include "platform/mojo/MojoHelper.h" 13 #include "platform/mojo/MojoHelper.h"
14 #include "public/platform/InterfaceProvider.h" 14 #include "public/platform/InterfaceProvider.h"
15 #include "public/platform/Platform.h" 15 #include "public/platform/Platform.h"
16 16
17 namespace mojo { 17 namespace mojo {
18 18
19 using payments::mojom::blink::PaymentAppManifest; 19 using payments::mojom::blink::PaymentAppManifest;
20 using payments::mojom::blink::PaymentAppManifestPtr; 20 using payments::mojom::blink::PaymentAppManifestPtr;
21 using payments::mojom::blink::PaymentAppOption; 21 using payments::mojom::blink::PaymentAppOption;
22 using payments::mojom::blink::PaymentAppOptionPtr; 22 using payments::mojom::blink::PaymentAppOptionPtr;
23 23
24 template <> 24 template <>
25 struct TypeConverter<PaymentAppOptionPtr, blink::PaymentAppOption> { 25 struct TypeConverter<PaymentAppOptionPtr, blink::PaymentAppOption> {
26 static PaymentAppOptionPtr Convert(const blink::PaymentAppOption& input) { 26 static PaymentAppOptionPtr Convert(const blink::PaymentAppOption& input) {
27 PaymentAppOptionPtr output = PaymentAppOption::New(); 27 PaymentAppOptionPtr output = PaymentAppOption::New();
28 output->name = input.hasName() ? input.name() : WTF::emptyString(); 28 output->name = input.hasName() ? input.name() : WTF::emptyString;
29 output->icon = input.hasIcon() ? input.icon() : WTF::String(); 29 output->icon = input.hasIcon() ? input.icon() : WTF::String();
30 output->id = input.hasId() ? input.id() : WTF::emptyString(); 30 output->id = input.hasId() ? input.id() : WTF::emptyString;
31 if (input.hasEnabledMethods()) { 31 if (input.hasEnabledMethods()) {
32 output->enabled_methods = 32 output->enabled_methods =
33 WTF::Vector<WTF::String>(input.enabledMethods()); 33 WTF::Vector<WTF::String>(input.enabledMethods());
34 } 34 }
35 return output; 35 return output;
36 } 36 }
37 }; 37 };
38 38
39 template <> 39 template <>
40 struct TypeConverter<PaymentAppManifestPtr, blink::PaymentAppManifest> { 40 struct TypeConverter<PaymentAppManifestPtr, blink::PaymentAppManifest> {
41 static PaymentAppManifestPtr Convert(const blink::PaymentAppManifest& input) { 41 static PaymentAppManifestPtr Convert(const blink::PaymentAppManifest& input) {
42 PaymentAppManifestPtr output = PaymentAppManifest::New(); 42 PaymentAppManifestPtr output = PaymentAppManifest::New();
43 output->name = input.hasName() ? input.name() : WTF::emptyString(); 43 output->name = input.hasName() ? input.name() : WTF::emptyString;
44 output->icon = input.hasIcon() ? input.icon() : WTF::String(); 44 output->icon = input.hasIcon() ? input.icon() : WTF::String();
45 if (input.hasOptions()) { 45 if (input.hasOptions()) {
46 for (size_t i = 0; i < input.options().size(); ++i) { 46 for (size_t i = 0; i < input.options().size(); ++i) {
47 output->options.push_back(PaymentAppOption::From(input.options()[i])); 47 output->options.push_back(PaymentAppOption::From(input.options()[i]));
48 } 48 }
49 } 49 }
50 return output; 50 return output;
51 } 51 }
52 }; 52 };
53 53
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 195
196 void PaymentAppManager::onServiceConnectionError() { 196 void PaymentAppManager::onServiceConnectionError() {
197 if (!Platform::current()) { 197 if (!Platform::current()) {
198 return; 198 return;
199 } 199 }
200 200
201 m_manager.reset(); 201 m_manager.reset();
202 } 202 }
203 203
204 } // namespace blink 204 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698