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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java

Issue 2203273002: navigator.share: Resolve promise only after user chooses a target. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Null-check callback. Fixes crbug.com/637194. Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/share/ShareHelper.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser; 5 package org.chromium.chrome.browser;
6 6
7 import android.annotation.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.annotation.TargetApi; 8 import android.annotation.TargetApi;
9 import android.app.Activity; 9 import android.app.Activity;
10 import android.app.SearchManager; 10 import android.app.SearchManager;
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 public void onFinishGetBitmap(Bitmap bitmap, int response) { 998 public void onFinishGetBitmap(Bitmap bitmap, int response) {
999 // Check whether this page is an offline page, and use i ts online URL if so. 999 // Check whether this page is an offline page, and use i ts online URL if so.
1000 String url = currentTab.getOriginalUrl(); 1000 String url = currentTab.getOriginalUrl();
1001 RecordHistogram.recordBooleanHistogram( 1001 RecordHistogram.recordBooleanHistogram(
1002 "OfflinePages.SharedPageWasOffline", url != null ); 1002 "OfflinePages.SharedPageWasOffline", url != null );
1003 1003
1004 // If there is no entry in the offline pages DB for this tab, use the tab's 1004 // If there is no entry in the offline pages DB for this tab, use the tab's
1005 // URL directly. 1005 // URL directly.
1006 if (url == null) url = currentTab.getUrl(); 1006 if (url == null) url = currentTab.getUrl();
1007 1007
1008 ShareHelper.share( 1008 ShareHelper.share(shareDirectly, true, mainActivity, cur rentTab.getTitle(),
1009 shareDirectly, mainActivity, currentTab.getTitle (), url, bitmap); 1009 null, url, bitmap, null);
1010 if (shareDirectly) { 1010 if (shareDirectly) {
1011 RecordUserAction.record("MobileMenuDirectShare"); 1011 RecordUserAction.record("MobileMenuDirectShare");
1012 } else { 1012 } else {
1013 RecordUserAction.record("MobileMenuShare"); 1013 RecordUserAction.record("MobileMenuShare");
1014 } 1014 }
1015 } 1015 }
1016 }; 1016 };
1017 if (isIncognito || currentTab.getWebContents() == null) { 1017 if (isIncognito || currentTab.getWebContents() == null) {
1018 callback.onFinishGetBitmap(null, ReadbackResponse.SURFACE_UNAVAILABL E); 1018 callback.onFinishGetBitmap(null, ReadbackResponse.SURFACE_UNAVAILABL E);
1019 } else { 1019 } else {
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
1765 "Android.MultiWindowMode.IsTabletScreenWidthBelow600", 1765 "Android.MultiWindowMode.IsTabletScreenWidthBelow600",
1766 mScreenWidthDp < DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP); 1766 mScreenWidthDp < DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP);
1767 1767
1768 if (mScreenWidthDp < DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP) { 1768 if (mScreenWidthDp < DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP) {
1769 RecordHistogram.recordLinearCountHistogram( 1769 RecordHistogram.recordLinearCountHistogram(
1770 "Android.MultiWindowMode.TabletScreenWidth", mScreenWidthDp, 1, 1770 "Android.MultiWindowMode.TabletScreenWidth", mScreenWidthDp, 1,
1771 DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP, 50); 1771 DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP, 50);
1772 } 1772 }
1773 } 1773 }
1774 } 1774 }
OLDNEW
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/share/ShareHelper.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698