|
|
Chromium Code Reviews|
Created:
4 years, 4 months ago by Matt Giuca Modified:
4 years, 4 months ago Reviewers:
David Trainor- moved to gerrit CC:
chromium-reviews, chrome-apps-syd-reviews_chromium.org, Ted C, gone Base URL:
https://chromium.googlesource.com/chromium/src.git@master Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
Descriptionnavigator.share: Resolve promise only after user chooses a target.
Previously, would immediately resolve as soon as the share dialog was
shown. This introduces a new issue where the promise *never* resolves
or rejects if the user cancels the share picker (I'm not sure how to do
this or if it's even possible).
Introduces a bunch of new functionality in the ShareHelper class to
support this new use case.
Reland of https://crrev.com/410511 (to fix https://crbug.com/637194).
BUG=595608, 637194
Committed: https://crrev.com/906820b686d31b48d8c75e89ec3fe67b5c9f36b0
Cr-Commit-Position: refs/heads/master@{#412175}
Patch Set 1 #Patch Set 2 : Fix compile (tests). #
Total comments: 1
Patch Set 3 : Fix pre-LMR1 share picker to work like the LMR1 version. #
Total comments: 4
Patch Set 4 : Rebase. #Patch Set 5 : Respond to review. #Patch Set 6 : Rebase. #Patch Set 7 : Null-check callback. Fixes crbug.com/637194. #
Messages
Total messages: 40 (26 generated)
The CQ bit was checked by mgiuca@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_android_rel_ng on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/linux_androi...)
The CQ bit was checked by mgiuca@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
mgiuca@chromium.org changed reviewers: + dtrainor@chromium.org
Hi David, (+cc Ted who has done recent work on ShareHelper; Dan who reviewed my previous CL) I want to add new share functionality (triggered from the navigator.share API). In my previous CL I just wrote my own intent sender (as you can see in the deleted code for this CL). But now I want a lot more functionality that overlaps with ShareHelper so I've decided to reuse ShareHelper. This means adding a bunch more arguments and features to ShareHelper: 1. Ability to say "please don't save my choice in the last-choice pref." 2. Ability to supply an arbitrary text string, not just a URL. 3. Ability to pass a callback and get notified when chosen. If you think these changes to ShareHelper are too severe, I could just copy the code and implement my own, but I think the code reuse benefit outweighs the extra arguments. I'm happy to help further refactor ShareHelper in the future. WDYT? https://codereview.chromium.org/2203273002/diff/20001/chrome/android/java/src... File chrome/android/java/src/org/chromium/chrome/browser/share/ShareHelper.java (right): https://codereview.chromium.org/2203273002/diff/20001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/share/ShareHelper.java:498: text = text + " " + url; On reflection, this seems a bit specific to my use case. It might be best to remove the |url| argument entirely and just have text. Move the call to DomDistillerUrlUtils out to ChromeActivity (where it is specific to the existing Share menu use case).
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by mgiuca@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
On 2016/08/03 08:31:31, Matt Giuca wrote: > Hi David, > > (+cc Ted who has done recent work on ShareHelper; Dan who reviewed my previous > CL) > > I want to add new share functionality (triggered from the navigator.share API). > In my previous CL I just wrote my own intent sender (as you can see in the > deleted code for this CL). But now I want a lot more functionality that overlaps > with ShareHelper so I've decided to reuse ShareHelper. > > This means adding a bunch more arguments and features to ShareHelper: > 1. Ability to say "please don't save my choice in the last-choice pref." > 2. Ability to supply an arbitrary text string, not just a URL. > 3. Ability to pass a callback and get notified when chosen. > > If you think these changes to ShareHelper are too severe, I could just copy the > code and implement my own, but I think the code reuse benefit outweighs the > extra arguments. I'm happy to help further refactor ShareHelper in the future. > WDYT? > > https://codereview.chromium.org/2203273002/diff/20001/chrome/android/java/src... > File chrome/android/java/src/org/chromium/chrome/browser/share/ShareHelper.java > (right): > > https://codereview.chromium.org/2203273002/diff/20001/chrome/android/java/src... > chrome/android/java/src/org/chromium/chrome/browser/share/ShareHelper.java:498: > text = text + " " + url; > On reflection, this seems a bit specific to my use case. It might be best to > remove the |url| argument entirely and just have text. Move the call to > DomDistillerUrlUtils out to ChromeActivity (where it is specific to the existing > Share menu use case). Posted some relatively small nits. I'm fine with you sharing the code. Yeah I think making share just take an arbitrary string and allowing you to supply what you want makes more sense too :).
gah forgot to publish https://codereview.chromium.org/2203273002/diff/40001/chrome/android/java/src... File chrome/android/java/src/org/chromium/chrome/browser/share/ShareHelper.java (right): https://codereview.chromium.org/2203273002/diff/40001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/share/ShareHelper.java:498: if (url != null && url.length() > 0) { !TextUtils.isEmpty(url)? Same for below? https://codereview.chromium.org/2203273002/diff/40001/chrome/android/java/src... File chrome/android/java/src/org/chromium/chrome/browser/webshare/ShareServiceImpl.java (right): https://codereview.chromium.org/2203273002/diff/40001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/webshare/ShareServiceImpl.java:23: private final WindowAndroid mWindow; Do we still need to save mWindow now?
Thanks. https://codereview.chromium.org/2203273002/diff/40001/chrome/android/java/src... File chrome/android/java/src/org/chromium/chrome/browser/share/ShareHelper.java (right): https://codereview.chromium.org/2203273002/diff/40001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/share/ShareHelper.java:498: if (url != null && url.length() > 0) { On 2016/08/05 16:06:54, David Trainor wrote: > !TextUtils.isEmpty(url)? Same for below? Done. https://codereview.chromium.org/2203273002/diff/40001/chrome/android/java/src... File chrome/android/java/src/org/chromium/chrome/browser/webshare/ShareServiceImpl.java (right): https://codereview.chromium.org/2203273002/diff/40001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/webshare/ShareServiceImpl.java:23: private final WindowAndroid mWindow; On 2016/08/05 16:06:54, David Trainor wrote: > Do we still need to save mWindow now? Huh, I guess not. Done.
The CQ bit was checked by mgiuca@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
lgtm. I'd still support pulling out url and text and making that the choice of the caller though!
On 2016/08/08 23:03:31, David Trainor wrote: > lgtm. I'd still support pulling out url and text and making that the choice of > the caller though! Indeed; I'll do that in a follow-up if you don't mind.
The CQ bit was checked by mgiuca@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Committed patchset #5 (id:80001)
Message was sent while issue was closed.
Description was changed from ========== navigator.share: Resolve promise only after user chooses a target. Previously, would immediately resolve as soon as the share dialog was shown. This introduces a new issue where the promise *never* resolves or rejects if the user cancels the share picker (I'm not sure how to do this or if it's even possible). Introduces a bunch of new functionality in the ShareHelper class to support this new use case. BUG=595608 ========== to ========== navigator.share: Resolve promise only after user chooses a target. Previously, would immediately resolve as soon as the share dialog was shown. This introduces a new issue where the promise *never* resolves or rejects if the user cancels the share picker (I'm not sure how to do this or if it's even possible). Introduces a bunch of new functionality in the ShareHelper class to support this new use case. BUG=595608 Committed: https://crrev.com/610f5e1ea1b1b38926263489d3d235fc834686de Cr-Commit-Position: refs/heads/master@{#410511} ==========
Message was sent while issue was closed.
Patchset 5 (id:??) landed as https://crrev.com/610f5e1ea1b1b38926263489d3d235fc834686de Cr-Commit-Position: refs/heads/master@{#410511}
Message was sent while issue was closed.
A revert of this CL (patchset #5 id:80001) has been created in https://codereview.chromium.org/2241303002/ by amineer@chromium.org. The reason for reverting is: Looks to be causing a large number of crashes, see crbug.com/637194..
Message was sent while issue was closed.
Description was changed from ========== navigator.share: Resolve promise only after user chooses a target. Previously, would immediately resolve as soon as the share dialog was shown. This introduces a new issue where the promise *never* resolves or rejects if the user cancels the share picker (I'm not sure how to do this or if it's even possible). Introduces a bunch of new functionality in the ShareHelper class to support this new use case. BUG=595608 Committed: https://crrev.com/610f5e1ea1b1b38926263489d3d235fc834686de Cr-Commit-Position: refs/heads/master@{#410511} ========== to ========== navigator.share: Resolve promise only after user chooses a target. Previously, would immediately resolve as soon as the share dialog was shown. This introduces a new issue where the promise *never* resolves or rejects if the user cancels the share picker (I'm not sure how to do this or if it's even possible). Introduces a bunch of new functionality in the ShareHelper class to support this new use case. BUG=595608,637194 Reland of https://crrev.com/410511 (to fix https://crbug.com/637194). ==========
Message was sent while issue was closed.
Description was changed from ========== navigator.share: Resolve promise only after user chooses a target. Previously, would immediately resolve as soon as the share dialog was shown. This introduces a new issue where the promise *never* resolves or rejects if the user cancels the share picker (I'm not sure how to do this or if it's even possible). Introduces a bunch of new functionality in the ShareHelper class to support this new use case. BUG=595608,637194 Reland of https://crrev.com/410511 (to fix https://crbug.com/637194). ========== to ========== navigator.share: Resolve promise only after user chooses a target. Previously, would immediately resolve as soon as the share dialog was shown. This introduces a new issue where the promise *never* resolves or rejects if the user cancels the share picker (I'm not sure how to do this or if it's even possible). Introduces a bunch of new functionality in the ShareHelper class to support this new use case. Reland of https://crrev.com/410511 (to fix https://crbug.com/637194). BUG=595608,637194 ==========
Message was sent while issue was closed.
Patchset #6 (id:100001) has been deleted
Thanks, Alex. Re-opening with a new patch set that fixes the crash.
The CQ bit was checked by mgiuca@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from dtrainor@chromium.org Link to the patchset: https://codereview.chromium.org/2203273002/#ps140001 (title: "Null-check callback. Fixes crbug.com/637194.")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Description was changed from ========== navigator.share: Resolve promise only after user chooses a target. Previously, would immediately resolve as soon as the share dialog was shown. This introduces a new issue where the promise *never* resolves or rejects if the user cancels the share picker (I'm not sure how to do this or if it's even possible). Introduces a bunch of new functionality in the ShareHelper class to support this new use case. Reland of https://crrev.com/410511 (to fix https://crbug.com/637194). BUG=595608,637194 ========== to ========== navigator.share: Resolve promise only after user chooses a target. Previously, would immediately resolve as soon as the share dialog was shown. This introduces a new issue where the promise *never* resolves or rejects if the user cancels the share picker (I'm not sure how to do this or if it's even possible). Introduces a bunch of new functionality in the ShareHelper class to support this new use case. Reland of https://crrev.com/410511 (to fix https://crbug.com/637194). BUG=595608,637194 ==========
Message was sent while issue was closed.
Committed patchset #7 (id:140001)
Message was sent while issue was closed.
Description was changed from ========== navigator.share: Resolve promise only after user chooses a target. Previously, would immediately resolve as soon as the share dialog was shown. This introduces a new issue where the promise *never* resolves or rejects if the user cancels the share picker (I'm not sure how to do this or if it's even possible). Introduces a bunch of new functionality in the ShareHelper class to support this new use case. Reland of https://crrev.com/410511 (to fix https://crbug.com/637194). BUG=595608,637194 ========== to ========== navigator.share: Resolve promise only after user chooses a target. Previously, would immediately resolve as soon as the share dialog was shown. This introduces a new issue where the promise *never* resolves or rejects if the user cancels the share picker (I'm not sure how to do this or if it's even possible). Introduces a bunch of new functionality in the ShareHelper class to support this new use case. Reland of https://crrev.com/410511 (to fix https://crbug.com/637194). BUG=595608,637194 Committed: https://crrev.com/906820b686d31b48d8c75e89ec3fe67b5c9f36b0 Cr-Commit-Position: refs/heads/master@{#412175} ==========
Message was sent while issue was closed.
Patchset 7 (id:??) landed as https://crrev.com/906820b686d31b48d8c75e89ec3fe67b5c9f36b0 Cr-Commit-Position: refs/heads/master@{#412175} |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
