| 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.PendingIntent; | 7 import android.app.PendingIntent; |
| 8 import android.content.Intent; | 8 import android.content.Intent; |
| 9 import android.graphics.Bitmap; | 9 import android.graphics.Bitmap; |
| 10 import android.net.Uri; | 10 import android.net.Uri; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 private CustomTabContentHandler mCustomTabContentHandler; | 83 private CustomTabContentHandler mCustomTabContentHandler; |
| 84 private Tab mMainTab; | 84 private Tab mMainTab; |
| 85 private CustomTabBottomBarDelegate mBottomBarDelegate; | 85 private CustomTabBottomBarDelegate mBottomBarDelegate; |
| 86 | 86 |
| 87 // This is to give the right package name while using the client's resources
during an | 87 // This is to give the right package name while using the client's resources
during an |
| 88 // overridePendingTransition call. | 88 // overridePendingTransition call. |
| 89 // TODO(ianwen, yusufo): Figure out a solution to extract external resources
without having to | 89 // TODO(ianwen, yusufo): Figure out a solution to extract external resources
without having to |
| 90 // change the package name. | 90 // change the package name. |
| 91 private boolean mShouldOverridePackage; | 91 private boolean mShouldOverridePackage; |
| 92 | 92 |
| 93 private boolean mRecordedStartupUma; | |
| 94 private boolean mHasCreatedTabEarly; | 93 private boolean mHasCreatedTabEarly; |
| 95 private boolean mIsInitialStart = true; | 94 private boolean mIsInitialStart = true; |
| 96 private boolean mHasPrerender; | 95 private boolean mHasPrerender; |
| 97 private CustomTabObserver mTabObserver; | 96 private CustomTabObserver mTabObserver; |
| 98 | 97 |
| 99 private String mPrerenderedUrl; | 98 private String mPrerenderedUrl; |
| 100 private boolean mHasPrerendered; | 99 private boolean mHasPrerendered; |
| 101 | 100 |
| 102 // Only the normal tab model is observed because there is no icognito tabmod
el in Custom Tabs. | 101 // Only the normal tab model is observed because there is no icognito tabmod
el in Custom Tabs. |
| 103 private TabModelObserver mTabModelObserver = new EmptyTabModelObserver() { | 102 private TabModelObserver mTabModelObserver = new EmptyTabModelObserver() { |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 "CustomTabs.ServiceClient.PackageName", packageName); | 417 "CustomTabs.ServiceClient.PackageName", packageName); |
| 419 } | 418 } |
| 420 }); | 419 }); |
| 421 } | 420 } |
| 422 | 421 |
| 423 @Override | 422 @Override |
| 424 public void onStartWithNative() { | 423 public void onStartWithNative() { |
| 425 super.onStartWithNative(); | 424 super.onStartWithNative(); |
| 426 setActiveContentHandler(mCustomTabContentHandler); | 425 setActiveContentHandler(mCustomTabContentHandler); |
| 427 | 426 |
| 428 if (!mRecordedStartupUma) { | 427 if (getSavedInstanceState() != null || !mIsInitialStart) { |
| 429 mRecordedStartupUma = true; | 428 RecordUserAction.record("CustomTabs.StartedReopened"); |
| 429 } else { |
| 430 ExternalAppId externalId = | 430 ExternalAppId externalId = |
| 431 IntentHandler.determineExternalIntentSource(getPackageName()
, getIntent()); | 431 IntentHandler.determineExternalIntentSource(getPackageName()
, getIntent()); |
| 432 RecordHistogram.recordEnumeratedHistogram("CustomTabs.ClientAppId", | 432 RecordHistogram.recordEnumeratedHistogram("CustomTabs.ClientAppId", |
| 433 externalId.ordinal(), ExternalAppId.INDEX_BOUNDARY.ordinal()
); | 433 externalId.ordinal(), ExternalAppId.INDEX_BOUNDARY.ordinal()
); |
| 434 } | |
| 435 | 434 |
| 436 if (getSavedInstanceState() != null || !mIsInitialStart) { | |
| 437 RecordUserAction.record("CustomTabs.StartedReopened"); | |
| 438 } else { | |
| 439 RecordUserAction.record("CustomTabs.StartedInitially"); | 435 RecordUserAction.record("CustomTabs.StartedInitially"); |
| 440 } | 436 } |
| 441 mIsInitialStart = false; | 437 mIsInitialStart = false; |
| 442 } | 438 } |
| 443 | 439 |
| 444 @Override | 440 @Override |
| 445 public void onPauseWithNative() { | 441 public void onPauseWithNative() { |
| 446 super.onPauseWithNative(); | 442 super.onPauseWithNative(); |
| 447 CustomTabsConnection.getInstance(getApplication()).notifyNavigationEvent
( | 443 CustomTabsConnection.getInstance(getApplication()).notifyNavigationEvent
( |
| 448 mSession, CustomTabsCallback.TAB_HIDDEN); | 444 mSession, CustomTabsCallback.TAB_HIDDEN); |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 * overridden if the Data Reduction Proxy is using Lo-Fi previews. | 800 * overridden if the Data Reduction Proxy is using Lo-Fi previews. |
| 805 */ | 801 */ |
| 806 private String getUrlToLoad() { | 802 private String getUrlToLoad() { |
| 807 String url = IntentHandler.getUrlFromIntent(getIntent()); | 803 String url = IntentHandler.getUrlFromIntent(getIntent()); |
| 808 if (!TextUtils.isEmpty(url)) { | 804 if (!TextUtils.isEmpty(url)) { |
| 809 url = DataReductionProxySettings.getInstance().maybeRewriteWebliteUr
l(url); | 805 url = DataReductionProxySettings.getInstance().maybeRewriteWebliteUr
l(url); |
| 810 } | 806 } |
| 811 return url; | 807 return url; |
| 812 } | 808 } |
| 813 } | 809 } |
| OLD | NEW |