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

Unified Diff: content/common/service_worker/service_worker_type_converters.cc

Issue 2678273011: Move service_worker_type_converters to content/renderer to avoid WebString() usage in browser (Closed)
Patch Set: move _type_converter security OWNERS entry to renderer/ too 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/service_worker/service_worker_type_converters.h ('k') | content/renderer/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/service_worker/service_worker_type_converters.cc
diff --git a/content/common/service_worker/service_worker_type_converters.cc b/content/common/service_worker/service_worker_type_converters.cc
deleted file mode 100644
index e54bbe90a0b05bb30ff875cc4377fbf0512ad662..0000000000000000000000000000000000000000
--- a/content/common/service_worker/service_worker_type_converters.cc
+++ /dev/null
@@ -1,129 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/common/service_worker/service_worker_type_converters.h"
-
-#include "base/logging.h"
-
-namespace mojo {
-
-// TODO(iclelland): Make these enums equivalent so that conversion can be a
-// static cast.
-content::ServiceWorkerStatusCode
-TypeConverter<content::ServiceWorkerStatusCode,
- blink::mojom::ServiceWorkerEventStatus>::
- Convert(blink::mojom::ServiceWorkerEventStatus status) {
- content::ServiceWorkerStatusCode status_code;
- if (status == blink::mojom::ServiceWorkerEventStatus::COMPLETED) {
- status_code = content::SERVICE_WORKER_OK;
- } else if (status == blink::mojom::ServiceWorkerEventStatus::REJECTED) {
- status_code = content::SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED;
- } else if (status == blink::mojom::ServiceWorkerEventStatus::ABORTED) {
- status_code = content::SERVICE_WORKER_ERROR_ABORT;
- } else {
- // We received an unexpected value back. This can theoretically happen as
- // mojo doesn't validate enum values.
- status_code = content::SERVICE_WORKER_ERROR_IPC_FAILED;
- }
- return status_code;
-}
-
-blink::WebPaymentAppRequest
-TypeConverter<blink::WebPaymentAppRequest,
- payments::mojom::PaymentAppRequestPtr>::
- Convert(const payments::mojom::PaymentAppRequestPtr& input) {
- blink::WebPaymentAppRequest output;
-
- output.origin = blink::WebString::fromUTF8(input->origin.spec());
-
- output.methodData =
- blink::WebVector<blink::WebPaymentMethodData>(input->methodData.size());
- for (size_t i = 0; i < input->methodData.size(); i++) {
- output.methodData[i] = mojo::ConvertTo<blink::WebPaymentMethodData>(
- std::move(input->methodData[i]));
- }
-
- output.total = mojo::ConvertTo<blink::WebPaymentItem>(input->total);
-
- output.modifiers = blink::WebVector<blink::WebPaymentDetailsModifier>(
- input->modifiers.size());
- for (size_t i = 0; i < input->modifiers.size(); i++) {
- output.modifiers[i] =
- mojo::ConvertTo<blink::WebPaymentDetailsModifier>(input->modifiers[i]);
- }
-
- output.optionId = blink::WebString::fromUTF8(input->optionId);
-
- return output;
-}
-
-blink::WebPaymentMethodData
-TypeConverter<blink::WebPaymentMethodData,
- payments::mojom::PaymentMethodDataPtr>::
- Convert(const payments::mojom::PaymentMethodDataPtr& input) {
- blink::WebPaymentMethodData output;
-
- output.supportedMethods =
- blink::WebVector<blink::WebString>(input->supported_methods.size());
- for (size_t i = 0; i < input->supported_methods.size(); i++) {
- output.supportedMethods[i] =
- blink::WebString::fromUTF8(input->supported_methods[i]);
- }
-
- output.stringifiedData = blink::WebString::fromUTF8(input->stringified_data);
-
- return output;
-}
-
-blink::WebPaymentItem
-TypeConverter<blink::WebPaymentItem, payments::mojom::PaymentItemPtr>::Convert(
- const payments::mojom::PaymentItemPtr& input) {
- blink::WebPaymentItem output;
- output.label = blink::WebString::fromUTF8(input->label);
- output.amount =
- mojo::ConvertTo<blink::WebPaymentCurrencyAmount>(input->amount);
- output.pending = input->pending;
- return output;
-}
-
-blink::WebPaymentCurrencyAmount
-TypeConverter<blink::WebPaymentCurrencyAmount,
- payments::mojom::PaymentCurrencyAmountPtr>::
- Convert(const payments::mojom::PaymentCurrencyAmountPtr& input) {
- blink::WebPaymentCurrencyAmount output;
- output.currency = blink::WebString::fromUTF8(input->currency);
- output.value = blink::WebString::fromUTF8(input->value);
- output.currencySystem = blink::WebString::fromUTF8(input->currency_system);
- return output;
-}
-
-blink::WebPaymentDetailsModifier
-TypeConverter<blink::WebPaymentDetailsModifier,
- payments::mojom::PaymentDetailsModifierPtr>::
- Convert(const payments::mojom::PaymentDetailsModifierPtr& input) {
- blink::WebPaymentDetailsModifier output;
-
- output.supportedMethods = blink::WebVector<blink::WebString>(
- input->method_data->supported_methods.size());
- for (size_t i = 0; i < input->method_data->supported_methods.size(); i++) {
- output.supportedMethods[i] =
- blink::WebString::fromUTF8(input->method_data->supported_methods[i]);
- }
-
- output.total = mojo::ConvertTo<blink::WebPaymentItem>(input->total);
-
- output.additionalDisplayItems = blink::WebVector<blink::WebPaymentItem>(
- input->additional_display_items.size());
- for (size_t i = 0; i < input->additional_display_items.size(); i++) {
- output.additionalDisplayItems[i] = mojo::ConvertTo<blink::WebPaymentItem>(
- input->additional_display_items[i]);
- }
-
- output.stringifiedData =
- blink::WebString::fromUTF8(input->method_data->stringified_data);
-
- return output;
-}
-
-} // namespace
« no previous file with comments | « content/common/service_worker/service_worker_type_converters.h ('k') | content/renderer/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698