| 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.content.browser; | 5 package org.chromium.content.browser; |
| 6 | 6 |
| 7 import android.annotation.TargetApi; | 7 import android.annotation.TargetApi; |
| 8 import android.app.Activity; | 8 import android.app.Activity; |
| 9 import android.app.SearchManager; | 9 import android.app.SearchManager; |
| 10 import android.content.ClipboardManager; | 10 import android.content.ClipboardManager; |
| (...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 break; | 791 break; |
| 792 | 792 |
| 793 case SelectionEventType.INSERTION_HANDLE_SHOWN: | 793 case SelectionEventType.INSERTION_HANDLE_SHOWN: |
| 794 mSelectionRect.set(left, top, right, bottom); | 794 mSelectionRect.set(left, top, right, bottom); |
| 795 setIsInsertion(true); | 795 setIsInsertion(true); |
| 796 break; | 796 break; |
| 797 | 797 |
| 798 case SelectionEventType.INSERTION_HANDLE_MOVED: | 798 case SelectionEventType.INSERTION_HANDLE_MOVED: |
| 799 mSelectionRect.set(left, top, right, bottom); | 799 mSelectionRect.set(left, top, right, bottom); |
| 800 if (!isScrollInProgress && isPastePopupShowing()) { | 800 if (!isScrollInProgress && isPastePopupShowing()) { |
| 801 mWebContents.showContextMenuAtPoint(xAnchor, yAnchor); | 801 showPastePopup(xAnchor, yAnchor); |
| 802 } else { | 802 } else { |
| 803 hidePastePopup(); | 803 hidePastePopup(); |
| 804 } | 804 } |
| 805 break; | 805 break; |
| 806 | 806 |
| 807 case SelectionEventType.INSERTION_HANDLE_TAPPED: | 807 case SelectionEventType.INSERTION_HANDLE_TAPPED: |
| 808 if (mWasPastePopupShowingOnInsertionDragStart) { | 808 if (mWasPastePopupShowingOnInsertionDragStart) { |
| 809 hidePastePopup(); | 809 hidePastePopup(); |
| 810 } else { | 810 } else { |
| 811 mWebContents.showContextMenuAtPoint(xAnchor, yAnchor); | 811 showPastePopup(xAnchor, yAnchor); |
| 812 } | 812 } |
| 813 mWasPastePopupShowingOnInsertionDragStart = false; | 813 mWasPastePopupShowingOnInsertionDragStart = false; |
| 814 break; | 814 break; |
| 815 | 815 |
| 816 case SelectionEventType.INSERTION_HANDLE_CLEARED: | 816 case SelectionEventType.INSERTION_HANDLE_CLEARED: |
| 817 hidePastePopup(); | 817 hidePastePopup(); |
| 818 setIsInsertion(false); | 818 setIsInsertion(false); |
| 819 mSelectionRect.setEmpty(); | 819 mSelectionRect.setEmpty(); |
| 820 break; | 820 break; |
| 821 | 821 |
| 822 case SelectionEventType.INSERTION_HANDLE_DRAG_STARTED: | 822 case SelectionEventType.INSERTION_HANDLE_DRAG_STARTED: |
| 823 mWasPastePopupShowingOnInsertionDragStart = isPastePopupShowing(
); | 823 mWasPastePopupShowingOnInsertionDragStart = isPastePopupShowing(
); |
| 824 hidePastePopup(); | 824 hidePastePopup(); |
| 825 break; | 825 break; |
| 826 | 826 |
| 827 case SelectionEventType.INSERTION_HANDLE_DRAG_STOPPED: | 827 case SelectionEventType.INSERTION_HANDLE_DRAG_STOPPED: |
| 828 if (mWasPastePopupShowingOnInsertionDragStart) { | 828 if (mWasPastePopupShowingOnInsertionDragStart) { |
| 829 mWebContents.showContextMenuAtPoint(xAnchor, yAnchor); | 829 showPastePopup(xAnchor, yAnchor); |
| 830 } | 830 } |
| 831 mWasPastePopupShowingOnInsertionDragStart = false; | 831 mWasPastePopupShowingOnInsertionDragStart = false; |
| 832 break; | 832 break; |
| 833 | 833 |
| 834 default: | 834 default: |
| 835 assert false : "Invalid selection event type."; | 835 assert false : "Invalid selection event type."; |
| 836 } | 836 } |
| 837 | 837 |
| 838 if (mContextualSearchClient != null) { | 838 if (mContextualSearchClient != null) { |
| 839 final float deviceScale = mRenderCoordinates.getDeviceScaleFactor(); | 839 final float deviceScale = mRenderCoordinates.getDeviceScaleFactor(); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 mIsInsertion = insertion; | 914 mIsInsertion = insertion; |
| 915 } | 915 } |
| 916 | 916 |
| 917 private boolean isShareAvailable() { | 917 private boolean isShareAvailable() { |
| 918 Intent intent = new Intent(Intent.ACTION_SEND); | 918 Intent intent = new Intent(Intent.ACTION_SEND); |
| 919 intent.setType("text/plain"); | 919 intent.setType("text/plain"); |
| 920 return mContext.getPackageManager().queryIntentActivities(intent, | 920 return mContext.getPackageManager().queryIntentActivities(intent, |
| 921 PackageManager.MATCH_DEFAULT_ONLY).size() > 0; | 921 PackageManager.MATCH_DEFAULT_ONLY).size() > 0; |
| 922 } | 922 } |
| 923 } | 923 } |
| OLD | NEW |