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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 import org.chromium.chrome.browser.multiwindow.MultiWindowUtils; | 85 import org.chromium.chrome.browser.multiwindow.MultiWindowUtils; |
86 import org.chromium.chrome.browser.nfc.BeamController; | 86 import org.chromium.chrome.browser.nfc.BeamController; |
87 import org.chromium.chrome.browser.nfc.BeamProvider; | 87 import org.chromium.chrome.browser.nfc.BeamProvider; |
88 import org.chromium.chrome.browser.offlinepages.OfflinePageUtils; | 88 import org.chromium.chrome.browser.offlinepages.OfflinePageUtils; |
89 import org.chromium.chrome.browser.omaha.UpdateMenuItemHelper; | 89 import org.chromium.chrome.browser.omaha.UpdateMenuItemHelper; |
90 import org.chromium.chrome.browser.pageinfo.WebsiteSettingsPopup; | 90 import org.chromium.chrome.browser.pageinfo.WebsiteSettingsPopup; |
91 import org.chromium.chrome.browser.partnercustomizations.PartnerBrowserCustomiza
tions; | 91 import org.chromium.chrome.browser.partnercustomizations.PartnerBrowserCustomiza
tions; |
92 import org.chromium.chrome.browser.preferences.ChromePreferenceManager; | 92 import org.chromium.chrome.browser.preferences.ChromePreferenceManager; |
93 import org.chromium.chrome.browser.preferences.PrefServiceBridge; | 93 import org.chromium.chrome.browser.preferences.PrefServiceBridge; |
94 import org.chromium.chrome.browser.preferences.PreferencesLauncher; | 94 import org.chromium.chrome.browser.preferences.PreferencesLauncher; |
| 95 import org.chromium.chrome.browser.printing.PrintShareActivity; |
95 import org.chromium.chrome.browser.printing.TabPrinter; | 96 import org.chromium.chrome.browser.printing.TabPrinter; |
96 import org.chromium.chrome.browser.share.ShareHelper; | 97 import org.chromium.chrome.browser.share.ShareHelper; |
97 import org.chromium.chrome.browser.snackbar.DataUseSnackbarController; | 98 import org.chromium.chrome.browser.snackbar.DataUseSnackbarController; |
98 import org.chromium.chrome.browser.snackbar.SnackbarManager; | 99 import org.chromium.chrome.browser.snackbar.SnackbarManager; |
99 import org.chromium.chrome.browser.snackbar.SnackbarManager.SnackbarManageable; | 100 import org.chromium.chrome.browser.snackbar.SnackbarManager.SnackbarManageable; |
100 import org.chromium.chrome.browser.sync.ProfileSyncService; | 101 import org.chromium.chrome.browser.sync.ProfileSyncService; |
101 import org.chromium.chrome.browser.sync.SyncController; | 102 import org.chromium.chrome.browser.sync.SyncController; |
102 import org.chromium.chrome.browser.tab.Tab; | 103 import org.chromium.chrome.browser.tab.Tab; |
103 import org.chromium.chrome.browser.tabmodel.AsyncTabParamsManager; | 104 import org.chromium.chrome.browser.tabmodel.AsyncTabParamsManager; |
104 import org.chromium.chrome.browser.tabmodel.ChromeTabCreator; | 105 import org.chromium.chrome.browser.tabmodel.ChromeTabCreator; |
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 * Triggered when the share menu item is selected. | 952 * Triggered when the share menu item is selected. |
952 * This creates and shows a share intent picker dialog or starts a share int
ent directly. | 953 * This creates and shows a share intent picker dialog or starts a share int
ent directly. |
953 * @param shareDirectly Whether it should share directly with the activity t
hat was most | 954 * @param shareDirectly Whether it should share directly with the activity t
hat was most |
954 * recently used to share. | 955 * recently used to share. |
955 * @param isIncognito Whether currentTab is incognito. | 956 * @param isIncognito Whether currentTab is incognito. |
956 */ | 957 */ |
957 public void onShareMenuItemSelected(final boolean shareDirectly, boolean isI
ncognito) { | 958 public void onShareMenuItemSelected(final boolean shareDirectly, boolean isI
ncognito) { |
958 final Tab currentTab = getActivityTab(); | 959 final Tab currentTab = getActivityTab(); |
959 if (currentTab == null) return; | 960 if (currentTab == null) return; |
960 | 961 |
| 962 PrintingController printingController = getChromeApplication().getPrinti
ngController(); |
| 963 if (printingController != null && !currentTab.isNativePage() && !printin
gController.isBusy() |
| 964 && PrefServiceBridge.getInstance().isPrintingEnabled()) { |
| 965 PrintShareActivity.enablePrintShareOption(this); |
| 966 } |
| 967 |
961 final Activity mainActivity = this; | 968 final Activity mainActivity = this; |
962 ContentBitmapCallback callback = new ContentBitmapCallback() { | 969 ContentBitmapCallback callback = new ContentBitmapCallback() { |
963 @Override | 970 @Override |
964 public void onFinishGetBitmap(Bitmap bitmap, int response) { | 971 public void onFinishGetBitmap(Bitmap bitmap, int response) { |
965 // Check whether this page is an offline page, and use i
ts online URL if so. | 972 // Check whether this page is an offline page, and use i
ts online URL if so. |
966 String url = currentTab.getOriginalUrl(); | 973 String url = currentTab.getOriginalUrl(); |
967 RecordHistogram.recordBooleanHistogram( | 974 RecordHistogram.recordBooleanHistogram( |
968 "OfflinePages.SharedPageWasOffline", url != null
); | 975 "OfflinePages.SharedPageWasOffline", url != null
); |
969 | 976 |
970 // If there is no entry in the offline pages DB for this
tab, use the tab's | 977 // If there is no entry in the offline pages DB for this
tab, use the tab's |
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1745 "Android.MultiWindowMode.IsTabletScreenWidthBelow600", | 1752 "Android.MultiWindowMode.IsTabletScreenWidthBelow600", |
1746 mScreenWidthDp < DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP); | 1753 mScreenWidthDp < DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP); |
1747 | 1754 |
1748 if (mScreenWidthDp < DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP) { | 1755 if (mScreenWidthDp < DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP) { |
1749 RecordHistogram.recordLinearCountHistogram( | 1756 RecordHistogram.recordLinearCountHistogram( |
1750 "Android.MultiWindowMode.TabletScreenWidth", mScreenWidthDp,
1, | 1757 "Android.MultiWindowMode.TabletScreenWidth", mScreenWidthDp,
1, |
1751 DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP, 50); | 1758 DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP, 50); |
1752 } | 1759 } |
1753 } | 1760 } |
1754 } | 1761 } |
OLD | NEW |