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.view.ActionMode; | 7 import android.view.ActionMode; |
8 | 8 |
9 import org.chromium.base.Log; | 9 import org.chromium.base.Log; |
10 | 10 |
11 /** | 11 /** |
12 * An ActionMode for in-page selection. This class wraps an ActionMode created | 12 * An ActionMode for in-page web content selection. This class wraps an ActionMo
de created |
13 * by the associated View, providing modified interaction with that ActionMode. | 13 * by the associated View, providing modified interaction with that ActionMode. |
14 */ | 14 */ |
15 public class SelectActionMode { | 15 public class WebActionMode { |
16 private static final String TAG = "cr.SelectActionMode"; | 16 private static final String TAG = "cr.SelectActionMode"; |
17 | 17 |
18 protected final ActionMode mActionMode; | 18 protected final ActionMode mActionMode; |
19 | 19 |
20 /** | 20 /** |
21 * Constructs a SelectActionMode instance wrapping a concrete ActionMode. | 21 * Constructs a SelectActionMode instance wrapping a concrete ActionMode. |
22 * @param actionMode the wrapped ActionMode. | 22 * @param actionMode the wrapped ActionMode. |
23 */ | 23 */ |
24 public SelectActionMode(ActionMode actionMode) { | 24 public WebActionMode(ActionMode actionMode) { |
25 assert actionMode != null; | 25 assert actionMode != null; |
26 mActionMode = actionMode; | 26 mActionMode = actionMode; |
27 } | 27 } |
28 | 28 |
29 /** | 29 /** |
30 * @see ActionMode#finish() | 30 * @see ActionMode#finish() |
31 */ | 31 */ |
32 public void finish() { | 32 public void finish() { |
33 mActionMode.finish(); | 33 mActionMode.finish(); |
34 } | 34 } |
35 | 35 |
36 /** | 36 /** |
37 * @see ActionMode#invalidate() | 37 * @see ActionMode#invalidate() |
38 */ | 38 */ |
39 public void invalidate() { | 39 public void invalidate() { |
40 // Try/catch necessary for framework bug, crbug.com/446717. | 40 // Try/catch necessary for framework bug, crbug.com/446717. |
41 try { | 41 try { |
42 mActionMode.invalidate(); | 42 mActionMode.invalidate(); |
43 } catch (NullPointerException e) { | 43 } catch (NullPointerException e) { |
44 Log.w(TAG, "Ignoring NPE from ActionMode.invalidate() as workaround
for L", e); | 44 Log.w(TAG, "Ignoring NPE from ActionMode.invalidate() as workaround
for L", e); |
45 } | 45 } |
46 } | 46 } |
47 | 47 |
48 /** | 48 /** |
49 * @see ActionMode#invalidateContentRect() | 49 * @see ActionMode#invalidateContentRect() |
50 */ | 50 */ |
51 public void invalidateContentRect() {} | 51 public void invalidateContentRect() {} |
52 } | 52 } |
OLD | NEW |