| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 import org.chromium.chrome.browser.ntp.NewTabPage; | 93 import org.chromium.chrome.browser.ntp.NewTabPage; |
| 94 import org.chromium.chrome.browser.ntp.NewTabPageUma; | 94 import org.chromium.chrome.browser.ntp.NewTabPageUma; |
| 95 import org.chromium.chrome.browser.offlinepages.OfflinePageBridge; | 95 import org.chromium.chrome.browser.offlinepages.OfflinePageBridge; |
| 96 import org.chromium.chrome.browser.offlinepages.OfflinePageUtils; | 96 import org.chromium.chrome.browser.offlinepages.OfflinePageUtils; |
| 97 import org.chromium.chrome.browser.omaha.UpdateMenuItemHelper; | 97 import org.chromium.chrome.browser.omaha.UpdateMenuItemHelper; |
| 98 import org.chromium.chrome.browser.pageinfo.WebsiteSettingsPopup; | 98 import org.chromium.chrome.browser.pageinfo.WebsiteSettingsPopup; |
| 99 import org.chromium.chrome.browser.partnercustomizations.PartnerBrowserCustomiza
tions; | 99 import org.chromium.chrome.browser.partnercustomizations.PartnerBrowserCustomiza
tions; |
| 100 import org.chromium.chrome.browser.preferences.ChromePreferenceManager; | 100 import org.chromium.chrome.browser.preferences.ChromePreferenceManager; |
| 101 import org.chromium.chrome.browser.preferences.PrefServiceBridge; | 101 import org.chromium.chrome.browser.preferences.PrefServiceBridge; |
| 102 import org.chromium.chrome.browser.preferences.PreferencesLauncher; | 102 import org.chromium.chrome.browser.preferences.PreferencesLauncher; |
| 103 import org.chromium.chrome.browser.printing.PrintShareActivity; | |
| 104 import org.chromium.chrome.browser.printing.TabPrinter; | 103 import org.chromium.chrome.browser.printing.TabPrinter; |
| 105 import org.chromium.chrome.browser.share.ShareHelper; | 104 import org.chromium.chrome.browser.share.ShareHelper; |
| 106 import org.chromium.chrome.browser.snackbar.BottomContainer; | 105 import org.chromium.chrome.browser.snackbar.BottomContainer; |
| 107 import org.chromium.chrome.browser.snackbar.DataReductionPromoSnackbarController
; | 106 import org.chromium.chrome.browser.snackbar.DataReductionPromoSnackbarController
; |
| 108 import org.chromium.chrome.browser.snackbar.DataUseSnackbarController; | 107 import org.chromium.chrome.browser.snackbar.DataUseSnackbarController; |
| 109 import org.chromium.chrome.browser.snackbar.SnackbarManager; | 108 import org.chromium.chrome.browser.snackbar.SnackbarManager; |
| 110 import org.chromium.chrome.browser.snackbar.SnackbarManager.SnackbarManageable; | 109 import org.chromium.chrome.browser.snackbar.SnackbarManager.SnackbarManageable; |
| 111 import org.chromium.chrome.browser.sync.ProfileSyncService; | 110 import org.chromium.chrome.browser.sync.ProfileSyncService; |
| 112 import org.chromium.chrome.browser.sync.SyncController; | 111 import org.chromium.chrome.browser.sync.SyncController; |
| 113 import org.chromium.chrome.browser.tab.Tab; | 112 import org.chromium.chrome.browser.tab.Tab; |
| (...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1123 return super.onOptionsItemSelected(item); | 1122 return super.onOptionsItemSelected(item); |
| 1124 } | 1123 } |
| 1125 | 1124 |
| 1126 @VisibleForTesting | 1125 @VisibleForTesting |
| 1127 public void setScreenshotCaptureSkippedForTesting(boolean value) { | 1126 public void setScreenshotCaptureSkippedForTesting(boolean value) { |
| 1128 mScreenshotCaptureSkippedForTesting = value; | 1127 mScreenshotCaptureSkippedForTesting = value; |
| 1129 } | 1128 } |
| 1130 | 1129 |
| 1131 /** | 1130 /** |
| 1132 * Triggered when the share menu item is selected. | 1131 * Triggered when the share menu item is selected. |
| 1133 * This creates and shows a share intent picker dialog or starts a share int
ent directly. | 1132 * This enables shareActivities, creates and shows a share intent picker dia
log or starts |
| 1133 * a share intent directly. |
| 1134 * @param shareDirectly Whether it should share directly with the activity t
hat was most | 1134 * @param shareDirectly Whether it should share directly with the activity t
hat was most |
| 1135 * recently used to share. | 1135 * recently used to share. |
| 1136 * @param isIncognito Whether currentTab is incognito. | 1136 * @param isIncognito Whether currentTab is incognito. |
| 1137 */ | 1137 */ |
| 1138 @VisibleForTesting | 1138 @VisibleForTesting |
| 1139 public void onShareMenuItemSelected(final boolean shareDirectly, final boole
an isIncognito) { | 1139 public void onShareMenuItemSelected(final boolean shareDirectly, final boole
an isIncognito) { |
| 1140 final Tab currentTab = getActivityTab(); | 1140 final Tab currentTab = getActivityTab(); |
| 1141 if (currentTab == null) return; | 1141 if (currentTab == null) return; |
| 1142 | 1142 |
| 1143 PrintingController printingController = PrintingControllerImpl.getInstan
ce(); | 1143 ShareHelper.enableShareActivitiesAndStartShareIntent(this, currentTab, n
ew Runnable() { |
| 1144 if (printingController != null && !currentTab.isNativePage() && !printin
gController.isBusy() | 1144 @Override |
| 1145 && PrefServiceBridge.getInstance().isPrintingEnabled()) { | 1145 public void run() { |
| 1146 PrintShareActivity.enablePrintShareOption(this, new Runnable() { | 1146 triggerShare(currentTab, shareDirectly, isIncognito); |
| 1147 @Override | 1147 } |
| 1148 public void run() { | 1148 }); |
| 1149 triggerShare(currentTab, shareDirectly, isIncognito); | |
| 1150 } | |
| 1151 }); | |
| 1152 return; | |
| 1153 } | |
| 1154 | |
| 1155 triggerShare(currentTab, shareDirectly, isIncognito); | |
| 1156 } | 1149 } |
| 1157 | 1150 |
| 1158 private void triggerShare( | 1151 private void triggerShare( |
| 1159 final Tab currentTab, final boolean shareDirectly, boolean isIncogni
to) { | 1152 final Tab currentTab, final boolean shareDirectly, boolean isIncogni
to) { |
| 1160 final Activity mainActivity = this; | 1153 final Activity mainActivity = this; |
| 1161 WebContents webContents = currentTab.getWebContents(); | 1154 WebContents webContents = currentTab.getWebContents(); |
| 1162 | 1155 |
| 1163 RecordHistogram.recordBooleanHistogram( | 1156 RecordHistogram.recordBooleanHistogram( |
| 1164 "OfflinePages.SharedPageWasOffline", currentTab.isOfflinePage())
; | 1157 "OfflinePages.SharedPageWasOffline", currentTab.isOfflinePage())
; |
| 1165 boolean canShareOfflinePage = OfflinePageBridge.isPageSharingEnabled(); | 1158 boolean canShareOfflinePage = OfflinePageBridge.isPageSharingEnabled(); |
| (...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1968 "Android.MultiWindowMode.IsTabletScreenWidthBelow600", | 1961 "Android.MultiWindowMode.IsTabletScreenWidthBelow600", |
| 1969 mScreenWidthDp < DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP); | 1962 mScreenWidthDp < DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP); |
| 1970 | 1963 |
| 1971 if (mScreenWidthDp < DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP) { | 1964 if (mScreenWidthDp < DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP) { |
| 1972 RecordHistogram.recordLinearCountHistogram( | 1965 RecordHistogram.recordLinearCountHistogram( |
| 1973 "Android.MultiWindowMode.TabletScreenWidth", mScreenWidthDp,
1, | 1966 "Android.MultiWindowMode.TabletScreenWidth", mScreenWidthDp,
1, |
| 1974 DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP, 50); | 1967 DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP, 50); |
| 1975 } | 1968 } |
| 1976 } | 1969 } |
| 1977 } | 1970 } |
| OLD | NEW |