Commit 29d02cc3 authored by Pete Williamson's avatar Pete Williamson Committed by Commit Bot

Better fix for bug 829099.

We were crashing if we ended up failing to publish a page when sharing.
An initial fix repaired it by sharing an item that was invalid in such
a way as to fail silently.

Initially I thought that the share callback needed to always be called
to continue processing and report failures.  However, all it does is to
share the item in the callback.  Therfore, a better fix is to just not
call the callback if there is some failure, as opposed to making sure
that we call it with an item which will fail to share.

Bug: 829099
Change-Id: I9b25cb67480a822cbbe8cef1b39d687fce076af1
Reviewed-on: https://chromium-review.googlesource.com/1098382Reviewed-by: default avatarYafei Duan <romax@chromium.org>
Commit-Queue: Peter Williamson <petewil@chromium.org>
Cr-Commit-Position: refs/heads/master@{#566925}
parent 42c0d706
......@@ -500,13 +500,8 @@ public class OfflinePageUtils {
public static void sharePublishedPage(OfflinePageItem page, final Activity activity,
final Callback<ShareParams> shareCallback) {
if (page == null) {
// Set share directly to true and the source component name to null to indicate failure,
// causing ShareHelper.share() to return.
ShareParams shareParams = new ShareParams.Builder(activity, "", "")
.setShareDirectly(true)
.setSourcePackageName(null)
.build();
shareCallback.onResult(shareParams);
// For errors, we don't call the shareCallback. The callback only causes the page to be
// shared, and does not report errors, and is not needed to continue processing.
return;
}
final String pageUrl = page.getUrl();
......
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