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.document; | 5 package org.chromium.chrome.browser.document; |
6 | 6 |
7 import android.annotation.TargetApi; | 7 import android.annotation.TargetApi; |
8 import android.content.Intent; | 8 import android.content.Intent; |
9 import android.graphics.Bitmap; | 9 import android.graphics.Bitmap; |
10 import android.graphics.Color; | 10 import android.graphics.Color; |
(...skipping 23 matching lines...) Expand all Loading... |
34 import org.chromium.chrome.browser.bookmarks.BookmarkUtils; | 34 import org.chromium.chrome.browser.bookmarks.BookmarkUtils; |
35 import org.chromium.chrome.browser.compositor.bottombar.OverlayPanel.StateChange
Reason; | 35 import org.chromium.chrome.browser.compositor.bottombar.OverlayPanel.StateChange
Reason; |
36 import org.chromium.chrome.browser.compositor.layouts.LayoutManagerDocument; | 36 import org.chromium.chrome.browser.compositor.layouts.LayoutManagerDocument; |
37 import org.chromium.chrome.browser.compositor.layouts.LayoutManagerDocumentTabSw
itcher; | 37 import org.chromium.chrome.browser.compositor.layouts.LayoutManagerDocumentTabSw
itcher; |
38 import org.chromium.chrome.browser.compositor.layouts.OverviewModeBehavior; | 38 import org.chromium.chrome.browser.compositor.layouts.OverviewModeBehavior; |
39 import org.chromium.chrome.browser.compositor.layouts.OverviewModeBehavior.Overv
iewModeObserver; | 39 import org.chromium.chrome.browser.compositor.layouts.OverviewModeBehavior.Overv
iewModeObserver; |
40 import org.chromium.chrome.browser.firstrun.FirstRunSignInProcessor; | 40 import org.chromium.chrome.browser.firstrun.FirstRunSignInProcessor; |
41 import org.chromium.chrome.browser.firstrun.FirstRunStatus; | 41 import org.chromium.chrome.browser.firstrun.FirstRunStatus; |
42 import org.chromium.chrome.browser.metrics.StartupMetrics; | 42 import org.chromium.chrome.browser.metrics.StartupMetrics; |
43 import org.chromium.chrome.browser.metrics.UmaUtils; | 43 import org.chromium.chrome.browser.metrics.UmaUtils; |
| 44 import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; |
44 import org.chromium.chrome.browser.ntp.NewTabPage; | 45 import org.chromium.chrome.browser.ntp.NewTabPage; |
45 import org.chromium.chrome.browser.preferences.ChromePreferenceManager; | 46 import org.chromium.chrome.browser.preferences.ChromePreferenceManager; |
46 import org.chromium.chrome.browser.preferences.PrefServiceBridge; | 47 import org.chromium.chrome.browser.preferences.PrefServiceBridge; |
47 import org.chromium.chrome.browser.preferences.datareduction.DataReductionPrefer
ences; | 48 import org.chromium.chrome.browser.preferences.datareduction.DataReductionPrefer
ences; |
48 import org.chromium.chrome.browser.preferences.datareduction.DataReductionPromoS
creen; | 49 import org.chromium.chrome.browser.preferences.datareduction.DataReductionPromoS
creen; |
49 import org.chromium.chrome.browser.signin.SigninPromoScreen; | 50 import org.chromium.chrome.browser.signin.SigninPromoScreen; |
50 import org.chromium.chrome.browser.tab.EmptyTabObserver; | 51 import org.chromium.chrome.browser.tab.EmptyTabObserver; |
51 import org.chromium.chrome.browser.tab.Tab; | 52 import org.chromium.chrome.browser.tab.Tab; |
52 import org.chromium.chrome.browser.tab.TabUma.TabCreationState; | 53 import org.chromium.chrome.browser.tab.TabUma.TabCreationState; |
53 import org.chromium.chrome.browser.tabmodel.AsyncTabParams; | 54 import org.chromium.chrome.browser.tabmodel.AsyncTabParams; |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 ? ApiCompatibilityUtils.getColor(getResources(), R.color.incogni
to_primary_color) | 570 ? ApiCompatibilityUtils.getColor(getResources(), R.color.incogni
to_primary_color) |
570 : ApiCompatibilityUtils.getColor(getResources(), R.color.default
_primary_color); | 571 : ApiCompatibilityUtils.getColor(getResources(), R.color.default
_primary_color); |
571 AsyncTabParams params = AsyncTabParamsManager.remove( | 572 AsyncTabParams params = AsyncTabParamsManager.remove( |
572 ActivityDelegate.getTabIdFromIntent(getIntent())); | 573 ActivityDelegate.getTabIdFromIntent(getIntent())); |
573 AsyncTabCreationParams asyncParams = params instanceof AsyncTabCreationP
arams | 574 AsyncTabCreationParams asyncParams = params instanceof AsyncTabCreationP
arams |
574 ? (AsyncTabCreationParams) params : null; | 575 ? (AsyncTabCreationParams) params : null; |
575 boolean isAffiliated = asyncParams != null ? asyncParams.isAffiliated()
: false; | 576 boolean isAffiliated = asyncParams != null ? asyncParams.isAffiliated()
: false; |
576 boolean isCreatedWithWebContents = asyncParams != null | 577 boolean isCreatedWithWebContents = asyncParams != null |
577 && asyncParams.getWebContents() != null; | 578 && asyncParams.getWebContents() != null; |
578 | 579 |
| 580 if (!isIncognito() && asyncParams != null) { |
| 581 LoadUrlParams loadUrlParams = asyncParams.getLoadUrlParams(); |
| 582 if (loadUrlParams != null && loadUrlParams.getUrl() != null) { |
| 583 loadUrlParams.setUrl(DataReductionProxySettings.getInstance() |
| 584 .maybeExtractWebliteUrl(loadUrlParams.getUrl())); |
| 585 } |
| 586 } |
| 587 |
579 mTab = createActivityTab(asyncParams); | 588 mTab = createActivityTab(asyncParams); |
580 | 589 |
581 if (asyncParams != null && asyncParams.getWebContents() != null) { | 590 if (asyncParams != null && asyncParams.getWebContents() != null) { |
582 Intent parentIntent = IntentUtils.safeGetParcelableExtra(getIntent()
, | 591 Intent parentIntent = IntentUtils.safeGetParcelableExtra(getIntent()
, |
583 IntentHandler.EXTRA_PARENT_INTENT); | 592 IntentHandler.EXTRA_PARENT_INTENT); |
584 mTab.setParentIntent(parentIntent); | 593 mTab.setParentIntent(parentIntent); |
585 } | 594 } |
586 | 595 |
587 if (mTabModel.isNativeInitialized()) { | 596 if (mTabModel.isNativeInitialized()) { |
588 mTabModel.addTab(getIntent(), mTab); | 597 mTabModel.addTab(getIntent(), mTab); |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
953 | 962 |
954 /** | 963 /** |
955 * Launch a new DocumentActivity showing the new tab page. | 964 * Launch a new DocumentActivity showing the new tab page. |
956 * @param incognito Whether the new NTP should be in incognito mode. | 965 * @param incognito Whether the new NTP should be in incognito mode. |
957 */ | 966 */ |
958 private void launchNtp(boolean incognito) { | 967 private void launchNtp(boolean incognito) { |
959 if (incognito && !PrefServiceBridge.getInstance().isIncognitoModeEnabled
()) return; | 968 if (incognito && !PrefServiceBridge.getInstance().isIncognitoModeEnabled
()) return; |
960 getTabCreator(incognito).launchNTP(); | 969 getTabCreator(incognito).launchNTP(); |
961 } | 970 } |
962 } | 971 } |
OLD | NEW |