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.compositor.overlays.strip; | 5 package org.chromium.chrome.browser.compositor.overlays.strip; |
6 | 6 |
7 import static org.chromium.chrome.browser.compositor.layouts.ChromeAnimation.Ani
matableAnimation.createAnimation; | 7 import static org.chromium.chrome.browser.compositor.layouts.ChromeAnimation.Ani
matableAnimation.createAnimation; |
8 | 8 |
9 import android.content.Context; | 9 import android.content.Context; |
10 import android.content.res.Resources; | 10 import android.content.res.Resources; |
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 * @param time The current time of the app in ms. | 799 * @param time The current time of the app in ms. |
800 * @param x The x coordinate of the position of the click. | 800 * @param x The x coordinate of the position of the click. |
801 * @param y The y coordinate of the position of the click. | 801 * @param y The y coordinate of the position of the click. |
802 * @param fromMouse Whether the event originates from a mouse. | 802 * @param fromMouse Whether the event originates from a mouse. |
803 * @param buttons State of all buttons that were pressed when onDown was i
nvoked. | 803 * @param buttons State of all buttons that were pressed when onDown was i
nvoked. |
804 */ | 804 */ |
805 public void click(long time, float x, float y, boolean fromMouse, int button
s) { | 805 public void click(long time, float x, float y, boolean fromMouse, int button
s) { |
806 resetResizeTimeout(false); | 806 resetResizeTimeout(false); |
807 | 807 |
808 if (mNewTabButton.click(x, y) && mModel != null) { | 808 if (mNewTabButton.click(x, y) && mModel != null) { |
| 809 if (!mModel.isIncognito()) mModel.commitAllTabClosures(); |
809 mTabCreator.launchNTP(); | 810 mTabCreator.launchNTP(); |
810 return; | 811 return; |
811 } | 812 } |
812 | 813 |
813 final StripLayoutTab clickedTab = getTabAtPosition(x); | 814 final StripLayoutTab clickedTab = getTabAtPosition(x); |
814 if (clickedTab == null || clickedTab.isDying()) return; | 815 if (clickedTab == null || clickedTab.isDying()) return; |
815 if (clickedTab.checkCloseHitTest(x, y) | 816 if (clickedTab.checkCloseHitTest(x, y) |
816 || (fromMouse && (buttons & MotionEvent.BUTTON_TERTIARY) != 0))
{ | 817 || (fromMouse && (buttons & MotionEvent.BUTTON_TERTIARY) != 0))
{ |
817 // 1. Start the close animation. | 818 // 1. Start the close animation. |
818 startAnimation(buildTabClosedAnimation(clickedTab), true); | 819 startAnimation(buildTabClosedAnimation(clickedTab), true); |
(...skipping 26 matching lines...) Expand all Loading... |
845 if (mLastPressedCloseButton != null) mLastPressedCloseButton.onUpOrCance
l(); | 846 if (mLastPressedCloseButton != null) mLastPressedCloseButton.onUpOrCance
l(); |
846 mLastPressedCloseButton = null; | 847 mLastPressedCloseButton = null; |
847 | 848 |
848 // 2. Stop any reordering that is happening. | 849 // 2. Stop any reordering that is happening. |
849 stopReorderMode(); | 850 stopReorderMode(); |
850 | 851 |
851 // 3. Reset state | 852 // 3. Reset state |
852 mInteractingTab = null; | 853 mInteractingTab = null; |
853 mReorderState = REORDER_SCROLL_NONE; | 854 mReorderState = REORDER_SCROLL_NONE; |
854 if (mNewTabButton.onUpOrCancel() && mModel != null) { | 855 if (mNewTabButton.onUpOrCancel() && mModel != null) { |
| 856 if (!mModel.isIncognito()) mModel.commitAllTabClosures(); |
855 mTabCreator.launchNTP(); | 857 mTabCreator.launchNTP(); |
856 } | 858 } |
857 } | 859 } |
858 | 860 |
859 private boolean onUpdateAnimation(long time, boolean jumpToEnd) { | 861 private boolean onUpdateAnimation(long time, boolean jumpToEnd) { |
860 // 1. Handle any Scroller movements (flings). | 862 // 1. Handle any Scroller movements (flings). |
861 if (!jumpToEnd) updateScrollOffset(time); | 863 if (!jumpToEnd) updateScrollOffset(time); |
862 | 864 |
863 // 2. Handle reordering automatically scrolling the tab strip. | 865 // 2. Handle reordering automatically scrolling the tab strip. |
864 handleReorderAutoScrolling(time); | 866 handleReorderAutoScrolling(time); |
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1778 } else { | 1780 } else { |
1779 resId = isHidden | 1781 resId = isHidden |
1780 ? R.string.accessibility_tabstrip_identifier | 1782 ? R.string.accessibility_tabstrip_identifier |
1781 : R.string.accessibility_tabstrip_identifier_selected; | 1783 : R.string.accessibility_tabstrip_identifier_selected; |
1782 } | 1784 } |
1783 builder.append(mContext.getResources().getString(resId)); | 1785 builder.append(mContext.getResources().getString(resId)); |
1784 | 1786 |
1785 stripTab.setAccessibilityDescription(builder.toString()); | 1787 stripTab.setAccessibilityDescription(builder.toString()); |
1786 } | 1788 } |
1787 } | 1789 } |
OLD | NEW |