OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.contextmenu; | 5 package org.chromium.chrome.browser.contextmenu; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.net.MailTo; | 8 import android.net.MailTo; |
9 import android.support.annotation.IntDef; | 9 import android.support.annotation.IntDef; |
10 import android.support.annotation.StringRes; | 10 import android.support.annotation.StringRes; |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 } | 365 } |
366 | 366 |
367 /** | 367 /** |
368 * This works in the same way as {@link #addValidItems(List, List, Set, Set
)} however the list | 368 * This works in the same way as {@link #addValidItems(List, List, Set, Set
)} however the list |
369 * given for example (a, b, c) will be added to list d, e f, as a, b, c, d,
e, f not | 369 * given for example (a, b, c) will be added to list d, e f, as a, b, c, d,
e, f not |
370 * c, b, a, d, e, f. | 370 * c, b, a, d, e, f. |
371 */ | 371 */ |
372 private static void addValidItemsToFront(List<ContextMenuItem> validItems, | 372 private static void addValidItemsToFront(List<ContextMenuItem> validItems, |
373 List<? extends ContextMenuItem> allItems, Set<ContextMenuItem> suppo
rtedOptions, | 373 List<? extends ContextMenuItem> allItems, Set<ContextMenuItem> suppo
rtedOptions, |
374 Set<ContextMenuItem> disabledOptions) { | 374 Set<ContextMenuItem> disabledOptions) { |
375 for (int i = 0; i < allItems.size(); i++) { | 375 for (int i = allItems.size() - 1; i >= 0; i--) { |
376 ContextMenuItem item = allItems.get(i); | 376 ContextMenuItem item = allItems.get(i); |
377 if (supportedOptions.contains(item) && !disabledOptions.contains(ite
m)) { | 377 if (supportedOptions.contains(item) && !disabledOptions.contains(ite
m)) { |
378 assert !validItems.contains(item); | 378 assert !validItems.contains(item); |
379 validItems.add(0, item); | 379 validItems.add(0, item); |
380 } | 380 } |
381 } | 381 } |
382 } | 382 } |
383 | 383 |
384 /** | 384 /** |
385 * Given a set of params. It creates a list of items that should not be acce
ssible in specific | 385 * Given a set of params. It creates a list of items that should not be acce
ssible in specific |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 * @param params The {@link ContextMenuParams} to check. | 657 * @param params The {@link ContextMenuParams} to check. |
658 */ | 658 */ |
659 private String getUrl(ContextMenuParams params) { | 659 private String getUrl(ContextMenuParams params) { |
660 if (params.isAnchor()) { | 660 if (params.isAnchor()) { |
661 return params.getLinkUrl(); | 661 return params.getLinkUrl(); |
662 } else { | 662 } else { |
663 return params.getSrcUrl(); | 663 return params.getSrcUrl(); |
664 } | 664 } |
665 } | 665 } |
666 } | 666 } |
OLD | NEW |