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.compositor.layouts; | 5 package org.chromium.chrome.browser.compositor.layouts; |
6 | 6 |
7 import android.annotation.TargetApi; | 7 import android.annotation.TargetApi; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.graphics.RectF; | 9 import android.graphics.RectF; |
10 import android.os.Build; | 10 import android.os.Build; |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 TabModelSelector selector = getTabModelSelector(); | 253 TabModelSelector selector = getTabModelSelector(); |
254 Tab tab = selector.getTabById(tabId); | 254 Tab tab = selector.getTabById(tabId); |
255 if (tab == null) return; | 255 if (tab == null) return; |
256 | 256 |
257 LayoutTab layoutTab = mTabCache.get(tabId); | 257 LayoutTab layoutTab = mTabCache.get(tabId); |
258 if (layoutTab == null) return; | 258 if (layoutTab == null) return; |
259 | 259 |
260 String url = tab.getUrl(); | 260 String url = tab.getUrl(); |
261 boolean isNativePage = url != null && url.startsWith(UrlConstants.CHROME
_NATIVE_SCHEME); | 261 boolean isNativePage = url != null && url.startsWith(UrlConstants.CHROME
_NATIVE_SCHEME); |
262 int themeColor = tab.getThemeColor(); | 262 int themeColor = tab.getThemeColor(); |
263 boolean canUseLiveTexture = | 263 // TODO(xingliu): Remove this override themeColor for Blimp tabs. See cr
bug.com/644774. |
264 tab.getContentViewCore() != null && !tab.isShowingSadTab() && !i
sNativePage; | 264 if (tab.isBlimpTab() && tab.getBlimpContents() != null) { |
| 265 themeColor = tab.getBlimpContents().getThemeColor(); |
| 266 } |
| 267 |
| 268 boolean canUseLiveTexture = tab.isBlimpTab() |
| 269 || tab.getContentViewCore() != null && !tab.isShowingSadTab() &&
!isNativePage; |
| 270 |
265 boolean needsUpdate = layoutTab.initFromHost(tab.getBackgroundColor(), t
ab.shouldStall(), | 271 boolean needsUpdate = layoutTab.initFromHost(tab.getBackgroundColor(), t
ab.shouldStall(), |
266 canUseLiveTexture, themeColor, ColorUtils.getTextBoxColorForTool
barBackground( | 272 canUseLiveTexture, themeColor, ColorUtils.getTextBoxColorForTool
barBackground( |
267 mContext.getResources(), tab, themeColor), | 273 mContext.getResources(), tab, themeColor), |
268 ColorUtils.getTextBoxAlphaForToolbarBackground(tab)); | 274 ColorUtils.getTextBoxAlphaForToolbarBackground(tab)); |
269 if (needsUpdate) requestUpdate(); | 275 if (needsUpdate) requestUpdate(); |
270 | 276 |
271 mHost.requestRender(); | 277 mHost.requestRender(); |
272 } | 278 } |
273 | 279 |
274 @Override | 280 @Override |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 || !FeatureUtilities.isDocumentModeEligible(mHost.getContext
()) | 404 || !FeatureUtilities.isDocumentModeEligible(mHost.getContext
()) |
399 || !DeviceClassManager.enableToolbarSwipe() | 405 || !DeviceClassManager.enableToolbarSwipe() |
400 || (manager != null && manager.getPersistentFullscreenMode()
)) { | 406 || (manager != null && manager.getPersistentFullscreenMode()
)) { |
401 return false; | 407 return false; |
402 } | 408 } |
403 | 409 |
404 return direction == ScrollDirection.LEFT || direction == ScrollDirec
tion.RIGHT; | 410 return direction == ScrollDirection.LEFT || direction == ScrollDirec
tion.RIGHT; |
405 } | 411 } |
406 } | 412 } |
407 } | 413 } |
OLD | NEW |