Chromium Code Reviews| 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.components.service_tab_launcher; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.content.pm.ApplicationInfo; | 8 import android.content.pm.ApplicationInfo; |
| 9 import android.content.pm.PackageManager; | 9 import android.content.pm.PackageManager; |
| 10 import android.content.pm.PackageManager.NameNotFoundException; | 10 import android.content.pm.PackageManager.NameNotFoundException; |
| 11 import android.util.Log; | 11 import android.util.Log; |
| 12 | 12 |
| 13 import org.chromium.base.CalledByNative; | 13 import org.chromium.base.CalledByNative; |
| 14 import org.chromium.content_public.browser.WebContents; | 14 import org.chromium.content_public.browser.WebContents; |
| 15 | 15 |
| 16 /** | 16 /** |
| 17 * Tab Launcher to be used to launch new tabs from background Android Services, when it is not | 17 * Tab Launcher to be used to launch new tabs from background Android Services, when it is not |
| 18 * known whether an activity is available. It will send an intent to launch the activity. | 18 * known whether an activity is available. It will send an intent to launch the activity. |
| 19 * | 19 * |
| 20 * TODO(peter): Have the activity confirm that the tab has been launched. | 20 * TODO(peter): Have the activity confirm that the tab has been launched. |
| 21 */ | 21 */ |
| 22 public abstract class ServiceTabLauncher { | 22 public abstract class ServiceTabLauncher { |
| 23 private static final String TAG = ServiceTabLauncher.class.getSimpleName(); | 23 private static final String TAG = ServiceTabLauncher.class.getSimpleName(); |
| 24 private static final String SERVICE_TAB_LAUNCHER_KEY = | 24 private static final String SERVICE_TAB_LAUNCHER_KEY = |
|
Ted C
2015/04/02 16:48:07
just for extra certainty, are persisted anywhere a
Peter Beverloo
2015/04/13 12:53:21
No, they are not. The intents are only used for im
| |
| 25 "org.chromium.chrome.browser.SERVICE_TAB_LAUNCHER"; | 25 "org.chromium.components.service_tab_launcher.SERVICE_TAB_LAUNCHER"; |
| 26 | 26 |
| 27 // Name of the extra containing the Id of a tab launch request id. | 27 // Name of the extra containing the Id of a tab launch request id. |
| 28 public static final String LAUNCH_REQUEST_ID_EXTRA = | 28 public static final String LAUNCH_REQUEST_ID_EXTRA = |
| 29 "org.chromium.chrome.browser.ServiceTabLauncher.LAUNCH_REQUEST_ID"; | 29 "org.chromium.components.service_tab_launcher.ServiceTabLauncher.LAU NCH_REQUEST_ID"; |
| 30 | 30 |
| 31 private static ServiceTabLauncher sInstance; | 31 private static ServiceTabLauncher sInstance; |
| 32 | 32 |
| 33 /** | 33 /** |
| 34 * Launches the browser activity and launches a tab for |url|. | 34 * Launches the browser activity and launches a tab for |url|. |
| 35 * | 35 * |
| 36 * @param context The context using which the URL is being loaded. | 36 * @param context The context using which the URL is being loaded. |
| 37 * @param requestId Id of the request for launching this tab. | 37 * @param requestId Id of the request for launching this tab. |
| 38 * @param incognito Whether the tab should be launched in incognito mode. | 38 * @param incognito Whether the tab should be launched in incognito mode. |
| 39 * @param url The URL which should be launched in a tab. | 39 * @param url The URL which should be launched in a tab. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 * @param requestId Id of the tab launching request which has been fulfilled . | 102 * @param requestId Id of the tab launching request which has been fulfilled . |
| 103 * @param webContents The WebContents instance associated with this request. | 103 * @param webContents The WebContents instance associated with this request. |
| 104 */ | 104 */ |
| 105 public static void onWebContentsForRequestAvailable(int requestId, WebConten ts webContents) { | 105 public static void onWebContentsForRequestAvailable(int requestId, WebConten ts webContents) { |
| 106 nativeOnWebContentsForRequestAvailable(requestId, webContents); | 106 nativeOnWebContentsForRequestAvailable(requestId, webContents); |
| 107 } | 107 } |
| 108 | 108 |
| 109 private static native void nativeOnWebContentsForRequestAvailable( | 109 private static native void nativeOnWebContentsForRequestAvailable( |
| 110 int requestId, WebContents webContents); | 110 int requestId, WebContents webContents); |
| 111 } | 111 } |
| OLD | NEW |