| 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.ClipboardManager; | 7 import android.content.ClipboardManager; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.view.ActionMode; | 9 import android.view.ActionMode; |
| 10 import android.view.Menu; | 10 import android.view.Menu; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 } | 143 } |
| 144 | 144 |
| 145 @Override | 145 @Override |
| 146 public boolean onActionItemClicked(ActionMode mode, MenuItem item) { | 146 public boolean onActionItemClicked(ActionMode mode, MenuItem item) { |
| 147 int id = item.getItemId(); | 147 int id = item.getItemId(); |
| 148 | 148 |
| 149 if (id == R.id.select_action_menu_select_all) { | 149 if (id == R.id.select_action_menu_select_all) { |
| 150 mActionHandler.selectAll(); | 150 mActionHandler.selectAll(); |
| 151 } else if (id == R.id.select_action_menu_cut) { | 151 } else if (id == R.id.select_action_menu_cut) { |
| 152 mActionHandler.cut(); | 152 mActionHandler.cut(); |
| 153 mode.finish(); |
| 153 } else if (id == R.id.select_action_menu_copy) { | 154 } else if (id == R.id.select_action_menu_copy) { |
| 154 mActionHandler.copy(); | 155 mActionHandler.copy(); |
| 155 mode.finish(); | 156 mode.finish(); |
| 156 } else if (id == R.id.select_action_menu_paste) { | 157 } else if (id == R.id.select_action_menu_paste) { |
| 157 mActionHandler.paste(); | 158 mActionHandler.paste(); |
| 158 } else if (id == R.id.select_action_menu_share) { | 159 } else if (id == R.id.select_action_menu_share) { |
| 159 mActionHandler.share(); | 160 mActionHandler.share(); |
| 160 mode.finish(); | 161 mode.finish(); |
| 161 } else if (id == R.id.select_action_menu_web_search) { | 162 } else if (id == R.id.select_action_menu_web_search) { |
| 162 mActionHandler.search(); | 163 mActionHandler.search(); |
| 163 mode.finish(); | 164 mode.finish(); |
| 164 } else { | 165 } else { |
| 165 return false; | 166 return false; |
| 166 } | 167 } |
| 167 return true; | 168 return true; |
| 168 } | 169 } |
| 169 | 170 |
| 170 @Override | 171 @Override |
| 171 public void onDestroyActionMode(ActionMode mode) { | 172 public void onDestroyActionMode(ActionMode mode) { |
| 172 mActionHandler.onDestroyActionMode(); | 173 mActionHandler.onDestroyActionMode(); |
| 173 } | 174 } |
| 174 | 175 |
| 175 private boolean canPaste() { | 176 private boolean canPaste() { |
| 176 ClipboardManager clipMgr = (ClipboardManager) | 177 ClipboardManager clipMgr = (ClipboardManager) |
| 177 getContext().getSystemService(Context.CLIPBOARD_SERVICE); | 178 getContext().getSystemService(Context.CLIPBOARD_SERVICE); |
| 178 return clipMgr.hasPrimaryClip(); | 179 return clipMgr.hasPrimaryClip(); |
| 179 } | 180 } |
| 180 } | 181 } |
| OLD | NEW |