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; |
11 import android.text.TextUtils; | 11 import android.text.TextUtils; |
12 import android.util.Pair; | 12 import android.util.Pair; |
13 import android.view.ContextMenu; | 13 import android.view.ContextMenu; |
14 import android.webkit.MimeTypeMap; | 14 import android.webkit.MimeTypeMap; |
15 | 15 |
16 import org.chromium.base.CollectionUtil; | 16 import org.chromium.base.CollectionUtil; |
17 import org.chromium.base.CommandLine; | |
17 import org.chromium.base.metrics.RecordHistogram; | 18 import org.chromium.base.metrics.RecordHistogram; |
18 import org.chromium.chrome.R; | 19 import org.chromium.chrome.R; |
19 import org.chromium.chrome.browser.ChromeFeatureList; | 20 import org.chromium.chrome.browser.ChromeFeatureList; |
21 import org.chromium.chrome.browser.ChromeSwitches; | |
20 import org.chromium.chrome.browser.firstrun.FirstRunStatus; | 22 import org.chromium.chrome.browser.firstrun.FirstRunStatus; |
21 import org.chromium.chrome.browser.preferences.ChromePreferenceManager; | 23 import org.chromium.chrome.browser.preferences.ChromePreferenceManager; |
22 import org.chromium.chrome.browser.preferences.datareduction.DataReductionProxyU ma; | 24 import org.chromium.chrome.browser.preferences.datareduction.DataReductionProxyU ma; |
23 import org.chromium.chrome.browser.search_engines.TemplateUrlService; | 25 import org.chromium.chrome.browser.search_engines.TemplateUrlService; |
24 import org.chromium.chrome.browser.util.UrlUtilities; | 26 import org.chromium.chrome.browser.util.UrlUtilities; |
25 import org.chromium.content_public.common.ContentUrlConstants; | 27 import org.chromium.content_public.common.ContentUrlConstants; |
26 | 28 |
27 import java.lang.annotation.Retention; | 29 import java.lang.annotation.Retention; |
28 import java.lang.annotation.RetentionPolicy; | 30 import java.lang.annotation.RetentionPolicy; |
29 import java.net.URI; | 31 import java.net.URI; |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
249 titleText = params.getTitleText(); | 251 titleText = params.getTitleText(); |
250 } | 252 } |
251 return titleText; | 253 return titleText; |
252 } | 254 } |
253 | 255 |
254 @Override | 256 @Override |
255 public List<Pair<Integer, List<ContextMenuItem>>> buildContextMenu( | 257 public List<Pair<Integer, List<ContextMenuItem>>> buildContextMenu( |
256 ContextMenu menu, Context context, ContextMenuParams params) { | 258 ContextMenu menu, Context context, ContextMenuParams params) { |
257 // Add all items in a group | 259 // Add all items in a group |
258 Set<ContextMenuItem> supportedOptions = new HashSet<>(); | 260 Set<ContextMenuItem> supportedOptions = new HashSet<>(); |
259 if (FirstRunStatus.getFirstRunFlowComplete()) { | 261 // Limit context menu to copying until FRE has been completed, |
dominickn
2017/05/23 03:20:13
Amend this comment as discussed.
piotrs
2017/05/23 04:11:11
Done.
| |
262 // unless FRE has been explicitly disabled. | |
263 if (FirstRunStatus.getFirstRunFlowComplete() | |
264 || CommandLine.getInstance().hasSwitch( | |
265 ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE)) { | |
260 supportedOptions.addAll(BASE_WHITELIST); | 266 supportedOptions.addAll(BASE_WHITELIST); |
261 if (mMode == FULLSCREEN_TAB_MODE) { | 267 if (mMode == FULLSCREEN_TAB_MODE) { |
262 supportedOptions.addAll(FULLSCREEN_TAB_MODE_WHITELIST); | 268 supportedOptions.addAll(FULLSCREEN_TAB_MODE_WHITELIST); |
263 } else if (mMode == CUSTOM_TAB_MODE) { | 269 } else if (mMode == CUSTOM_TAB_MODE) { |
264 supportedOptions.addAll(CUSTOM_TAB_MODE_WHITELIST); | 270 supportedOptions.addAll(CUSTOM_TAB_MODE_WHITELIST); |
265 } else { | 271 } else { |
266 supportedOptions.addAll(NORMAL_MODE_WHITELIST); | 272 supportedOptions.addAll(NORMAL_MODE_WHITELIST); |
267 } | 273 } |
268 } else { | 274 } else { |
269 supportedOptions.add(ChromeContextMenuItem.COPY_LINK_ADDRESS); | 275 supportedOptions.add(ChromeContextMenuItem.COPY_LINK_ADDRESS); |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
657 * @param params The {@link ContextMenuParams} to check. | 663 * @param params The {@link ContextMenuParams} to check. |
658 */ | 664 */ |
659 private String getUrl(ContextMenuParams params) { | 665 private String getUrl(ContextMenuParams params) { |
660 if (params.isAnchor()) { | 666 if (params.isAnchor()) { |
661 return params.getLinkUrl(); | 667 return params.getLinkUrl(); |
662 } else { | 668 } else { |
663 return params.getSrcUrl(); | 669 return params.getSrcUrl(); |
664 } | 670 } |
665 } | 671 } |
666 } | 672 } |
OLD | NEW |