Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(317)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java

Issue 2777233004: Using UrlConstants instead of hardcoded values in few places (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/document/ChromeLauncherActivity.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.chrome.browser.contextualsearch; 5 package org.chromium.chrome.browser.contextualsearch;
6 6
7 import android.text.TextUtils; 7 import android.text.TextUtils;
8 import android.view.View; 8 import android.view.View;
9 import android.view.ViewGroup; 9 import android.view.ViewGroup;
10 import android.view.ViewTreeObserver; 10 import android.view.ViewTreeObserver;
11 import android.view.ViewTreeObserver.OnGlobalFocusChangeListener; 11 import android.view.ViewTreeObserver.OnGlobalFocusChangeListener;
12 12
13 import org.chromium.base.ObserverList; 13 import org.chromium.base.ObserverList;
14 import org.chromium.base.SysUtils; 14 import org.chromium.base.SysUtils;
15 import org.chromium.base.VisibleForTesting; 15 import org.chromium.base.VisibleForTesting;
16 import org.chromium.base.annotations.CalledByNative; 16 import org.chromium.base.annotations.CalledByNative;
17 import org.chromium.base.metrics.RecordUserAction; 17 import org.chromium.base.metrics.RecordUserAction;
18 import org.chromium.chrome.R; 18 import org.chromium.chrome.R;
19 import org.chromium.chrome.browser.ChromeActivity; 19 import org.chromium.chrome.browser.ChromeActivity;
20 import org.chromium.chrome.browser.UrlConstants;
20 import org.chromium.chrome.browser.compositor.bottombar.OverlayContentDelegate; 21 import org.chromium.chrome.browser.compositor.bottombar.OverlayContentDelegate;
21 import org.chromium.chrome.browser.compositor.bottombar.OverlayPanel.PanelState; 22 import org.chromium.chrome.browser.compositor.bottombar.OverlayPanel.PanelState;
22 import org.chromium.chrome.browser.compositor.bottombar.OverlayPanel.StateChange Reason; 23 import org.chromium.chrome.browser.compositor.bottombar.OverlayPanel.StateChange Reason;
23 import org.chromium.chrome.browser.compositor.bottombar.OverlayPanelContentViewD elegate; 24 import org.chromium.chrome.browser.compositor.bottombar.OverlayPanelContentViewD elegate;
24 import org.chromium.chrome.browser.compositor.bottombar.contextualsearch.Context ualSearchPanel; 25 import org.chromium.chrome.browser.compositor.bottombar.contextualsearch.Context ualSearchPanel;
25 import org.chromium.chrome.browser.contextualsearch.ContextualSearchBlacklist.Bl acklistReason; 26 import org.chromium.chrome.browser.contextualsearch.ContextualSearchBlacklist.Bl acklistReason;
26 import org.chromium.chrome.browser.contextualsearch.ContextualSearchSelectionCon troller.SelectionType; 27 import org.chromium.chrome.browser.contextualsearch.ContextualSearchSelectionCon troller.SelectionType;
27 import org.chromium.chrome.browser.externalnav.ExternalNavigationHandler; 28 import org.chromium.chrome.browser.externalnav.ExternalNavigationHandler;
28 import org.chromium.chrome.browser.externalnav.ExternalNavigationHandler.Overrid eUrlLoadingResult; 29 import org.chromium.chrome.browser.externalnav.ExternalNavigationHandler.Overrid eUrlLoadingResult;
29 import org.chromium.chrome.browser.externalnav.ExternalNavigationParams; 30 import org.chromium.chrome.browser.externalnav.ExternalNavigationParams;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 ContextualSearchNetworkCommunica tor, 69 ContextualSearchNetworkCommunica tor,
69 ContextualSearchSelectionHandler , SelectionClient { 70 ContextualSearchSelectionHandler , SelectionClient {
70 private static final String INTENT_URL_PREFIX = "intent:"; 71 private static final String INTENT_URL_PREFIX = "intent:";
71 72
72 // The animation duration of a URL being promoted to a tab when triggered by an 73 // The animation duration of a URL being promoted to a tab when triggered by an
73 // intercept navigation. This is faster than the standard tab promotion anim ation 74 // intercept navigation. This is faster than the standard tab promotion anim ation
74 // so that it completes before the navigation. 75 // so that it completes before the navigation.
75 private static final long INTERCEPT_NAVIGATION_PROMOTION_ANIMATION_DURATION_ MS = 40; 76 private static final long INTERCEPT_NAVIGATION_PROMOTION_ANIMATION_DURATION_ MS = 40;
76 77
77 // We blacklist this URL because malformed URLs may bring up this page. 78 // We blacklist this URL because malformed URLs may bring up this page.
78 private static final String BLACKLISTED_URL = "about:blank"; 79 private static final String BLACKLISTED_URL = UrlConstants.ABOUT_BLANK_DISPL AY_URL;
79 80
80 private static final Pattern CONTAINS_WHITESPACE_PATTERN = Pattern.compile(" \\s"); 81 private static final Pattern CONTAINS_WHITESPACE_PATTERN = Pattern.compile(" \\s");
81 82
82 // When we don't need to send any "home country" code we can just pass the e mpty string. 83 // When we don't need to send any "home country" code we can just pass the e mpty string.
83 private static final String NO_HOME_COUNTRY = ""; 84 private static final String NO_HOME_COUNTRY = "";
84 85
85 private final ObserverList<ContextualSearchObserver> mObservers = 86 private final ObserverList<ContextualSearchObserver> mObservers =
86 new ObserverList<ContextualSearchObserver>(); 87 new ObserverList<ContextualSearchObserver>();
87 88
88 private final ChromeActivity mActivity; 89 private final ChromeActivity mActivity;
(...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1449 private native void nativeStartSearchTermResolutionRequest(long nativeContex tualSearchManager, 1450 private native void nativeStartSearchTermResolutionRequest(long nativeContex tualSearchManager,
1450 ContextualSearchContext contextualSearchContext, WebContents baseWeb Contents); 1451 ContextualSearchContext contextualSearchContext, WebContents baseWeb Contents);
1451 protected native void nativeGatherSurroundingText(long nativeContextualSearc hManager, 1452 protected native void nativeGatherSurroundingText(long nativeContextualSearc hManager,
1452 ContextualSearchContext contextualSearchContext, WebContents baseWeb Contents); 1453 ContextualSearchContext contextualSearchContext, WebContents baseWeb Contents);
1453 private native void nativeEnableContextualSearchJsApiForOverlay( 1454 private native void nativeEnableContextualSearchJsApiForOverlay(
1454 long nativeContextualSearchManager, WebContents overlayWebContents); 1455 long nativeContextualSearchManager, WebContents overlayWebContents);
1455 // Don't call these directly, instead call the private methods that cache th e results. 1456 // Don't call these directly, instead call the private methods that cache th e results.
1456 private native String nativeGetTargetLanguage(long nativeContextualSearchMan ager); 1457 private native String nativeGetTargetLanguage(long nativeContextualSearchMan ager);
1457 private native String nativeGetAcceptLanguages(long nativeContextualSearchMa nager); 1458 private native String nativeGetAcceptLanguages(long nativeContextualSearchMa nager);
1458 } 1459 }
OLDNEW
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/document/ChromeLauncherActivity.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698