OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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.ActivityNotFoundException; | 7 import android.content.ActivityNotFoundException; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.content.Intent; | 9 import android.content.Intent; |
10 import android.view.ActionMode; | |
11 import android.view.KeyEvent; | 10 import android.view.KeyEvent; |
12 import android.view.View; | |
13 import android.view.View.MeasureSpec; | 11 import android.view.View.MeasureSpec; |
14 | 12 |
15 import org.chromium.base.Log; | 13 import org.chromium.base.Log; |
16 import org.chromium.content.browser.WebActionModeCallback.ActionHandler; | 14 import org.chromium.content.browser.WebActionModeCallback.ActionHandler; |
17 | 15 |
18 /** | 16 /** |
19 * Main callback class used by ContentView. | 17 * Main callback class used by ContentView. |
20 * | 18 * |
21 * This contains the superset of callbacks required to implement the browser UI
and the callbacks | 19 * This contains the superset of callbacks required to implement the browser UI
and the callbacks |
22 * required to implement the WebView API. | 20 * required to implement the WebView API. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 77 |
80 /** | 78 /** |
81 * Notified when the editability of the focused node changes. | 79 * Notified when the editability of the focused node changes. |
82 * | 80 * |
83 * @param editable Whether the focused node is editable. | 81 * @param editable Whether the focused node is editable. |
84 */ | 82 */ |
85 public void onFocusedNodeEditabilityChanged(boolean editable) { | 83 public void onFocusedNodeEditabilityChanged(boolean editable) { |
86 } | 84 } |
87 | 85 |
88 /** | 86 /** |
89 * Starts an ActionMode for in-page selection. | 87 * Returns a WebActionModeCallback for in-page text selection. |
90 * @param view The associated View. | 88 * @param context the associated context. |
91 * @param actionHandler The associated ActionHandler. | 89 * @param actionHandler the associated selection action handler. |
92 * @param floating Whether to try creating a floating ActionMode. If this | |
93 * feature is unsupported, the return value will be null. | |
94 * @return the SelectActionMode if creation is successful, otherwise null. | |
95 */ | 90 */ |
96 public WebActionMode startActionMode( | 91 public WebActionModeCallback getWebActionModeCallback( |
97 View view, ActionHandler actionHandler, boolean floating) { | 92 Context context, ActionHandler actionHandler) { |
98 if (floating) return null; | 93 return new WebActionModeCallback(context, actionHandler); |
99 ActionMode.Callback callback = | |
100 new WebActionModeCallback(view.getContext(), actionHandler); | |
101 ActionMode actionMode = view.startActionMode(callback); | |
102 return actionMode != null ? new WebActionMode(actionMode) : null; | |
103 } | 94 } |
104 | 95 |
105 /** | 96 /** |
106 * @return whether the client supports the creation of floating ActionMode i
nstances. | |
107 */ | |
108 public boolean supportsFloatingActionMode() { | |
109 return false; | |
110 } | |
111 | |
112 /** | |
113 * Called when the contextual ActionBar is shown. | 97 * Called when the contextual ActionBar is shown. |
114 */ | 98 */ |
115 public void onContextualActionBarShown() { | 99 public void onContextualActionBarShown() { |
116 } | 100 } |
117 | 101 |
118 /** | 102 /** |
119 * Called when the contextual ActionBar is hidden. | 103 * Called when the contextual ActionBar is hidden. |
120 */ | 104 */ |
121 public void onContextualActionBarHidden() { | 105 public void onContextualActionBarHidden() { |
122 } | 106 } |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 * ContentViewClient users can return a custom value to override the height
of | 207 * ContentViewClient users can return a custom value to override the height
of |
224 * the ContentView. By default, this method returns MeasureSpec.UNSPECIFIED,
which | 208 * the ContentView. By default, this method returns MeasureSpec.UNSPECIFIED,
which |
225 * indicates that the value should not be overridden. | 209 * indicates that the value should not be overridden. |
226 * | 210 * |
227 * @return The desired height of the ContentView. | 211 * @return The desired height of the ContentView. |
228 */ | 212 */ |
229 public int getDesiredHeightMeasureSpec() { | 213 public int getDesiredHeightMeasureSpec() { |
230 return UNSPECIFIED_MEASURE_SPEC; | 214 return UNSPECIFIED_MEASURE_SPEC; |
231 } | 215 } |
232 } | 216 } |
OLD | NEW |