Java Code Examples for org.chromium.chrome.browser.tab.Tab#isNativePage()
The following examples show how to use
org.chromium.chrome.browser.tab.Tab#isNativePage() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CompositorViewHolder.java From delion with Apache License 2.0 | 6 votes |
/** * Sets the correct size for all {@link View}s on {@code tab} and sets the correct rendering * parameters on all {@link ContentViewCore}s on {@code tab}. * @param tab The {@link Tab} to initialize. */ private void initializeTab(Tab tab) { sCachedCVCList.clear(); if (mLayoutManager != null) { mLayoutManager.getActiveLayout().getAllContentViewCores(sCachedCVCList); } for (int i = 0; i < sCachedCVCList.size(); i++) { initializeContentViewCore(sCachedCVCList.get(i)); } sCachedCVCList.clear(); sCachedViewList.clear(); tab.getAllContentViews(sCachedViewList); for (int i = 0; i < sCachedViewList.size(); i++) { View view = sCachedViewList.get(i); // Calling View#measure() and View#layout() on a View before adding it to the view // hierarchy seems to cause issues with compound drawables on some versions of Android. // We don't need to proactively size the NTP as we don't need the Android view to render // if it's not actually attached to the view hierarchy (http://crbug.com/462114). if (view == tab.getView() && tab.isNativePage()) continue; setSizeOfUnattachedView(view); } sCachedViewList.clear(); }
Example 2
Source File: CompositorViewHolder.java From 365browser with Apache License 2.0 | 5 votes |
/** * Sets the correct size for {@link View} on {@code tab} and sets the correct rendering * parameters on {@link ContentViewCore} on {@code tab}. * @param tab The {@link Tab} to initialize. */ private void initializeTab(Tab tab) { ContentViewCore content = tab.getActiveContentViewCore(); if (content != null) initializeContentViewCore(content); View view = tab.getContentView(); if (view != tab.getView() || !tab.isNativePage()) setSizeOfUnattachedView(view); }
Example 3
Source File: StackLayout.java From 365browser with Apache License 2.0 | 5 votes |
@Override public void show(long time, boolean animate) { super.show(time, animate); Tab tab = mTabModelSelector.getCurrentTab(); if (tab != null && tab.isNativePage()) mTabContentManager.cacheTabThumbnail(tab); // Remove any views in case we're getting another call to show before we hide (quickly // toggling the tab switcher button). mViewContainer.removeAllViews(); int currentTabModel = mTabModelSelector.isIncognitoSelected() ? 1 : 0; for (int i = mStacks.length - 1; i >= 0; --i) { mStacks[i].reset(); if (mStacks[i].isDisplayable()) { mStacks[i].show(i == currentTabModel); } else { mStacks[i].cleanupTabs(); } } // Initialize the animation and the positioning of all the elements mSortingComparator = mOrderComparator; resetScrollData(); for (int i = mStacks.length - 1; i >= 0; --i) { if (mStacks[i].isDisplayable()) { boolean offscreen = (i != getTabStackIndex()); mStacks[i].stackEntered(time, !offscreen); } } startMarginAnimation(true); startYOffsetAnimation(true); flingStacks(getTabStackIndex() == 1); if (!animate) onUpdateAnimation(time, true); // We will render before we get a call to updateLayout. Need to make sure all of the tabs // we need to render are up to date. updateLayout(time, 0); }
Example 4
Source File: StackViewAnimation.java From 365browser with Apache License 2.0 | 5 votes |
private Animator createNewTabOpenedAnimator( StackTab[] tabs, ViewGroup container, TabModel model, int focusIndex) { Tab tab = model.getTabAt(focusIndex); if (tab == null || !tab.isNativePage()) return null; View view = tab.getView(); if (view == null) return null; // Set up the view hierarchy if (view.getParent() != null) ((ViewGroup) view.getParent()).removeView(view); ViewGroup bgView = new FrameLayout(view.getContext()); bgView.setBackgroundColor(tab.getBackgroundColor()); bgView.addView(view); container.addView( bgView, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); // Update any compositor state that needs to change if (tabs != null && focusIndex >= 0 && focusIndex < tabs.length) { tabs[focusIndex].setAlpha(0.f); } // Build the view animations PropertyValuesHolder xScale = PropertyValuesHolder.ofFloat(View.SCALE_X, 0.f, 1.f); PropertyValuesHolder yScale = PropertyValuesHolder.ofFloat(View.SCALE_Y, 0.f, 1.f); PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat(View.ALPHA, 0.f, 1.f); ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder( bgView, xScale, yScale, alpha); animator.setDuration(TAB_OPENED_ANIMATION_DURATION); animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_FOLLOW_THROUGH_CURVE); float insetPx = TAB_OPENED_PIVOT_INSET_DP * mDpToPx; bgView.setPivotY(TAB_OPENED_PIVOT_INSET_DP); bgView.setPivotX(LocalizationUtils.isLayoutRtl() ? mWidthDp * mDpToPx - insetPx : insetPx); return animator; }
Example 5
Source File: StackLayout.java From AndroidChromium with Apache License 2.0 | 5 votes |
@Override public void show(long time, boolean animate) { super.show(time, animate); Tab tab = mTabModelSelector.getCurrentTab(); if (tab != null && tab.isNativePage()) mTabContentManager.cacheTabThumbnail(tab); // Remove any views in case we're getting another call to show before we hide (quickly // toggling the tab switcher button). mViewContainer.removeAllViews(); int currentTabModel = mTabModelSelector.isIncognitoSelected() ? 1 : 0; for (int i = mStacks.length - 1; i >= 0; --i) { mStacks[i].reset(); if (mStacks[i].isDisplayable()) { mStacks[i].show(i == currentTabModel); } else { mStacks[i].cleanupTabs(); } } // Initialize the animation and the positioning of all the elements mSortingComparator = mOrderComparator; resetScrollData(); for (int i = mStacks.length - 1; i >= 0; --i) { if (mStacks[i].isDisplayable()) { boolean offscreen = (i != getTabStackIndex()); mStacks[i].stackEntered(time, !offscreen); } } startMarginAnimation(true); startYOffsetAnimation(true); flingStacks(getTabStackIndex() == 1); if (!animate) onUpdateAnimation(time, true); // We will render before we get a call to updateLayout. Need to make sure all of the tabs // we need to render are up to date. updateLayout(time, 0); }
Example 6
Source File: SimpleAnimationLayout.java From AndroidChromium with Apache License 2.0 | 5 votes |
@Override public void show(long time, boolean animate) { super.show(time, animate); if (mTabModelSelector != null && mTabContentManager != null) { Tab tab = mTabModelSelector.getCurrentTab(); if (tab != null && tab.isNativePage()) mTabContentManager.cacheTabThumbnail(tab); } reset(); }
Example 7
Source File: StackViewAnimation.java From AndroidChromium with Apache License 2.0 | 5 votes |
private Animator createNewTabOpenedAnimator( StackTab[] tabs, ViewGroup container, TabModel model, int focusIndex) { Tab tab = model.getTabAt(focusIndex); if (tab == null || !tab.isNativePage()) return null; View view = tab.getView(); if (view == null) return null; // Set up the view hierarchy if (view.getParent() != null) ((ViewGroup) view.getParent()).removeView(view); ViewGroup bgView = new FrameLayout(view.getContext()); bgView.setBackgroundColor(tab.getBackgroundColor()); bgView.addView(view); container.addView( bgView, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); // Update any compositor state that needs to change if (tabs != null && focusIndex >= 0 && focusIndex < tabs.length) { tabs[focusIndex].setAlpha(0.f); } // Build the view animations PropertyValuesHolder xScale = PropertyValuesHolder.ofFloat(View.SCALE_X, 0.f, 1.f); PropertyValuesHolder yScale = PropertyValuesHolder.ofFloat(View.SCALE_Y, 0.f, 1.f); PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat(View.ALPHA, 0.f, 1.f); ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder( bgView, xScale, yScale, alpha); animator.setDuration(TAB_OPENED_ANIMATION_DURATION); animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_FOLLOW_THROUGH_CURVE); float insetPx = TAB_OPENED_PIVOT_INSET_DP * mDpToPx; bgView.setPivotY(TAB_OPENED_PIVOT_INSET_DP); bgView.setPivotX(LocalizationUtils.isLayoutRtl() ? mWidthDp * mDpToPx - insetPx : insetPx); return animator; }
Example 8
Source File: ToolbarSwipeLayout.java From AndroidChromium with Apache License 2.0 | 5 votes |
@Override public void show(long time, boolean animate) { super.show(time, animate); init(); if (mTabModelSelector == null) return; Tab tab = mTabModelSelector.getCurrentTab(); if (tab != null && tab.isNativePage()) mTabContentManager.cacheTabThumbnail(tab); TabModel model = mTabModelSelector.getCurrentModel(); if (model == null) return; int fromTabId = mTabModelSelector.getCurrentTabId(); if (fromTabId == TabModel.INVALID_TAB_INDEX) return; mFromTab = createLayoutTab(fromTabId, model.isIncognito(), NO_CLOSE_BUTTON, NEED_TITLE); prepareLayoutTabForSwipe(mFromTab, false); }
Example 9
Source File: CompositorViewHolder.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * Sets the correct size for {@link View} on {@code tab} and sets the correct rendering * parameters on {@link ContentViewCore} on {@code tab}. * @param tab The {@link Tab} to initialize. */ private void initializeTab(Tab tab) { ContentViewCore content = tab.getActiveContentViewCore(); if (content != null) initializeContentViewCore(content); View view = tab.getContentView(); if (view != tab.getView() || !tab.isNativePage()) setSizeOfUnattachedView(view); }
Example 10
Source File: StackLayout.java From delion with Apache License 2.0 | 5 votes |
@Override public void show(long time, boolean animate) { super.show(time, animate); Tab tab = mTabModelSelector.getCurrentTab(); if (tab != null && tab.isNativePage()) mTabContentManager.cacheTabThumbnail(tab); // Remove any views in case we're getting another call to show before we hide (quickly // toggling the tab switcher button). mViewContainer.removeAllViews(); int currentTabModel = mTabModelSelector.isIncognitoSelected() ? 1 : 0; for (int i = mStacks.length - 1; i >= 0; --i) { mStacks[i].reset(); if (mStacks[i].isDisplayable()) { mStacks[i].show(i == currentTabModel); } else { mStacks[i].cleanupTabs(); } } // Initialize the animation and the positioning of all the elements mSortingComparator = mOrderComparator; resetScrollData(); for (int i = mStacks.length - 1; i >= 0; --i) { if (mStacks[i].isDisplayable()) { boolean offscreen = (i != getTabStackIndex()); mStacks[i].stackEntered(time, !offscreen); } } startMarginAnimation(true); startYOffsetAnimation(true); flingStacks(getTabStackIndex() == 1); if (!animate) onUpdateAnimation(time, true); // We will render before we get a call to updateLayout. Need to make sure all of the tabs // we need to render are up to date. updateLayout(time, 0); }
Example 11
Source File: SimpleAnimationLayout.java From delion with Apache License 2.0 | 5 votes |
@Override public void show(long time, boolean animate) { super.show(time, animate); if (mTabModelSelector != null && mTabContentManager != null) { Tab tab = mTabModelSelector.getCurrentTab(); if (tab != null && tab.isNativePage()) mTabContentManager.cacheTabThumbnail(tab); } reset(); }
Example 12
Source File: StackViewAnimation.java From delion with Apache License 2.0 | 5 votes |
private Animator createNewTabOpenedAnimator( StackTab[] tabs, ViewGroup container, TabModel model, int focusIndex) { Tab tab = model.getTabAt(focusIndex); if (tab == null || !tab.isNativePage()) return null; View view = tab.getView(); if (view == null) return null; // Set up the view hierarchy if (view.getParent() != null) ((ViewGroup) view.getParent()).removeView(view); ViewGroup bgView = new FrameLayout(view.getContext()); bgView.setBackgroundColor(tab.getBackgroundColor()); bgView.addView(view); container.addView( bgView, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); // Update any compositor state that needs to change if (tabs != null && focusIndex >= 0 && focusIndex < tabs.length) { tabs[focusIndex].setAlpha(0.f); } // Build the view animations PropertyValuesHolder xScale = PropertyValuesHolder.ofFloat(View.SCALE_X, 0.f, 1.f); PropertyValuesHolder yScale = PropertyValuesHolder.ofFloat(View.SCALE_Y, 0.f, 1.f); PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat(View.ALPHA, 0.f, 1.f); ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder( bgView, xScale, yScale, alpha); animator.setDuration(TAB_OPENED_ANIMATION_DURATION); animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_FOLLOW_THROUGH_CURVE); float insetPx = TAB_OPENED_PIVOT_INSET_DP * mDpToPx; bgView.setPivotY(TAB_OPENED_PIVOT_INSET_DP); bgView.setPivotX(LocalizationUtils.isLayoutRtl() ? mWidthDp * mDpToPx - insetPx : insetPx); return animator; }
Example 13
Source File: SimpleAnimationLayout.java From 365browser with Apache License 2.0 | 5 votes |
@Override public void show(long time, boolean animate) { super.show(time, animate); if (mTabModelSelector != null && mTabContentManager != null) { Tab tab = mTabModelSelector.getCurrentTab(); if (tab != null && tab.isNativePage()) mTabContentManager.cacheTabThumbnail(tab); } reset(); }
Example 14
Source File: TabModelSelectorImpl.java From 365browser with Apache License 2.0 | 4 votes |
@Override public void requestToShowTab(Tab tab, TabSelectionType type) { boolean isFromExternalApp = tab != null && tab.getLaunchType() == TabLaunchType.FROM_EXTERNAL_APP; if (mVisibleTab != tab && tab != null && !tab.isNativePage()) { TabModelImpl.startTabSwitchLatencyTiming(type); } if (mVisibleTab != null && mVisibleTab != tab && !mVisibleTab.needsReload()) { if (mVisibleTab.isInitialized() && !mVisibleTab.isDetached()) { // TODO(dtrainor): Once we figure out why we can't grab a snapshot from the current // tab when we have other tabs loading from external apps remove the checks for // FROM_EXTERNAL_APP/FROM_NEW. if (!mVisibleTab.isClosing() && (!isFromExternalApp || type != TabSelectionType.FROM_NEW)) { cacheTabBitmap(mVisibleTab); } mVisibleTab.hide(); mTabSaver.addTabToSaveQueue(mVisibleTab); } mVisibleTab = null; } if (tab == null) { notifyChanged(); return; } // We hit this case when the user enters tab switcher and comes back to the current tab // without actual tab switch. if (mVisibleTab == tab && !mVisibleTab.isHidden()) { // The current tab might have been killed by the os while in tab switcher. tab.loadIfNeeded(); return; } mVisibleTab = tab; // Don't execute the tab display part if Chrome has just been sent to background. This // avoids uneccessary work (tab restore) and prevents pollution of tab display metrics - see // http://crbug.com/316166. if (type != TabSelectionType.FROM_EXIT) { tab.show(type); mUma.onShowTab(tab.getId(), tab.isBeingRestored()); } }
Example 15
Source File: ChromeActivity.java From delion with Apache License 2.0 | 4 votes |
/** * Handles menu item selection and keyboard shortcuts. * * @param id The ID of the selected menu item (defined in main_menu.xml) or * keyboard shortcut (defined in values.xml). * @param fromMenu Whether this was triggered from the menu. * @return Whether the action was handled. */ public boolean onMenuOrKeyboardAction(int id, boolean fromMenu) { if (id == R.id.preferences_id) { PreferencesLauncher.launchSettingsPage(this, null); RecordUserAction.record("MobileMenuSettings"); } else if (id == R.id.show_menu) { showAppMenuForKeyboardEvent(); } if (id == R.id.update_menu_id) { UpdateMenuItemHelper.getInstance().onMenuItemClicked(this); return true; } // All the code below assumes currentTab is not null, so return early if it is null. final Tab currentTab = getActivityTab(); if (currentTab == null) { return false; } else if (id == R.id.forward_menu_id) { if (currentTab.canGoForward()) { currentTab.goForward(); RecordUserAction.record("MobileMenuForward"); RecordUserAction.record("MobileTabClobbered"); } } else if (id == R.id.bookmark_this_page_id) { addOrEditBookmark(currentTab); RecordUserAction.record("MobileMenuAddToBookmarks"); } else if (id == R.id.reload_menu_id) { if (currentTab.isLoading()) { currentTab.stopLoading(); } else { currentTab.reload(); RecordUserAction.record("MobileToolbarReload"); } } else if (id == R.id.info_menu_id) { WebsiteSettingsPopup.show( this, currentTab, null, WebsiteSettingsPopup.OPENED_FROM_MENU); } else if (id == R.id.open_history_menu_id) { currentTab.loadUrl( new LoadUrlParams(UrlConstants.HISTORY_URL, PageTransition.AUTO_TOPLEVEL)); RecordUserAction.record("MobileMenuHistory"); StartupMetrics.getInstance().recordOpenedHistory(); } else if (id == R.id.share_menu_id || id == R.id.direct_share_menu_id) { onShareMenuItemSelected(id == R.id.direct_share_menu_id, getCurrentTabModel().isIncognito()); } else if (id == R.id.print_id) { PrintingController printingController = getChromeApplication().getPrintingController(); if (printingController != null && !printingController.isBusy() && PrefServiceBridge.getInstance().isPrintingEnabled()) { printingController.startPrint(new TabPrinter(currentTab), new PrintManagerDelegateImpl(this)); RecordUserAction.record("MobileMenuPrint"); } } else if (id == R.id.add_to_homescreen_id) { AddToHomescreenDialog.show(this, currentTab); RecordUserAction.record("MobileMenuAddToHomescreen"); } else if (id == R.id.request_desktop_site_id) { final boolean reloadOnChange = !currentTab.isNativePage(); final boolean usingDesktopUserAgent = currentTab.getUseDesktopUserAgent(); currentTab.setUseDesktopUserAgent(!usingDesktopUserAgent, reloadOnChange); RecordUserAction.record("MobileMenuRequestDesktopSite"); } else if (id == R.id.reader_mode_prefs_id) { if (currentTab.getWebContents() != null) { RecordUserAction.record("DomDistiller_DistilledPagePrefsOpened"); AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.AlertDialogTheme); builder.setView(DistilledPagePrefsView.create(this)); builder.show(); } } else if (id == R.id.help_id) { // Since reading back the compositor is asynchronous, we need to do the readback // before starting the GoogleHelp. String helpContextId = HelpAndFeedback.getHelpContextIdFromUrl( this, currentTab.getUrl(), getCurrentTabModel().isIncognito()); HelpAndFeedback.getInstance(this) .show(this, helpContextId, currentTab.getProfile(), currentTab.getUrl()); RecordUserAction.record("MobileMenuFeedback"); } else { return false; } return true; }
Example 16
Source File: TabModelSelectorImpl.java From delion with Apache License 2.0 | 4 votes |
@Override public void requestToShowTab(Tab tab, TabSelectionType type) { boolean isFromExternalApp = tab != null && tab.getLaunchType() == TabLaunchType.FROM_EXTERNAL_APP; if (mVisibleTab != tab && tab != null && !tab.isNativePage()) { TabModelImpl.startTabSwitchLatencyTiming(type); } if (mVisibleTab != null && mVisibleTab != tab && !mVisibleTab.needsReload()) { if (mVisibleTab.isInitialized() && !mVisibleTab.isDetachedForReparenting()) { // TODO(dtrainor): Once we figure out why we can't grab a snapshot from the current // tab when we have other tabs loading from external apps remove the checks for // FROM_EXTERNAL_APP/FROM_NEW. if (!mVisibleTab.isClosing() && (!isFromExternalApp || type != TabSelectionType.FROM_NEW)) { cacheTabBitmap(mVisibleTab); } mVisibleTab.hide(); mVisibleTab.setFullscreenManager(null); mTabSaver.addTabToSaveQueue(mVisibleTab); } mVisibleTab = null; } if (tab == null) { notifyChanged(); return; } // We hit this case when the user enters tab switcher and comes back to the current tab // without actual tab switch. if (mVisibleTab == tab && !mVisibleTab.isHidden()) { // The current tab might have been killed by the os while in tab switcher. tab.loadIfNeeded(); return; } tab.setFullscreenManager(mActivity.getFullscreenManager()); mVisibleTab = tab; // Don't execute the tab display part if Chrome has just been sent to background. This // avoids uneccessary work (tab restore) and prevents pollution of tab display metrics - see // http://crbug.com/316166. if (type != TabSelectionType.FROM_EXIT) { tab.show(type); mUma.onShowTab(tab.getId(), tab.isBeingRestored()); } }
Example 17
Source File: ChromeActivity.java From AndroidChromium with Apache License 2.0 | 4 votes |
/** * Handles menu item selection and keyboard shortcuts. * * @param id The ID of the selected menu item (defined in main_menu.xml) or * keyboard shortcut (defined in values.xml). * @param fromMenu Whether this was triggered from the menu. * @return Whether the action was handled. */ public boolean onMenuOrKeyboardAction(int id, boolean fromMenu) { if (id == R.id.preferences_id) { PreferencesLauncher.launchSettingsPage(this, null); RecordUserAction.record("MobileMenuSettings"); } else if (id == R.id.show_menu) { showAppMenuForKeyboardEvent(); } if (id == R.id.update_menu_id) { UpdateMenuItemHelper.getInstance().onMenuItemClicked(this); return true; } // All the code below assumes currentTab is not null, so return early if it is null. final Tab currentTab = getActivityTab(); if (currentTab == null) { return false; } else if (id == R.id.forward_menu_id) { if (currentTab.canGoForward()) { currentTab.goForward(); RecordUserAction.record("MobileMenuForward"); RecordUserAction.record("MobileTabClobbered"); } } else if (id == R.id.bookmark_this_page_id) { addOrEditBookmark(currentTab); RecordUserAction.record("MobileMenuAddToBookmarks"); } else if (id == R.id.offline_page_id) { DownloadUtils.downloadOfflinePage(this, currentTab); RecordUserAction.record("MobileMenuDownloadPage"); } else if (id == R.id.reload_menu_id) { if (currentTab.isLoading()) { currentTab.stopLoading(); RecordUserAction.record("MobileMenuStop"); } else { currentTab.reload(); RecordUserAction.record("MobileMenuReload"); } } else if (id == R.id.info_menu_id) { WebsiteSettingsPopup.show( this, currentTab, null, WebsiteSettingsPopup.OPENED_FROM_MENU); } else if (id == R.id.open_history_menu_id) { currentTab.loadUrl( new LoadUrlParams(UrlConstants.HISTORY_URL, PageTransition.AUTO_TOPLEVEL)); RecordUserAction.record("MobileMenuHistory"); StartupMetrics.getInstance().recordOpenedHistory(); } else if (id == R.id.share_menu_id || id == R.id.direct_share_menu_id) { onShareMenuItemSelected(id == R.id.direct_share_menu_id, getCurrentTabModel().isIncognito()); } else if (id == R.id.print_id) { PrintingController printingController = PrintingControllerImpl.getInstance(); if (printingController != null && !printingController.isBusy() && PrefServiceBridge.getInstance().isPrintingEnabled()) { printingController.startPrint(new TabPrinter(currentTab), new PrintManagerDelegateImpl(this)); RecordUserAction.record("MobileMenuPrint"); } } else if (id == R.id.add_to_homescreen_id) { AddToHomescreenManager addToHomescreenManager = new AddToHomescreenManager(this, currentTab); addToHomescreenManager.start(); RecordUserAction.record("MobileMenuAddToHomescreen"); } else if (id == R.id.request_desktop_site_id) { final boolean reloadOnChange = !currentTab.isNativePage(); final boolean usingDesktopUserAgent = currentTab.getUseDesktopUserAgent(); currentTab.setUseDesktopUserAgent(!usingDesktopUserAgent, reloadOnChange); RecordUserAction.record("MobileMenuRequestDesktopSite"); } else if (id == R.id.reader_mode_prefs_id) { if (currentTab.getWebContents() != null) { RecordUserAction.record("DomDistiller_DistilledPagePrefsOpened"); AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.AlertDialogTheme); builder.setView(DistilledPagePrefsView.create(this)); builder.show(); } } else if (id == R.id.help_id) { // Since reading back the compositor is asynchronous, we need to do the readback // before starting the GoogleHelp. String helpContextId = HelpAndFeedback.getHelpContextIdFromUrl( this, currentTab.getUrl(), getCurrentTabModel().isIncognito()); HelpAndFeedback.getInstance(this) .show(this, helpContextId, currentTab.getProfile(), currentTab.getUrl()); RecordUserAction.record("MobileMenuFeedback"); } else { return false; } return true; }
Example 18
Source File: PrintShareActivity.java From 365browser with Apache License 2.0 | 4 votes |
public static boolean featureIsAvailable(Tab currentTab) { PrintingController printingController = PrintingControllerImpl.getInstance(); return (printingController != null && !currentTab.isNativePage() && !printingController.isBusy() && PrefServiceBridge.getInstance().isPrintingEnabled()); }
Example 19
Source File: LayoutManagerChrome.java From 365browser with Apache License 2.0 | 3 votes |
/** * Should be called when a tab created event is triggered. * @param id The id of the tab that was created. * @param sourceId The id of the creating tab if any. * @param launchType How the tab was launched. * @param incognito Whether or not the created tab is incognito. * @param willBeSelected Whether or not the created tab will be selected. * @param originX The x coordinate of the action that created this tab in dp. * @param originY The y coordinate of the action that created this tab in dp. */ protected void tabCreated(int id, int sourceId, TabLaunchType launchType, boolean incognito, boolean willBeSelected, float originX, float originY) { Tab newTab = TabModelUtils.getTabById(getTabModelSelector().getModel(incognito), id); mCreatingNtp = newTab != null && newTab.isNativePage(); int newIndex = TabModelUtils.getTabIndexById(getTabModelSelector().getModel(incognito), id); getActiveLayout().onTabCreated( time(), id, newIndex, sourceId, incognito, !willBeSelected, originX, originY); }
Example 20
Source File: LayoutManagerChrome.java From delion with Apache License 2.0 | 3 votes |
/** * Should be called when a tab created event is triggered. * @param id The id of the tab that was created. * @param sourceId The id of the creating tab if any. * @param launchType How the tab was launched. * @param incognito Whether or not the created tab is incognito. * @param willBeSelected Whether or not the created tab will be selected. * @param originX The x coordinate of the action that created this tab in dp. * @param originY The y coordinate of the action that created this tab in dp. */ protected void tabCreated(int id, int sourceId, TabLaunchType launchType, boolean incognito, boolean willBeSelected, float originX, float originY) { Tab newTab = TabModelUtils.getTabById(getTabModelSelector().getModel(incognito), id); mCreatingNtp = newTab != null && newTab.isNativePage(); int newIndex = TabModelUtils.getTabIndexById(getTabModelSelector().getModel(incognito), id); getActiveLayout().onTabCreated( time(), id, newIndex, sourceId, incognito, !willBeSelected, originX, originY); }