Commit 51a18cc1 authored by Gyuyoung Kim's avatar Gyuyoung Kim Committed by Commit Bot

Use mojom::ManifestShareTarget_Method instead of Manifest::ShareTarget::Method

This CL replaces all uses of blink::Manifest::ShareTarget::Method
with blink::mojom::ManifestShareTarget_Method in order to reduce type
conversion between them.

Bug: 919392
Change-Id: Id248941c750f0dd0b627c556e58a561a93ec8448
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2521883
Commit-Queue: Gyuyoung Kim <gyuyoung@igalia.com>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#825272}
parent 149e6762
......@@ -39,7 +39,7 @@ struct ShareTargetParams {
// https://wicg.github.io/web-share-target/#dom-sharetarget
struct ShareTarget {
GURL action;
blink::Manifest::ShareTarget::Method method;
blink::mojom::ManifestShareTarget_Method method;
blink::Manifest::ShareTarget::Enctype enctype;
ShareTargetParams params;
ShareTarget();
......
......@@ -211,7 +211,7 @@ std::unique_ptr<std::string> BuildProtoInBackground(
webapk::ShareTarget* share_target = web_app_manifest->add_share_targets();
share_target->set_action(shortcut_info.share_target->action.spec());
if (shortcut_info.share_target->method ==
blink::Manifest::ShareTarget::Method::kPost) {
blink::mojom::ManifestShareTarget_Method::kPost) {
share_target->set_method("POST");
} else {
share_target->set_method("GET");
......
......@@ -235,7 +235,7 @@ void WebApkUpdateDataFetcher::OnGotIconMurmur2Hashes(
java_share_params_is_method_post =
(info_.share_target->method ==
blink::Manifest::ShareTarget::Method::kPost);
blink::mojom::ManifestShareTarget_Method::kPost);
java_share_params_is_enctype_multipart =
(info_.share_target->enctype ==
blink::Manifest::ShareTarget::Enctype::kMultipartFormData);
......
......@@ -113,8 +113,8 @@ static void JNI_WebApkUpdateManager_StoreWebApkUpdateRequestToFile(
ConvertJavaStringToUTF16(java_share_target_param_text);
info.share_target->method =
java_share_target_param_is_method_post == JNI_TRUE
? blink::Manifest::ShareTarget::Method::kPost
: blink::Manifest::ShareTarget::Method::kGet;
? blink::mojom::ManifestShareTarget_Method::kPost
: blink::mojom::ManifestShareTarget_Method::kGet;
info.share_target->enctype =
java_share_target_param_is_enctype_multipart == JNI_TRUE
......
......@@ -128,11 +128,11 @@ UpdateShortcutsMenuItemInfosFromManifest(
}
apps::ShareTarget::Method ToAppsShareTargetMethod(
blink::Manifest::ShareTarget::Method method) {
blink::mojom::ManifestShareTarget_Method method) {
switch (method) {
case blink::Manifest::ShareTarget::Method::kGet:
case blink::mojom::ManifestShareTarget_Method::kGet:
return apps::ShareTarget::Method::kGet;
case blink::Manifest::ShareTarget::Method::kPost:
case blink::mojom::ManifestShareTarget_Method::kPost:
return apps::ShareTarget::Method::kPost;
}
NOTREACHED();
......
......@@ -210,7 +210,7 @@ TEST(WebAppInstallUtils, UpdateWebAppInfoFromManifest_ShareTarget) {
{
blink::Manifest::ShareTarget share_target;
share_target.action = GURL("http://example.com/share1");
share_target.method = blink::Manifest::ShareTarget::Method::kPost;
share_target.method = blink::mojom::ManifestShareTarget_Method::kPost;
share_target.enctype =
blink::Manifest::ShareTarget::Enctype::kMultipartFormData;
share_target.params.title = base::ASCIIToUTF16("kTitle");
......@@ -247,7 +247,7 @@ TEST(WebAppInstallUtils, UpdateWebAppInfoFromManifest_ShareTarget) {
{
blink::Manifest::ShareTarget share_target;
share_target.action = GURL("http://example.com/share2");
share_target.method = blink::Manifest::ShareTarget::Method::kGet;
share_target.method = blink::mojom::ManifestShareTarget_Method::kGet;
share_target.enctype =
blink::Manifest::ShareTarget::Enctype::kFormUrlEncoded;
share_target.params.text = base::ASCIIToUTF16("kText");
......
......@@ -15,7 +15,7 @@
#include "services/device/public/mojom/screen_orientation_lock_types.mojom-shared.h"
#include "third_party/blink/public/common/common_export.h"
#include "third_party/blink/public/mojom/manifest/display_mode.mojom.h"
#include "third_party/blink/public/mojom/manifest/manifest.mojom-forward.h"
#include "third_party/blink/public/mojom/manifest/manifest.mojom-shared.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/geometry/size.h"
#include "url/gurl.h"
......@@ -86,11 +86,6 @@ struct BLINK_COMMON_EXPORT Manifest {
// Structure representing how a Web Share target handles an incoming share.
struct BLINK_COMMON_EXPORT ShareTarget {
enum class Method {
kGet,
kPost,
};
enum class Enctype {
kFormUrlEncoded,
kMultipartFormData,
......@@ -104,7 +99,7 @@ struct BLINK_COMMON_EXPORT Manifest {
GURL action;
// The HTTP request method for the web share target.
Method method;
blink::mojom::ManifestShareTarget_Method method;
// The way that share data is encoded in "POST" request.
Enctype enctype;
......
......@@ -290,7 +290,7 @@ struct BLINK_COMMON_EXPORT
const ::blink::Manifest::ShareTarget& share_target) {
return share_target.action;
}
static ::blink::Manifest::ShareTarget::Method method(
static ::blink::mojom::ManifestShareTarget_Method method(
const ::blink::Manifest::ShareTarget& share_target) {
return share_target.method;
}
......@@ -343,35 +343,6 @@ struct BLINK_COMMON_EXPORT
::blink::Manifest::ProtocolHandler* out);
};
template <>
struct BLINK_COMMON_EXPORT EnumTraits<blink::mojom::ManifestShareTarget_Method,
::blink::Manifest::ShareTarget::Method> {
static blink::mojom::ManifestShareTarget_Method ToMojom(
::blink::Manifest::ShareTarget::Method method) {
switch (method) {
case ::blink::Manifest::ShareTarget::Method::kGet:
return blink::mojom::ManifestShareTarget_Method::kGet;
case ::blink::Manifest::ShareTarget::Method::kPost:
return blink::mojom::ManifestShareTarget_Method::kPost;
}
NOTREACHED();
return blink::mojom::ManifestShareTarget_Method::kGet;
}
static bool FromMojom(blink::mojom::ManifestShareTarget_Method input,
::blink::Manifest::ShareTarget::Method* out) {
switch (input) {
case blink::mojom::ManifestShareTarget_Method::kGet:
*out = ::blink::Manifest::ShareTarget::Method::kGet;
return true;
case blink::mojom::ManifestShareTarget_Method::kPost:
*out = ::blink::Manifest::ShareTarget::Method::kPost;
return true;
}
return false;
}
};
template <>
struct BLINK_COMMON_EXPORT EnumTraits<blink::mojom::ManifestShareTarget_Enctype,
::blink::Manifest::ShareTarget::Enctype> {
......
......@@ -144,15 +144,7 @@ TypeConverter<blink::Manifest::ShareTarget,
return output;
output.action = input->action;
::blink::Manifest::ShareTarget::Method output_method;
if (!EnumTraits<
blink::mojom::ManifestShareTarget_Method,
::blink::Manifest::ShareTarget::Method>::FromMojom(input->method,
&output_method)) {
NOTREACHED();
}
output.method = output_method;
output.method = input->method;
::blink::Manifest::ShareTarget::Enctype output_enctype;
if (!EnumTraits<blink::mojom::ManifestShareTarget_Enctype,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment