| 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.customtabs; | 5 package org.chromium.chrome.browser.customtabs; |
| 6 | 6 |
| 7 import android.app.Application; | |
| 8 import android.content.ComponentName; | 7 import android.content.ComponentName; |
| 9 import android.content.Context; | 8 import android.content.Context; |
| 10 import android.content.Intent; | 9 import android.content.Intent; |
| 11 import android.net.Uri; | 10 import android.net.Uri; |
| 12 import android.os.Process; | 11 import android.os.Process; |
| 13 import android.support.customtabs.CustomTabsIntent; | 12 import android.support.customtabs.CustomTabsIntent; |
| 14 import android.support.customtabs.CustomTabsSession; | 13 import android.support.customtabs.CustomTabsSession; |
| 15 | 14 |
| 16 import org.chromium.base.ThreadUtils; | 15 import org.chromium.base.ThreadUtils; |
| 17 import org.chromium.chrome.browser.document.ChromeLauncherActivity; | 16 import org.chromium.chrome.browser.document.ChromeLauncherActivity; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 31 CustomTabsSession.createDummySessionForTesting( | 30 CustomTabsSession.createDummySessionForTesting( |
| 32 new ComponentName(context, ChromeLauncherActivity.class)
)); | 31 new ComponentName(context, ChromeLauncherActivity.class)
)); |
| 33 CustomTabsIntent customTabsIntent = builder.build(); | 32 CustomTabsIntent customTabsIntent = builder.build(); |
| 34 Intent intent = customTabsIntent.intent; | 33 Intent intent = customTabsIntent.intent; |
| 35 intent.setAction(Intent.ACTION_VIEW); | 34 intent.setAction(Intent.ACTION_VIEW); |
| 36 intent.setData(Uri.parse(url)); | 35 intent.setData(Uri.parse(url)); |
| 37 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | 36 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| 38 return intent; | 37 return intent; |
| 39 } | 38 } |
| 40 | 39 |
| 41 public static CustomTabsConnection setUpConnection(Application application)
{ | 40 public static CustomTabsConnection setUpConnection() { |
| 42 CustomTabsConnection connection = CustomTabsConnection.getInstance(appli
cation); | 41 CustomTabsConnection connection = CustomTabsConnection.getInstance(); |
| 43 connection.resetThrottling(application, Process.myUid()); | 42 connection.resetThrottling(Process.myUid()); |
| 44 return connection; | 43 return connection; |
| 45 } | 44 } |
| 46 | 45 |
| 47 public static void cleanupSessions(final CustomTabsConnection connection) { | 46 public static void cleanupSessions(final CustomTabsConnection connection) { |
| 48 ThreadUtils.runOnUiThreadBlocking(new Runnable() { | 47 ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
| 49 @Override | 48 @Override |
| 50 public void run() { | 49 public void run() { |
| 51 connection.cleanupAll(); | 50 connection.cleanupAll(); |
| 52 } | 51 } |
| 53 }); | 52 }); |
| 54 } | 53 } |
| 55 } | 54 } |
| OLD | NEW |