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 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 showPastePopup(xAnchor, yAnchor); | 794 showPastePopup(xAnchor, yAnchor); |
795 } else { | 795 } else { |
796 destroyPastePopup(); | 796 destroyPastePopup(); |
797 } | 797 } |
798 break; | 798 break; |
799 | 799 |
800 case SelectionEventType.INSERTION_HANDLE_TAPPED: | 800 case SelectionEventType.INSERTION_HANDLE_TAPPED: |
801 if (mWasPastePopupShowingOnInsertionDragStart) { | 801 if (mWasPastePopupShowingOnInsertionDragStart) { |
802 destroyPastePopup(); | 802 destroyPastePopup(); |
803 } else { | 803 } else { |
804 createAndShowPastePopup(xAnchor, yAnchor); | 804 mWebContents.showContextMenuAtPoint(xAnchor, yAnchor); |
805 } | 805 } |
806 mWasPastePopupShowingOnInsertionDragStart = false; | 806 mWasPastePopupShowingOnInsertionDragStart = false; |
807 break; | 807 break; |
808 | 808 |
809 case SelectionEventType.INSERTION_HANDLE_CLEARED: | 809 case SelectionEventType.INSERTION_HANDLE_CLEARED: |
810 destroyPastePopup(); | 810 destroyPastePopup(); |
811 setIsInsertion(false); | 811 setIsInsertion(false); |
812 mSelectionRect.setEmpty(); | 812 mSelectionRect.setEmpty(); |
813 break; | 813 break; |
814 | 814 |
815 case SelectionEventType.INSERTION_HANDLE_DRAG_STARTED: | 815 case SelectionEventType.INSERTION_HANDLE_DRAG_STARTED: |
816 mWasPastePopupShowingOnInsertionDragStart = isPastePopupShowing(
); | 816 mWasPastePopupShowingOnInsertionDragStart = isPastePopupShowing(
); |
817 destroyPastePopup(); | 817 destroyPastePopup(); |
818 break; | 818 break; |
819 | 819 |
820 case SelectionEventType.INSERTION_HANDLE_DRAG_STOPPED: | 820 case SelectionEventType.INSERTION_HANDLE_DRAG_STOPPED: |
821 if (mWasPastePopupShowingOnInsertionDragStart) { | 821 if (mWasPastePopupShowingOnInsertionDragStart) { |
822 createAndShowPastePopup(xAnchor, yAnchor); | 822 mWebContents.showContextMenuAtPoint(xAnchor, yAnchor); |
823 } | 823 } |
824 mWasPastePopupShowingOnInsertionDragStart = false; | 824 mWasPastePopupShowingOnInsertionDragStart = false; |
825 break; | 825 break; |
826 | 826 |
827 default: | 827 default: |
828 assert false : "Invalid selection event type."; | 828 assert false : "Invalid selection event type."; |
829 } | 829 } |
830 | 830 |
831 if (mSelectionClient != null) { | 831 if (mSelectionClient != null) { |
832 final float deviceScale = mRenderCoordinates.getDeviceScaleFactor(); | 832 final float deviceScale = mRenderCoordinates.getDeviceScaleFactor(); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
903 mIsInsertion = insertion; | 903 mIsInsertion = insertion; |
904 } | 904 } |
905 | 905 |
906 private boolean isShareAvailable() { | 906 private boolean isShareAvailable() { |
907 Intent intent = new Intent(Intent.ACTION_SEND); | 907 Intent intent = new Intent(Intent.ACTION_SEND); |
908 intent.setType("text/plain"); | 908 intent.setType("text/plain"); |
909 return mContext.getPackageManager().queryIntentActivities(intent, | 909 return mContext.getPackageManager().queryIntentActivities(intent, |
910 PackageManager.MATCH_DEFAULT_ONLY).size() > 0; | 910 PackageManager.MATCH_DEFAULT_ONLY).size() > 0; |
911 } | 911 } |
912 } | 912 } |
OLD | NEW |