OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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.content.Intent; | 7 import android.content.Intent; |
8 import android.graphics.drawable.Drawable; | 8 import android.graphics.drawable.Drawable; |
9 import android.view.View.OnClickListener; | 9 import android.view.View.OnClickListener; |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 /** | 44 /** |
45 * Intent for the suggested menu item. | 45 * Intent for the suggested menu item. |
46 */ | 46 */ |
47 public Intent intent; | 47 public Intent intent; |
48 | 48 |
49 /** | 49 /** |
50 * OnClickListener for the suggested menu item. | 50 * OnClickListener for the suggested menu item. |
51 */ | 51 */ |
52 public OnClickListener onClickListener; | 52 public OnClickListener onClickListener; |
| 53 |
| 54 /** |
| 55 * A helper method that returns true if the result has both visual info |
| 56 * and an action so that, for instance, one can make a new menu item. |
| 57 */ |
| 58 public boolean hasNamedAction() { |
| 59 return (label != null || icon != null) && (intent != null || onClick
Listener != null); |
| 60 } |
53 } | 61 } |
54 | 62 |
55 /** | 63 /** |
56 * The interface that returns the result of the selected text analysis. | 64 * The interface that returns the result of the selected text analysis. |
57 */ | 65 */ |
58 public interface ResultCallback { | 66 public interface ResultCallback { |
59 /** | 67 /** |
60 * The result is delivered with this method. | 68 * The result is delivered with this method. |
61 */ | 69 */ |
62 void onClassified(Result result); | 70 void onClassified(Result result); |
(...skipping 16 matching lines...) Expand all Loading... |
79 * @param end The index pointing to the first character that comes after | 87 * @param end The index pointing to the first character that comes after |
80 * the selected text inside the textual context. | 88 * the selected text inside the textual context. |
81 */ | 89 */ |
82 public void sendClassifyRequest(CharSequence text, int start, int end); | 90 public void sendClassifyRequest(CharSequence text, int start, int end); |
83 | 91 |
84 /** | 92 /** |
85 * Cancel all asynchronous requests. | 93 * Cancel all asynchronous requests. |
86 */ | 94 */ |
87 public void cancelAllRequests(); | 95 public void cancelAllRequests(); |
88 } | 96 } |
OLD | NEW |