| 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.firstrun; | 5 package org.chromium.chrome.browser.firstrun; |
| 6 | 6 |
| 7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.app.Fragment; | 8 import android.app.Fragment; |
| 9 import android.app.PendingIntent; | 9 import android.app.PendingIntent; |
| 10 import android.app.PendingIntent.CanceledException; | 10 import android.app.PendingIntent.CanceledException; |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 extraDataIntent.putExtra(FirstRunActivity.EXTRA_FIRST_RUN_COMPLETE, comp
lete); | 578 extraDataIntent.putExtra(FirstRunActivity.EXTRA_FIRST_RUN_COMPLETE, comp
lete); |
| 579 | 579 |
| 580 try { | 580 try { |
| 581 // After the PendingIntent has been sent, send a first run callback
to custom tabs if | 581 // After the PendingIntent has been sent, send a first run callback
to custom tabs if |
| 582 // necessary. | 582 // necessary. |
| 583 PendingIntent.OnFinished onFinished = new PendingIntent.OnFinished()
{ | 583 PendingIntent.OnFinished onFinished = new PendingIntent.OnFinished()
{ |
| 584 @Override | 584 @Override |
| 585 public void onSendFinished(PendingIntent pendingIntent, Intent i
ntent, | 585 public void onSendFinished(PendingIntent pendingIntent, Intent i
ntent, |
| 586 int resultCode, String resultData, Bundle resultExtras)
{ | 586 int resultCode, String resultData, Bundle resultExtras)
{ |
| 587 if (ChromeLauncherActivity.isCustomTabIntent(intent)) { | 587 if (ChromeLauncherActivity.isCustomTabIntent(intent)) { |
| 588 CustomTabsConnection.getInstance( | 588 CustomTabsConnection.getInstance().sendFirstRunCallbackI
fNecessary( |
| 589 getApplication()).sendFirstRunCallbackIfNecessar
y(intent, complete); | 589 intent, complete); |
| 590 } | 590 } |
| 591 } | 591 } |
| 592 }; | 592 }; |
| 593 | 593 |
| 594 // Use the PendingIntent to send the intent that originally launched
Chrome. The intent | 594 // Use the PendingIntent to send the intent that originally launched
Chrome. The intent |
| 595 // will go back to the ChromeLauncherActivity, which will route it a
ccordingly. | 595 // will go back to the ChromeLauncherActivity, which will route it a
ccordingly. |
| 596 pendingIntent.send(this, complete ? Activity.RESULT_OK : Activity.RE
SULT_CANCELED, | 596 pendingIntent.send(this, complete ? Activity.RESULT_OK : Activity.RE
SULT_CANCELED, |
| 597 extraDataIntent, onFinished, null); | 597 extraDataIntent, onFinished, null); |
| 598 return true; | 598 return true; |
| 599 } catch (CanceledException e) { | 599 } catch (CanceledException e) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 public void showInfoPage(int url) { | 666 public void showInfoPage(int url) { |
| 667 CustomTabActivity.showInfoPage(this, getString(url)); | 667 CustomTabActivity.showInfoPage(this, getString(url)); |
| 668 } | 668 } |
| 669 | 669 |
| 670 @VisibleForTesting | 670 @VisibleForTesting |
| 671 public static void setObserverForTest(FirstRunActivityObserver observer) { | 671 public static void setObserverForTest(FirstRunActivityObserver observer) { |
| 672 assert sObserver == null; | 672 assert sObserver == null; |
| 673 sObserver = observer; | 673 sObserver = observer; |
| 674 } | 674 } |
| 675 } | 675 } |
| OLD | NEW |