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

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

Issue 2917703004: [Android] Wrap all share parameters into the ShareParams class (Closed)
Patch Set: Update based on Matt's comments. Created 3 years, 6 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/offlinepages/OfflinePageUtils.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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1289 1290
1290 RecordHistogram.recordBooleanHistogram( 1291 RecordHistogram.recordBooleanHistogram(
1291 "OfflinePages.SharedPageWasOffline", OfflinePageUtils.isOfflineP age(currentTab)); 1292 "OfflinePages.SharedPageWasOffline", OfflinePageUtils.isOfflineP age(currentTab));
1292 boolean canShareOfflinePage = OfflinePageBridge.isPageSharingEnabled(); 1293 boolean canShareOfflinePage = OfflinePageBridge.isPageSharingEnabled();
1293 1294
1294 // Share an empty blockingUri in place of screenshot file. The file read y notification is 1295 // Share an empty blockingUri in place of screenshot file. The file read y notification is
1295 // sent by onScreenshotReady call below when the file is written. 1296 // sent by onScreenshotReady call below when the file is written.
1296 final Uri blockingUri = (isIncognito || webContents == null) 1297 final Uri blockingUri = (isIncognito || webContents == null)
1297 ? null 1298 ? null
1298 : ChromeFileProvider.generateUriAndBlockAccess(mainActivity); 1299 : ChromeFileProvider.generateUriAndBlockAccess(mainActivity);
1300 ShareParams.Builder builder =
1301 new ShareParams.Builder(mainActivity, currentTab.getTitle(), cur rentTab.getUrl())
1302 .setShareDirectly(shareDirectly)
1303 .setSaveLastUsed(!shareDirectly)
1304 .setScreenshotUri(blockingUri);
1299 if (canShareOfflinePage) { 1305 if (canShareOfflinePage) {
1300 OfflinePageUtils.shareOfflinePage(shareDirectly, true, mainActivity, null, 1306 OfflinePageUtils.shareOfflinePage(builder, currentTab);
1301 blockingUri, null, currentTab);
1302 } else { 1307 } else {
1303 ShareHelper.share(shareDirectly, true, mainActivity, currentTab.getT itle(), null, 1308 ShareHelper.share(builder.build());
1304 currentTab.getUrl(), null, blockingUri, null);
1305 if (shareDirectly) { 1309 if (shareDirectly) {
1306 RecordUserAction.record("MobileMenuDirectShare"); 1310 RecordUserAction.record("MobileMenuDirectShare");
1307 } else { 1311 } else {
1308 RecordUserAction.record("MobileMenuShare"); 1312 RecordUserAction.record("MobileMenuShare");
1309 } 1313 }
1310 } 1314 }
1311 1315
1312 if (blockingUri == null) return; 1316 if (blockingUri == null) return;
1313 1317
1314 // Start screenshot capture and notify the provider when it is ready. 1318 // Start screenshot capture and notify the provider when it is ready.
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after
2221 return false; 2225 return false;
2222 } 2226 }
2223 2227
2224 /** 2228 /**
2225 * @return the reference pool for this activity. 2229 * @return the reference pool for this activity.
2226 */ 2230 */
2227 public DiscardableReferencePool getReferencePool() { 2231 public DiscardableReferencePool getReferencePool() {
2228 return mReferencePool; 2232 return mReferencePool;
2229 } 2233 }
2230 } 2234 }
OLDNEW
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698