Chromium Code Reviews| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 private boolean mHasSelection; | 108 private boolean mHasSelection; |
| 109 | 109 |
| 110 // Lazily created paste popup menu, triggered either via long press in an | 110 // Lazily created paste popup menu, triggered either via long press in an |
| 111 // editable region or from tapping the insertion handle. | 111 // editable region or from tapping the insertion handle. |
| 112 private PastePopupMenu mPastePopupMenu; | 112 private PastePopupMenu mPastePopupMenu; |
| 113 private boolean mWasPastePopupShowingOnInsertionDragStart; | 113 private boolean mWasPastePopupShowingOnInsertionDragStart; |
| 114 | 114 |
| 115 // The client that implements Contextual Search functionality, or null if no ne exists. | 115 // The client that implements Contextual Search functionality, or null if no ne exists. |
| 116 private ContextualSearchClient mContextualSearchClient; | 116 private ContextualSearchClient mContextualSearchClient; |
| 117 | 117 |
| 118 private ContextSelectionProvider mContextSelector; | |
| 119 | |
| 118 /** | 120 /** |
| 119 * Create {@link SelectionPopupController} instance. | 121 * Create {@link SelectionPopupController} instance. |
| 120 * @param context Context for action mode. | 122 * @param context Context for action mode. |
| 121 * @param window WindowAndroid instance. | 123 * @param window WindowAndroid instance. |
| 122 * @param webContents WebContents instance. | 124 * @param webContents WebContents instance. |
| 123 * @param view Container view. | 125 * @param view Container view. |
| 124 * @param renderCoordinates Coordinates info used to position elements. | 126 * @param renderCoordinates Coordinates info used to position elements. |
| 125 * @param imeAdapter ImeAdapter instance to handle cursor position. | 127 * @param imeAdapter ImeAdapter instance to handle cursor position. |
| 126 */ | 128 */ |
| 127 public SelectionPopupController(Context context, WindowAndroid window, WebCo ntents webContents, | 129 public SelectionPopupController(Context context, WindowAndroid window, WebCo ntents webContents, |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 138 mRepeatingHideRunnable = new Runnable() { | 140 mRepeatingHideRunnable = new Runnable() { |
| 139 @Override | 141 @Override |
| 140 public void run() { | 142 public void run() { |
| 141 assert mHidden; | 143 assert mHidden; |
| 142 final long hideDuration = getDefaultHideDuration(); | 144 final long hideDuration = getDefaultHideDuration(); |
| 143 // Ensure the next hide call occurs before the ActionMode reappe ars. | 145 // Ensure the next hide call occurs before the ActionMode reappe ars. |
| 144 mView.postDelayed(mRepeatingHideRunnable, hideDuration - 1); | 146 mView.postDelayed(mRepeatingHideRunnable, hideDuration - 1); |
| 145 hideActionModeTemporarily(hideDuration); | 147 hideActionModeTemporarily(hideDuration); |
| 146 } | 148 } |
| 147 }; | 149 }; |
| 150 | |
| 151 // To be removed. | |
|
boliu
2017/03/06 16:56:13
should be a TODO comment then. And need to give re
Tima Vaisburd
2017/03/07 00:45:40
Just removed.
| |
| 152 mContextSelector = ContentClassFactory.get().createContextSelectionProvi der(null, window); | |
| 148 } | 153 } |
| 149 | 154 |
| 150 /** | 155 /** |
| 151 * Update the container view. | 156 * Update the container view. |
| 152 */ | 157 */ |
| 153 void setContainerView(View view) { | 158 void setContainerView(View view) { |
| 154 assert view != null; | 159 assert view != null; |
| 155 | 160 |
| 156 // Cleans up action mode before switching to a new container view. | 161 // Cleans up action mode before switching to a new container view. |
| 157 if (isActionModeValid()) finishActionMode(); | 162 if (isActionModeValid()) finishActionMode(); |
| (...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 914 mIsInsertion = insertion; | 919 mIsInsertion = insertion; |
| 915 } | 920 } |
| 916 | 921 |
| 917 private boolean isShareAvailable() { | 922 private boolean isShareAvailable() { |
| 918 Intent intent = new Intent(Intent.ACTION_SEND); | 923 Intent intent = new Intent(Intent.ACTION_SEND); |
| 919 intent.setType("text/plain"); | 924 intent.setType("text/plain"); |
| 920 return mContext.getPackageManager().queryIntentActivities(intent, | 925 return mContext.getPackageManager().queryIntentActivities(intent, |
| 921 PackageManager.MATCH_DEFAULT_ONLY).size() > 0; | 926 PackageManager.MATCH_DEFAULT_ONLY).size() > 0; |
| 922 } | 927 } |
| 923 } | 928 } |
| OLD | NEW |