forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WebShareTargetV2] Support launching the new web share target with PO…
…ST request. This is the second CL for web share target V2. The goal of this CL is to implement the new web share target launcher according to the new web share target spec. https://pr-preview.s3.amazonaws.com/ewilligers/web-share-target/pull/53.html#launching-the-web-share-target There're three main parts of this CL that are put together: 1) Parse the fields received from the android manifest on the server-side 2) Perform the files-matching, which involves matching the share files with with share target files entries that accept the same mime type. 3) Launch the web share target. Specifically, this involves the additional step of generating the POST request. There're two possible encoding types for the POST request: Multipart/form-data encoding and application/x-www-form-urlencoded, both of which are implemented inside a new file named webapk_post_share_target_navigator.cc. It performs all the encoding/escaping needed for the two encoding methods. One additional function is added to mime_util.cc in order to support the multipart/form-data POST request. Change-Id: I719af0dc33fe64561963ae9aecc9d01192f1c17a Reviewed-on: https://chromium-review.googlesource.com/c/1271776 Commit-Queue: Ethan Xu <xuethan@google.com> Reviewed-by: Bence Béky <bnc@chromium.org> Reviewed-by: Peter Kotwicz <pkotwicz@chromium.org> Reviewed-by: Dominick Ng <dominickn@chromium.org> Reviewed-by: Eric Willigers <ericwilligers@chromium.org> Cr-Commit-Position: refs/heads/master@{#611877}
- Loading branch information
Ethan Xu
authored and
Commit Bot
committed
Nov 28, 2018
1 parent
43363a6
commit c4740ea
Showing
23 changed files
with
958 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
.../android/java/src/org/chromium/chrome/browser/webapps/WebApkPostShareTargetNavigator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright 2018 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. | ||
|
||
package org.chromium.chrome.browser.webapps; | ||
|
||
import org.chromium.content_public.browser.WebContents; | ||
|
||
/** | ||
* Perform navigation for share target with POST request. | ||
*/ | ||
public class WebApkPostShareTargetNavigator { | ||
public static boolean navigateIfPostShareTarget( | ||
WebApkInfo webApkInfo, WebContents webContents) { | ||
WebApkShareTargetUtil.PostData postData = WebApkShareTargetUtil.computePostData( | ||
webApkInfo.webApkPackageName(), webApkInfo.shareData()); | ||
if (postData == null) { | ||
return false; | ||
} | ||
nativeLoadViewForShareTargetPost(postData.isMultipartEncoding, postData.names, | ||
postData.values, postData.filenames, postData.types, webApkInfo.uri().toString(), | ||
webContents); | ||
return true; | ||
} | ||
|
||
private static native void nativeLoadViewForShareTargetPost(boolean isMultipartEncoding, | ||
String[] names, byte[][] values, String[] filenames, String[] types, String startUrl, | ||
WebContents webContents); | ||
} |
Oops, something went wrong.