Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 package org.chromium.content.browser; | |
| 6 | |
| 7 import android.content.Intent; | |
| 8 import android.graphics.drawable.Drawable; | |
| 9 import android.view.View.OnClickListener; | |
| 10 | |
| 11 import org.chromium.base.annotations.SuppressFBWarnings; | |
| 12 | |
| 13 /** | |
| 14 * The interface that controls contextual text selection. | |
| 15 */ | |
| 16 | |
|
boliu
2017/03/03 18:19:09
nit: no empty line
Tima Vaisburd
2017/03/04 02:25:07
Done.
| |
| 17 @SuppressFBWarnings("UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD") | |
| 18 public interface ContextSelectionProvider { | |
| 19 /** | |
| 20 * The result of the text analysis. | |
| 21 */ | |
| 22 public static class Result { | |
| 23 /** | |
| 24 * The number of characters that the left selection bound of the origina l | |
| 25 * selection should be moved. Negative number means moving left. | |
|
boliu
2017/03/03 18:19:09
"Negative number means moving left." one of these
Tima Vaisburd
2017/03/03 18:59:44
M-mm, not sure how to explain it better. If leftAd
boliu
2017/03/03 19:44:00
I mean vs the comment on rightAdjust?
Tima Vaisburd
2017/03/03 20:57:48
But... rightAdjust can also be negative. For insta
boliu
2017/03/03 22:04:12
hmm, yeah, start/end might be better var names the
Tima Vaisburd
2017/03/04 02:25:07
Done.
| |
| 26 */ | |
| 27 public int leftAdjust; | |
| 28 | |
| 29 /** | |
| 30 * The number of characters that the right selection bound of the origin al | |
| 31 * selection should be moved. Negative number means moving left. | |
| 32 */ | |
| 33 public int rightAdjust; | |
| 34 | |
| 35 /** | |
| 36 * Label for the suggested menu item. | |
| 37 */ | |
| 38 public CharSequence label; | |
| 39 | |
| 40 /** | |
| 41 * Icon for the suggested menu item. | |
| 42 */ | |
| 43 public Drawable icon; | |
| 44 | |
| 45 /** | |
| 46 * Intent for the suggested menu item. | |
| 47 */ | |
| 48 public Intent intent; | |
| 49 | |
| 50 /** | |
| 51 * OnClickListener for the suggested menu item. | |
| 52 */ | |
| 53 public OnClickListener onClickListener; | |
| 54 } | |
| 55 | |
| 56 /** | |
| 57 * The interface that returns the result of the selected text analysis. | |
| 58 */ | |
| 59 public interface Callback { | |
|
boliu
2017/03/03 18:19:09
nit: ResultCallback?
Tima Vaisburd
2017/03/03 18:30:29
Thank you for prompt review, I was waiting for you
boliu
2017/03/03 18:34:54
I don't know how similar those two will be, but wh
Tima Vaisburd
2017/03/04 02:25:07
Done.
| |
| 60 /** | |
| 61 * The result is delivered with this method. | |
| 62 */ | |
| 63 void onClassified(Result result); | |
| 64 } | |
| 65 | |
| 66 /** | |
| 67 * Sends asynchronous request to obtain the selection, analyze its type and suggest | |
| 68 * better selection boundaries. | |
| 69 */ | |
| 70 public void sendSuggestAndClassifyRequest(); | |
|
boliu
2017/03/03 18:19:09
same question as before, how does provider get the
Tima Vaisburd
2017/03/03 18:59:44
Provider will issue the IPC request to blink::WebS
boliu
2017/03/03 19:44:00
Don't do that. Just pass whatever provider needs h
Tima Vaisburd
2017/03/03 20:57:48
Yes, that also answers my question about reusing C
Tima Vaisburd
2017/03/04 02:25:07
Added the text and selection within it as argument
| |
| 71 | |
| 72 /** | |
| 73 * Sends asynchronous request to obtain the selection and analyze its type. | |
| 74 */ | |
| 75 public void sendClassifyRequest(); | |
| 76 | |
| 77 /** | |
| 78 * Cancel all asynchronous requests. | |
| 79 */ | |
| 80 public void cancelAllRequests(); | |
| 81 } | |
| OLD | NEW |