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 ShareParams.Builder builder = |
| 1297 new ShareParams.Builder(mainActivity, currentTab.getTitle(), cur
rentTab.getUrl()) |
| 1298 .setShareDirectly(shareDirectly) |
| 1299 .setSaveLastUsed(true) |
| 1300 .setScreenshotUri(blockingUri); |
1295 if (canShareOfflinePage) { | 1301 if (canShareOfflinePage) { |
1296 OfflinePageUtils.shareOfflinePage(shareDirectly, true, mainActivity,
null, | 1302 OfflinePageUtils.shareOfflinePage(builder, currentTab); |
1297 blockingUri, null, currentTab); | |
1298 } else { | 1303 } else { |
1299 ShareHelper.share(shareDirectly, true, mainActivity, currentTab.getT
itle(), null, | 1304 ShareHelper.share(builder.build()); |
1300 currentTab.getUrl(), null, blockingUri, null); | |
1301 if (shareDirectly) { | 1305 if (shareDirectly) { |
1302 RecordUserAction.record("MobileMenuDirectShare"); | 1306 RecordUserAction.record("MobileMenuDirectShare"); |
1303 } else { | 1307 } else { |
1304 RecordUserAction.record("MobileMenuShare"); | 1308 RecordUserAction.record("MobileMenuShare"); |
1305 } | 1309 } |
1306 } | 1310 } |
1307 | 1311 |
1308 if (blockingUri == null) return; | 1312 if (blockingUri == null) return; |
1309 | 1313 |
1310 // Start screenshot capture and notify the provider when it is ready. | 1314 // 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; | 2221 return false; |
2218 } | 2222 } |
2219 | 2223 |
2220 /** | 2224 /** |
2221 * @return the reference pool for this activity. | 2225 * @return the reference pool for this activity. |
2222 */ | 2226 */ |
2223 public DiscardableReferencePool getReferencePool() { | 2227 public DiscardableReferencePool getReferencePool() { |
2224 return mReferencePool; | 2228 return mReferencePool; |
2225 } | 2229 } |
2226 } | 2230 } |
OLD | NEW |