OLD | NEW |
---|---|
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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
107 import org.chromium.chrome.browser.partnercustomizations.PartnerBrowserCustomiza tions; | 107 import org.chromium.chrome.browser.partnercustomizations.PartnerBrowserCustomiza tions; |
108 import org.chromium.chrome.browser.physicalweb.PhysicalWebShareActivity; | 108 import org.chromium.chrome.browser.physicalweb.PhysicalWebShareActivity; |
109 import org.chromium.chrome.browser.preferences.ChromePreferenceManager; | 109 import org.chromium.chrome.browser.preferences.ChromePreferenceManager; |
110 import org.chromium.chrome.browser.preferences.PrefServiceBridge; | 110 import org.chromium.chrome.browser.preferences.PrefServiceBridge; |
111 import org.chromium.chrome.browser.preferences.PreferencesLauncher; | 111 import org.chromium.chrome.browser.preferences.PreferencesLauncher; |
112 import org.chromium.chrome.browser.printing.PrintShareActivity; | 112 import org.chromium.chrome.browser.printing.PrintShareActivity; |
113 import org.chromium.chrome.browser.printing.TabPrinter; | 113 import org.chromium.chrome.browser.printing.TabPrinter; |
114 import org.chromium.chrome.browser.share.OptionalShareTargetsManager; | 114 import org.chromium.chrome.browser.share.OptionalShareTargetsManager; |
115 import org.chromium.chrome.browser.share.ShareActivity; | 115 import org.chromium.chrome.browser.share.ShareActivity; |
116 import org.chromium.chrome.browser.share.ShareHelper; | 116 import org.chromium.chrome.browser.share.ShareHelper; |
117 import org.chromium.chrome.browser.share.ShareParams; | |
117 import org.chromium.chrome.browser.snackbar.BottomContainer; | 118 import org.chromium.chrome.browser.snackbar.BottomContainer; |
118 import org.chromium.chrome.browser.snackbar.DataReductionPromoSnackbarController ; | 119 import org.chromium.chrome.browser.snackbar.DataReductionPromoSnackbarController ; |
119 import org.chromium.chrome.browser.snackbar.DataUseSnackbarController; | 120 import org.chromium.chrome.browser.snackbar.DataUseSnackbarController; |
120 import org.chromium.chrome.browser.snackbar.SnackbarManager; | 121 import org.chromium.chrome.browser.snackbar.SnackbarManager; |
121 import org.chromium.chrome.browser.snackbar.SnackbarManager.SnackbarManageable; | 122 import org.chromium.chrome.browser.snackbar.SnackbarManager.SnackbarManageable; |
122 import org.chromium.chrome.browser.sync.ProfileSyncService; | 123 import org.chromium.chrome.browser.sync.ProfileSyncService; |
123 import org.chromium.chrome.browser.sync.SyncController; | 124 import org.chromium.chrome.browser.sync.SyncController; |
124 import org.chromium.chrome.browser.tab.Tab; | 125 import org.chromium.chrome.browser.tab.Tab; |
125 import org.chromium.chrome.browser.tabmodel.AsyncTabParamsManager; | 126 import org.chromium.chrome.browser.tabmodel.AsyncTabParamsManager; |
126 import org.chromium.chrome.browser.tabmodel.EmptyTabModel; | 127 import org.chromium.chrome.browser.tabmodel.EmptyTabModel; |
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1285 | 1286 |
1286 RecordHistogram.recordBooleanHistogram( | 1287 RecordHistogram.recordBooleanHistogram( |
1287 "OfflinePages.SharedPageWasOffline", OfflinePageUtils.isOfflineP age(currentTab)); | 1288 "OfflinePages.SharedPageWasOffline", OfflinePageUtils.isOfflineP age(currentTab)); |
1288 boolean canShareOfflinePage = OfflinePageBridge.isPageSharingEnabled(); | 1289 boolean canShareOfflinePage = OfflinePageBridge.isPageSharingEnabled(); |
1289 | 1290 |
1290 // Share an empty blockingUri in place of screenshot file. The file read y notification is | 1291 // Share an empty blockingUri in place of screenshot file. The file read y notification is |
1291 // sent by onScreenshotReady call below when the file is written. | 1292 // sent by onScreenshotReady call below when the file is written. |
1292 final Uri blockingUri = (isIncognito || webContents == null) | 1293 final Uri blockingUri = (isIncognito || webContents == null) |
1293 ? null | 1294 ? null |
1294 : ChromeFileProvider.generateUriAndBlockAccess(mainActivity); | 1295 : ChromeFileProvider.generateUriAndBlockAccess(mainActivity); |
1296 boolean saveLastUsed = shareDirectly ? false : true; | |
Yusuf
2017/06/02 20:07:46
!
ltian
2017/06/02 23:44:39
Done.
| |
1297 ShareParams.Builder builder = | |
1298 new ShareParams.Builder(mainActivity, currentTab.getTitle(), cur rentTab.getUrl()) | |
1299 .setShareDirectly(shareDirectly) | |
1300 .setSaveLastUsed(saveLastUsed) | |
Yusuf
2017/06/02 20:07:46
how about !shareDirectly here?
But the question s
ltian
2017/06/02 23:44:39
For offline discussion, we will merge them into on
| |
1301 .setScreenshotUri(blockingUri); | |
1295 if (canShareOfflinePage) { | 1302 if (canShareOfflinePage) { |
1296 OfflinePageUtils.shareOfflinePage(shareDirectly, true, mainActivity, null, | 1303 OfflinePageUtils.shareOfflinePage(builder, currentTab); |
1297 blockingUri, null, currentTab); | |
1298 } else { | 1304 } else { |
1299 ShareHelper.share(shareDirectly, true, mainActivity, currentTab.getT itle(), null, | 1305 ShareHelper.share(builder.build()); |
1300 currentTab.getUrl(), null, blockingUri, null); | |
1301 if (shareDirectly) { | 1306 if (shareDirectly) { |
1302 RecordUserAction.record("MobileMenuDirectShare"); | 1307 RecordUserAction.record("MobileMenuDirectShare"); |
1303 } else { | 1308 } else { |
1304 RecordUserAction.record("MobileMenuShare"); | 1309 RecordUserAction.record("MobileMenuShare"); |
1305 } | 1310 } |
1306 } | 1311 } |
1307 | 1312 |
1308 if (blockingUri == null) return; | 1313 if (blockingUri == null) return; |
1309 | 1314 |
1310 // Start screenshot capture and notify the provider when it is ready. | 1315 // Start screenshot capture and notify the provider when it is ready. |
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2217 return false; | 2222 return false; |
2218 } | 2223 } |
2219 | 2224 |
2220 /** | 2225 /** |
2221 * @return the reference pool for this activity. | 2226 * @return the reference pool for this activity. |
2222 */ | 2227 */ |
2223 public DiscardableReferencePool getReferencePool() { | 2228 public DiscardableReferencePool getReferencePool() { |
2224 return mReferencePool; | 2229 return mReferencePool; |
2225 } | 2230 } |
2226 } | 2231 } |
OLD | NEW |