OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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.chrome.browser.history; | 5 package org.chromium.chrome.browser.history; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.app.ActivityManager; | 8 import android.app.ActivityManager; |
9 import android.content.ComponentName; | 9 import android.content.ComponentName; |
10 import android.content.Context; | 10 import android.content.Context; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 175 |
176 if (item.getItemId() == R.id.close_menu_id && isDisplayedInSeparateActiv
ity()) { | 176 if (item.getItemId() == R.id.close_menu_id && isDisplayedInSeparateActiv
ity()) { |
177 mActivity.finish(); | 177 mActivity.finish(); |
178 return true; | 178 return true; |
179 } else if (item.getItemId() == R.id.selection_mode_open_in_new_tab) { | 179 } else if (item.getItemId() == R.id.selection_mode_open_in_new_tab) { |
180 openItemsInNewTabs(mSelectionDelegate.getSelectedItems(), false); | 180 openItemsInNewTabs(mSelectionDelegate.getSelectedItems(), false); |
181 mSelectionDelegate.clearSelection(); | 181 mSelectionDelegate.clearSelection(); |
182 return true; | 182 return true; |
183 } else if (item.getItemId() == R.id.selection_mode_copy_link) { | 183 } else if (item.getItemId() == R.id.selection_mode_copy_link) { |
184 recordUserActionWithOptionalSearch("CopyLink"); | 184 recordUserActionWithOptionalSearch("CopyLink"); |
185 Clipboard clipboard = new Clipboard(mActivity); | 185 Clipboard.getInstance().setText(mSelectionDelegate.getSelectedItems(
).get(0).getUrl()); |
186 clipboard.setText(mSelectionDelegate.getSelectedItems().get(0).getUr
l()); | |
187 mSelectionDelegate.clearSelection(); | 186 mSelectionDelegate.clearSelection(); |
188 Snackbar snackbar = Snackbar.make(mActivity.getString(R.string.copie
d), this, | 187 Snackbar snackbar = Snackbar.make(mActivity.getString(R.string.copie
d), this, |
189 Snackbar.TYPE_NOTIFICATION, Snackbar.UMA_HISTORY_LINK_COPIED
); | 188 Snackbar.TYPE_NOTIFICATION, Snackbar.UMA_HISTORY_LINK_COPIED
); |
190 ((SnackbarManageable) mActivity).getSnackbarManager().showSnackbar(s
nackbar); | 189 ((SnackbarManageable) mActivity).getSnackbarManager().showSnackbar(s
nackbar); |
191 return true; | 190 return true; |
192 } else if (item.getItemId() == R.id.selection_mode_open_in_incognito) { | 191 } else if (item.getItemId() == R.id.selection_mode_open_in_incognito) { |
193 openItemsInNewTabs(mSelectionDelegate.getSelectedItems(), true); | 192 openItemsInNewTabs(mSelectionDelegate.getSelectedItems(), true); |
194 mSelectionDelegate.clearSelection(); | 193 mSelectionDelegate.clearSelection(); |
195 return true; | 194 return true; |
196 } else if (item.getItemId() == R.id.selection_mode_delete_menu_id) { | 195 } else if (item.getItemId() == R.id.selection_mode_delete_menu_id) { |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 @Override | 428 @Override |
430 public void onAction(Object actionData) { | 429 public void onAction(Object actionData) { |
431 // Handler for the link copied snackbar. Do nothing. | 430 // Handler for the link copied snackbar. Do nothing. |
432 } | 431 } |
433 | 432 |
434 @Override | 433 @Override |
435 public void onDismissNoAction(Object actionData) { | 434 public void onDismissNoAction(Object actionData) { |
436 // Handler for the link copied snackbar. Do nothing. | 435 // Handler for the link copied snackbar. Do nothing. |
437 } | 436 } |
438 } | 437 } |
OLD | NEW |