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.Activity; | 7 import android.app.Activity; |
| 8 import android.app.Application; |
8 import android.app.PendingIntent; | 9 import android.app.PendingIntent; |
9 import android.content.Context; | 10 import android.content.Context; |
10 import android.content.Intent; | 11 import android.content.Intent; |
11 import android.content.SharedPreferences; | 12 import android.content.SharedPreferences; |
12 import android.graphics.Bitmap; | 13 import android.graphics.Bitmap; |
13 import android.graphics.Color; | 14 import android.graphics.Color; |
14 import android.graphics.drawable.ColorDrawable; | 15 import android.graphics.drawable.ColorDrawable; |
15 import android.graphics.drawable.Drawable; | 16 import android.graphics.drawable.Drawable; |
16 import android.net.Uri; | 17 import android.net.Uri; |
17 import android.os.Bundle; | 18 import android.os.Bundle; |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 if (sActiveContentHandler.shouldIgnoreIntent(intent)) { | 231 if (sActiveContentHandler.shouldIgnoreIntent(intent)) { |
231 Log.w(TAG, "Incoming intent to Custom Tab was ignored."); | 232 Log.w(TAG, "Incoming intent to Custom Tab was ignored."); |
232 return false; | 233 return false; |
233 } | 234 } |
234 | 235 |
235 CustomTabsSessionToken session = CustomTabsSessionToken.getSessionTokenF
romIntent(intent); | 236 CustomTabsSessionToken session = CustomTabsSessionToken.getSessionTokenF
romIntent(intent); |
236 if (session == null || !session.equals(sActiveContentHandler.getSession(
))) return false; | 237 if (session == null || !session.equals(sActiveContentHandler.getSession(
))) return false; |
237 | 238 |
238 String url = IntentHandler.getUrlFromIntent(intent); | 239 String url = IntentHandler.getUrlFromIntent(intent); |
239 if (TextUtils.isEmpty(url)) return false; | 240 if (TextUtils.isEmpty(url)) return false; |
| 241 CustomTabsConnection connection = CustomTabsConnection.getInstance( |
| 242 (Application) ContextUtils.getApplicationContext()); |
| 243 connection.onHandledIntent(session, url, intent); |
240 sActiveContentHandler.loadUrlAndTrackFromTimestamp(new LoadUrlParams(url
), | 244 sActiveContentHandler.loadUrlAndTrackFromTimestamp(new LoadUrlParams(url
), |
241 IntentHandler.getTimestampFromIntent(intent)); | 245 IntentHandler.getTimestampFromIntent(intent)); |
242 return true; | 246 return true; |
243 } | 247 } |
244 | 248 |
245 /** | 249 /** |
246 * @return Whether the given session is the currently active session. | 250 * @return Whether the given session is the currently active session. |
247 */ | 251 */ |
248 public static boolean isActiveSession(CustomTabsSessionToken session) { | 252 public static boolean isActiveSession(CustomTabsSessionToken session) { |
249 if (sActiveContentHandler == null) return false; | 253 if (sActiveContentHandler == null) return false; |
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1209 // Custom Tabs can be used to open Chrome help pages before the ToS has
been accepted. | 1213 // Custom Tabs can be used to open Chrome help pages before the ToS has
been accepted. |
1210 if (IntentHandler.isIntentChromeOrFirstParty(intent) | 1214 if (IntentHandler.isIntentChromeOrFirstParty(intent) |
1211 && IntentUtils.safeGetBooleanExtra( | 1215 && IntentUtils.safeGetBooleanExtra( |
1212 intent, CustomTabIntentDataProvider.EXTRA_IS_INFO_PAG
E, false)) { | 1216 intent, CustomTabIntentDataProvider.EXTRA_IS_INFO_PAG
E, false)) { |
1213 return false; | 1217 return false; |
1214 } | 1218 } |
1215 | 1219 |
1216 return super.requiresFirstRunToBeCompleted(intent); | 1220 return super.requiresFirstRunToBeCompleted(intent); |
1217 } | 1221 } |
1218 } | 1222 } |
OLD | NEW |