| OLD | NEW |
| 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; | 5 package org.chromium.chrome.browser; |
| 6 | 6 |
| 7 import android.app.KeyguardManager; | 7 import android.app.KeyguardManager; |
| 8 import android.app.PendingIntent; | 8 import android.app.PendingIntent; |
| 9 import android.app.SearchManager; | 9 import android.app.SearchManager; |
| 10 import android.content.ComponentName; | 10 import android.content.ComponentName; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 import org.chromium.base.ApiCompatibilityUtils; | 24 import org.chromium.base.ApiCompatibilityUtils; |
| 25 import org.chromium.base.Log; | 25 import org.chromium.base.Log; |
| 26 import org.chromium.base.VisibleForTesting; | 26 import org.chromium.base.VisibleForTesting; |
| 27 import org.chromium.base.metrics.RecordHistogram; | 27 import org.chromium.base.metrics.RecordHistogram; |
| 28 import org.chromium.chrome.browser.externalauth.ExternalAuthUtils; | 28 import org.chromium.chrome.browser.externalauth.ExternalAuthUtils; |
| 29 import org.chromium.chrome.browser.omnibox.AutocompleteController; | 29 import org.chromium.chrome.browser.omnibox.AutocompleteController; |
| 30 import org.chromium.chrome.browser.search_engines.TemplateUrlService; | 30 import org.chromium.chrome.browser.search_engines.TemplateUrlService; |
| 31 import org.chromium.chrome.browser.tabmodel.document.ActivityDelegate; | 31 import org.chromium.chrome.browser.tabmodel.document.ActivityDelegate; |
| 32 import org.chromium.chrome.browser.util.IntentUtils; | 32 import org.chromium.chrome.browser.util.IntentUtils; |
| 33 import org.chromium.content_public.browser.LoadUrlParams; | 33 import org.chromium.content_public.browser.LoadUrlParams; |
| 34 import org.chromium.content_public.browser.WebContents; | |
| 35 import org.chromium.content_public.common.Referrer; | 34 import org.chromium.content_public.common.Referrer; |
| 36 | 35 |
| 37 import java.util.ArrayList; | 36 import java.util.ArrayList; |
| 38 import java.util.Iterator; | 37 import java.util.Iterator; |
| 39 import java.util.List; | 38 import java.util.List; |
| 40 import java.util.Locale; | 39 import java.util.Locale; |
| 41 | 40 |
| 42 /** | 41 /** |
| 43 * Handles all browser-related Intents. | 42 * Handles all browser-related Intents. |
| 44 */ | 43 */ |
| (...skipping 17 matching lines...) Expand all Loading... |
| 62 * Note: used by first-party applications, do not rename. | 61 * Note: used by first-party applications, do not rename. |
| 63 */ | 62 */ |
| 64 public static final String EXTRA_OPEN_IN_BG = "com.android.chrome.open_with_
affiliation"; | 63 public static final String EXTRA_OPEN_IN_BG = "com.android.chrome.open_with_
affiliation"; |
| 65 | 64 |
| 66 /** | 65 /** |
| 67 * Document mode: Records what caused a document to be created. | 66 * Document mode: Records what caused a document to be created. |
| 68 */ | 67 */ |
| 69 public static final String EXTRA_STARTED_BY = "com.android.chrome.started_by
"; | 68 public static final String EXTRA_STARTED_BY = "com.android.chrome.started_by
"; |
| 70 | 69 |
| 71 /** | 70 /** |
| 72 * A pointer to a native web contents object to associate with the given tab
. | 71 * Tab ID to use when creating a new Tab. |
| 73 */ | 72 */ |
| 74 public static final String EXTRA_WEB_CONTENTS = "com.android.chrome.web_cont
ents"; | 73 public static final String EXTRA_TAB_ID = "com.android.chrome.tab_id"; |
| 75 | 74 |
| 76 /** | 75 /** |
| 77 * The tab id of the parent tab, if any. | 76 * The tab id of the parent tab, if any. |
| 78 */ | 77 */ |
| 79 public static final String EXTRA_PARENT_TAB_ID = "com.android.chrome.parent_
tab_id"; | 78 public static final String EXTRA_PARENT_TAB_ID = "com.android.chrome.parent_
tab_id"; |
| 80 | 79 |
| 81 /** | 80 /** |
| 82 * Intent to bring the parent Activity back, if the parent Tab lives in a di
fferent Activity. | 81 * Intent to bring the parent Activity back, if the parent Tab lives in a di
fferent Activity. |
| 83 */ | 82 */ |
| 84 public static final String EXTRA_PARENT_INTENT = "com.android.chrome.parent_
intent"; | 83 public static final String EXTRA_PARENT_INTENT = "com.android.chrome.parent_
intent"; |
| (...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 * Retrieves pending referrer URL based on the given id. | 864 * Retrieves pending referrer URL based on the given id. |
| 866 * @param id The referrer id. | 865 * @param id The referrer id. |
| 867 * @return The URL for the referrer or null if none found. | 866 * @return The URL for the referrer or null if none found. |
| 868 */ | 867 */ |
| 869 public static String getPendingReferrerUrl(int id) { | 868 public static String getPendingReferrerUrl(int id) { |
| 870 if (sPendingReferrer != null && (sPendingReferrer.first == id)) { | 869 if (sPendingReferrer != null && (sPendingReferrer.first == id)) { |
| 871 return sPendingReferrer.second; | 870 return sPendingReferrer.second; |
| 872 } | 871 } |
| 873 return null; | 872 return null; |
| 874 } | 873 } |
| 875 | |
| 876 /** | |
| 877 * Retrieves a WebContents that has been parceled into the Intent. If the W
ebContents was | |
| 878 * created in a different process, it is dropped on the floor. | |
| 879 * @return WebContents if one exists in the Intent AND it was created in the
same process. | |
| 880 * null otherwise. | |
| 881 */ | |
| 882 public static WebContents getWebContentsFromIntent(Intent intent) { | |
| 883 WebContents deliveredContents = null; | |
| 884 if (intent != null) { | |
| 885 // The Intent may have been fired with a pre-created WebContents in
it. | |
| 886 intent.setExtrasClassLoader(WebContents.class.getClassLoader()); | |
| 887 deliveredContents = IntentUtils.safeGetParcelableExtra(intent, EXTRA
_WEB_CONTENTS); | |
| 888 intent.setExtrasClassLoader(null); | |
| 889 } | |
| 890 return deliveredContents; | |
| 891 } | |
| 892 } | 874 } |
| OLD | NEW |