| 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.input; | 5 package org.chromium.content.browser.input; |
| 6 | 6 |
| 7 import android.annotation.TargetApi; | 7 import android.annotation.TargetApi; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.graphics.Rect; | 9 import android.graphics.Rect; |
| 10 import android.os.Build; | 10 import android.os.Build; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 } | 71 } |
| 72 | 72 |
| 73 private class ActionModeCallback extends ActionMode.Callback2 { | 73 private class ActionModeCallback extends ActionMode.Callback2 { |
| 74 @Override | 74 @Override |
| 75 public boolean onCreateActionMode(ActionMode mode, Menu menu) { | 75 public boolean onCreateActionMode(ActionMode mode, Menu menu) { |
| 76 createPasteMenu(mode, menu); | 76 createPasteMenu(mode, menu); |
| 77 return true; | 77 return true; |
| 78 } | 78 } |
| 79 | 79 |
| 80 private void createPasteMenu(ActionMode mode, Menu menu) { | 80 private void createPasteMenu(ActionMode mode, Menu menu) { |
| 81 mode.setTitle(DeviceFormFactor.isTablet(mContext) | 81 mode.setTitle(DeviceFormFactor.isTablet() |
| 82 ? mContext.getString(R.string.actionbar_textselection_title)
: null); | 82 ? mContext.getString(R.string.actionbar_textselectio
n_title) |
| 83 : null); |
| 83 mode.setSubtitle(null); | 84 mode.setSubtitle(null); |
| 84 SelectionPopupController.initializeMenu(mContext, mode, menu); | 85 SelectionPopupController.initializeMenu(mContext, mode, menu); |
| 85 if (!mDelegate.canPaste()) menu.removeItem(R.id.select_action_menu_p
aste); | 86 if (!mDelegate.canPaste()) menu.removeItem(R.id.select_action_menu_p
aste); |
| 86 if (!mDelegate.canSelectAll()) menu.removeItem(R.id.select_action_me
nu_select_all); | 87 if (!mDelegate.canSelectAll()) menu.removeItem(R.id.select_action_me
nu_select_all); |
| 87 if (!mDelegate.canPasteAsPlainText()) { | 88 if (!mDelegate.canPasteAsPlainText()) { |
| 88 menu.removeItem(R.id.select_action_menu_paste_as_plain_text); | 89 menu.removeItem(R.id.select_action_menu_paste_as_plain_text); |
| 89 } | 90 } |
| 90 // TODO(ctzsm): Remove runtime title set after O SDK rolls. | 91 // TODO(ctzsm): Remove runtime title set after O SDK rolls. |
| 91 MenuItem item = menu.findItem(R.id.select_action_menu_paste_as_plain
_text); | 92 MenuItem item = menu.findItem(R.id.select_action_menu_paste_as_plain
_text); |
| 92 if (item != null) { | 93 if (item != null) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 public void onDestroyActionMode(ActionMode mode) { | 127 public void onDestroyActionMode(ActionMode mode) { |
| 127 mActionMode = null; | 128 mActionMode = null; |
| 128 } | 129 } |
| 129 | 130 |
| 130 @Override | 131 @Override |
| 131 public void onGetContentRect(ActionMode mode, View view, Rect outRect) { | 132 public void onGetContentRect(ActionMode mode, View view, Rect outRect) { |
| 132 outRect.set(mSelectionRect); | 133 outRect.set(mSelectionRect); |
| 133 } | 134 } |
| 134 }; | 135 }; |
| 135 } | 136 } |
| OLD | NEW |