| 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.content.SharedPreferences; | 9 import android.content.SharedPreferences; |
| 10 import android.graphics.Bitmap; | 10 import android.graphics.Bitmap; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; | 51 import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; |
| 52 import org.chromium.chrome.browser.pageinfo.WebsiteSettingsPopup; | 52 import org.chromium.chrome.browser.pageinfo.WebsiteSettingsPopup; |
| 53 import org.chromium.chrome.browser.rappor.RapporServiceBridge; | 53 import org.chromium.chrome.browser.rappor.RapporServiceBridge; |
| 54 import org.chromium.chrome.browser.tab.Tab; | 54 import org.chromium.chrome.browser.tab.Tab; |
| 55 import org.chromium.chrome.browser.tab.TabIdManager; | 55 import org.chromium.chrome.browser.tab.TabIdManager; |
| 56 import org.chromium.chrome.browser.tabmodel.EmptyTabModelObserver; | 56 import org.chromium.chrome.browser.tabmodel.EmptyTabModelObserver; |
| 57 import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType; | 57 import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType; |
| 58 import org.chromium.chrome.browser.tabmodel.TabModelObserver; | 58 import org.chromium.chrome.browser.tabmodel.TabModelObserver; |
| 59 import org.chromium.chrome.browser.tabmodel.TabModelSelectorImpl; | 59 import org.chromium.chrome.browser.tabmodel.TabModelSelectorImpl; |
| 60 import org.chromium.chrome.browser.tabmodel.TabPersistencePolicy; | 60 import org.chromium.chrome.browser.tabmodel.TabPersistencePolicy; |
| 61 import org.chromium.chrome.browser.tabmodel.TabbedModeTabPersistencePolicy; | |
| 62 import org.chromium.chrome.browser.toolbar.ToolbarControlContainer; | 61 import org.chromium.chrome.browser.toolbar.ToolbarControlContainer; |
| 63 import org.chromium.chrome.browser.util.ColorUtils; | 62 import org.chromium.chrome.browser.util.ColorUtils; |
| 64 import org.chromium.chrome.browser.util.FeatureUtilities; | 63 import org.chromium.chrome.browser.util.FeatureUtilities; |
| 65 import org.chromium.chrome.browser.util.UrlUtilities; | 64 import org.chromium.chrome.browser.util.UrlUtilities; |
| 66 import org.chromium.chrome.browser.widget.findinpage.FindToolbarManager; | 65 import org.chromium.chrome.browser.widget.findinpage.FindToolbarManager; |
| 67 import org.chromium.components.dom_distiller.core.DomDistillerUrlUtils; | 66 import org.chromium.components.dom_distiller.core.DomDistillerUrlUtils; |
| 68 import org.chromium.content_public.browser.LoadUrlParams; | 67 import org.chromium.content_public.browser.LoadUrlParams; |
| 69 import org.chromium.content_public.browser.WebContents; | 68 import org.chromium.content_public.browser.WebContents; |
| 70 import org.chromium.content_public.common.Referrer; | 69 import org.chromium.content_public.common.Referrer; |
| 71 import org.chromium.ui.base.PageTransition; | 70 import org.chromium.ui.base.PageTransition; |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 | 256 |
| 258 @Override | 257 @Override |
| 259 public boolean shouldAllocateChildConnection() { | 258 public boolean shouldAllocateChildConnection() { |
| 260 return !mHasCreatedTabEarly && !mHasPrerender | 259 return !mHasCreatedTabEarly && !mHasPrerender |
| 261 && !WarmupManager.getInstance().hasSpareWebContents(); | 260 && !WarmupManager.getInstance().hasSpareWebContents(); |
| 262 } | 261 } |
| 263 | 262 |
| 264 @Override | 263 @Override |
| 265 public void postInflationStartup() { | 264 public void postInflationStartup() { |
| 266 super.postInflationStartup(); | 265 super.postInflationStartup(); |
| 267 // TODO(tedchoc): Replace with an actual CCT implementation for the pers
istence policy. | 266 TabPersistencePolicy persistencePolicy = new CustomTabTabPersistencePoli
cy( |
| 268 // Currently, this relies on checks for CUSTOM_TABS_SELEC
TOR_INDEX in the | 267 getTaskId(), getSavedInstanceState() != null); |
| 269 // main TabPersitentStore that ignores certain actions. | |
| 270 TabPersistencePolicy persistencePolicy = new TabbedModeTabPersistencePol
icy( | |
| 271 this, TabModelSelectorImpl.CUSTOM_TABS_SELECTOR_INDEX); | |
| 272 setTabModelSelector(new TabModelSelectorImpl( | 268 setTabModelSelector(new TabModelSelectorImpl( |
| 273 this, persistencePolicy, getWindowAndroid(), false)); | 269 this, persistencePolicy, getWindowAndroid(), false)); |
| 274 | 270 |
| 275 getToolbarManager().setCloseButtonDrawable(mIntentDataProvider.getCloseB
uttonDrawable()); | 271 getToolbarManager().setCloseButtonDrawable(mIntentDataProvider.getCloseB
uttonDrawable()); |
| 276 getToolbarManager().setShowTitle(mIntentDataProvider.getTitleVisibilityS
tate() | 272 getToolbarManager().setShowTitle(mIntentDataProvider.getTitleVisibilityS
tate() |
| 277 == CustomTabsIntent.SHOW_PAGE_TITLE); | 273 == CustomTabsIntent.SHOW_PAGE_TITLE); |
| 278 if (CustomTabsConnection.getInstance(getApplication()) | 274 if (CustomTabsConnection.getInstance(getApplication()) |
| 279 .shouldHideDomainForSession(mSession)) { | 275 .shouldHideDomainForSession(mSession)) { |
| 280 getToolbarManager().setUrlBarHidden(true); | 276 getToolbarManager().setUrlBarHidden(true); |
| 281 } | 277 } |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 * overridden if the Data Reduction Proxy is using Lo-Fi previews. | 842 * overridden if the Data Reduction Proxy is using Lo-Fi previews. |
| 847 */ | 843 */ |
| 848 private String getUrlToLoad() { | 844 private String getUrlToLoad() { |
| 849 String url = IntentHandler.getUrlFromIntent(getIntent()); | 845 String url = IntentHandler.getUrlFromIntent(getIntent()); |
| 850 if (!TextUtils.isEmpty(url)) { | 846 if (!TextUtils.isEmpty(url)) { |
| 851 url = DataReductionProxySettings.getInstance().maybeRewriteWebliteUr
l(url); | 847 url = DataReductionProxySettings.getInstance().maybeRewriteWebliteUr
l(url); |
| 852 } | 848 } |
| 853 return url; | 849 return url; |
| 854 } | 850 } |
| 855 } | 851 } |
| OLD | NEW |