| 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.customtabs; | 5 package org.chromium.chrome.browser.customtabs; |
| 6 | 6 |
| 7 import android.app.PendingIntent; | 7 import android.app.PendingIntent; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.content.Intent; | 9 import android.content.Intent; |
| 10 import android.content.SharedPreferences; | 10 import android.content.SharedPreferences; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 import org.chromium.base.metrics.RecordHistogram; | 40 import org.chromium.base.metrics.RecordHistogram; |
| 41 import org.chromium.base.metrics.RecordUserAction; | 41 import org.chromium.base.metrics.RecordUserAction; |
| 42 import org.chromium.chrome.R; | 42 import org.chromium.chrome.R; |
| 43 import org.chromium.chrome.browser.ChromeActivity; | 43 import org.chromium.chrome.browser.ChromeActivity; |
| 44 import org.chromium.chrome.browser.IntentHandler; | 44 import org.chromium.chrome.browser.IntentHandler; |
| 45 import org.chromium.chrome.browser.IntentHandler.ExternalAppId; | 45 import org.chromium.chrome.browser.IntentHandler.ExternalAppId; |
| 46 import org.chromium.chrome.browser.KeyboardShortcuts; | 46 import org.chromium.chrome.browser.KeyboardShortcuts; |
| 47 import org.chromium.chrome.browser.WarmupManager; | 47 import org.chromium.chrome.browser.WarmupManager; |
| 48 import org.chromium.chrome.browser.WebContentsFactory; | 48 import org.chromium.chrome.browser.WebContentsFactory; |
| 49 import org.chromium.chrome.browser.appmenu.AppMenuPropertiesDelegate; | 49 import org.chromium.chrome.browser.appmenu.AppMenuPropertiesDelegate; |
| 50 import org.chromium.chrome.browser.compositor.bottombar.OverlayPanel.StateChange
Reason; |
| 50 import org.chromium.chrome.browser.compositor.layouts.LayoutManagerDocument; | 51 import org.chromium.chrome.browser.compositor.layouts.LayoutManagerDocument; |
| 51 import org.chromium.chrome.browser.datausage.DataUseTabUIManager; | 52 import org.chromium.chrome.browser.datausage.DataUseTabUIManager; |
| 52 import org.chromium.chrome.browser.document.ChromeLauncherActivity; | 53 import org.chromium.chrome.browser.document.ChromeLauncherActivity; |
| 53 import org.chromium.chrome.browser.externalnav.ExternalNavigationDelegateImpl; | 54 import org.chromium.chrome.browser.externalnav.ExternalNavigationDelegateImpl; |
| 54 import org.chromium.chrome.browser.firstrun.FirstRunSignInProcessor; | 55 import org.chromium.chrome.browser.firstrun.FirstRunSignInProcessor; |
| 55 import org.chromium.chrome.browser.fullscreen.BrowserStateBrowserControlsVisibil
ityDelegate; | 56 import org.chromium.chrome.browser.fullscreen.BrowserStateBrowserControlsVisibil
ityDelegate; |
| 56 import org.chromium.chrome.browser.metrics.PageLoadMetrics; | 57 import org.chromium.chrome.browser.metrics.PageLoadMetrics; |
| 57 import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; | 58 import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; |
| 58 import org.chromium.chrome.browser.pageinfo.WebsiteSettingsPopup; | 59 import org.chromium.chrome.browser.pageinfo.WebsiteSettingsPopup; |
| 59 import org.chromium.chrome.browser.rappor.RapporServiceBridge; | 60 import org.chromium.chrome.browser.rappor.RapporServiceBridge; |
| (...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 } | 835 } |
| 835 | 836 |
| 836 @Override | 837 @Override |
| 837 public boolean onMenuOrKeyboardAction(int id, boolean fromMenu) { | 838 public boolean onMenuOrKeyboardAction(int id, boolean fromMenu) { |
| 838 // Disable creating new tabs, bookmark, history, print, help, focus_url,
etc. | 839 // Disable creating new tabs, bookmark, history, print, help, focus_url,
etc. |
| 839 if (id == R.id.focus_url_bar || id == R.id.all_bookmarks_menu_id | 840 if (id == R.id.focus_url_bar || id == R.id.all_bookmarks_menu_id |
| 840 || id == R.id.help_id || id == R.id.recent_tabs_menu_id | 841 || id == R.id.help_id || id == R.id.recent_tabs_menu_id |
| 841 || id == R.id.new_incognito_tab_menu_id || id == R.id.new_tab_me
nu_id | 842 || id == R.id.new_incognito_tab_menu_id || id == R.id.new_tab_me
nu_id |
| 842 || id == R.id.open_history_menu_id) { | 843 || id == R.id.open_history_menu_id) { |
| 843 return true; | 844 return true; |
| 845 } else if (id == R.id.bookmark_this_page_id) { |
| 846 addOrEditBookmark( |
| 847 getActivityTab(), getAppMenuPropertiesDelegate().getSnackbar
TextForBookmark()); |
| 848 RecordUserAction.record("MobileMenuAddToBookmarks"); |
| 849 return true; |
| 850 } else if (id == R.id.find_in_page_id) { |
| 851 mFindToolbarManager.showToolbar(); |
| 852 if (getContextualSearchManager() != null) { |
| 853 getContextualSearchManager().hideContextualSearch(StateChangeRea
son.UNKNOWN); |
| 854 } |
| 855 if (fromMenu) { |
| 856 RecordUserAction.record("MobileMeanuFindInPage"); |
| 857 } else { |
| 858 RecordUserAction.record("MobileShortcutFindInPage"); |
| 859 } |
| 844 } else if (id == R.id.open_in_browser_id) { | 860 } else if (id == R.id.open_in_browser_id) { |
| 845 openCurrentUrlInBrowser(false); | 861 openCurrentUrlInBrowser(false); |
| 846 RecordUserAction.record("CustomTabsMenuOpenInChrome"); | 862 RecordUserAction.record("CustomTabsMenuOpenInChrome"); |
| 847 return true; | 863 return true; |
| 848 } else if (id == R.id.info_menu_id) { | 864 } else if (id == R.id.info_menu_id) { |
| 849 if (getTabModelSelector().getCurrentTab() == null) return false; | 865 if (getTabModelSelector().getCurrentTab() == null) return false; |
| 850 WebsiteSettingsPopup.show( | 866 WebsiteSettingsPopup.show( |
| 851 this, getTabModelSelector().getCurrentTab(), | 867 this, getTabModelSelector().getCurrentTab(), |
| 852 getToolbarManager().getContentPublisher(), | 868 getToolbarManager().getContentPublisher(), |
| 853 WebsiteSettingsPopup.OPENED_FROM_MENU); | 869 WebsiteSettingsPopup.OPENED_FROM_MENU); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 Intent intent = ChromeLauncherActivity.createCustomTabActivityIntent( | 1035 Intent intent = ChromeLauncherActivity.createCustomTabActivityIntent( |
| 1020 context, customTabIntent.intent, false); | 1036 context, customTabIntent.intent, false); |
| 1021 intent.setPackage(context.getPackageName()); | 1037 intent.setPackage(context.getPackageName()); |
| 1022 intent.putExtra(CustomTabIntentDataProvider.EXTRA_IS_INFO_PAGE, true); | 1038 intent.putExtra(CustomTabIntentDataProvider.EXTRA_IS_INFO_PAGE, true); |
| 1023 intent.putExtra(Browser.EXTRA_APPLICATION_ID, context.getPackageName()); | 1039 intent.putExtra(Browser.EXTRA_APPLICATION_ID, context.getPackageName()); |
| 1024 IntentHandler.addTrustedIntentExtras(intent, context); | 1040 IntentHandler.addTrustedIntentExtras(intent, context); |
| 1025 | 1041 |
| 1026 context.startActivity(intent); | 1042 context.startActivity(intent); |
| 1027 } | 1043 } |
| 1028 } | 1044 } |
| OLD | NEW |