| 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; | 5 package org.chromium.chrome.browser; |
| 6 | 6 |
| 7 import android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
| 8 import android.annotation.TargetApi; | 8 import android.annotation.TargetApi; |
| 9 import android.app.Activity; | 9 import android.app.Activity; |
| 10 import android.app.SearchManager; | 10 import android.app.SearchManager; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 import org.chromium.chrome.browser.toolbar.ToolbarManager; | 121 import org.chromium.chrome.browser.toolbar.ToolbarManager; |
| 122 import org.chromium.chrome.browser.util.ColorUtils; | 122 import org.chromium.chrome.browser.util.ColorUtils; |
| 123 import org.chromium.chrome.browser.util.FeatureUtilities; | 123 import org.chromium.chrome.browser.util.FeatureUtilities; |
| 124 import org.chromium.chrome.browser.webapps.AddToHomescreenDialog; | 124 import org.chromium.chrome.browser.webapps.AddToHomescreenDialog; |
| 125 import org.chromium.chrome.browser.widget.ControlContainer; | 125 import org.chromium.chrome.browser.widget.ControlContainer; |
| 126 import org.chromium.content.browser.ContentVideoView; | 126 import org.chromium.content.browser.ContentVideoView; |
| 127 import org.chromium.content.browser.ContentViewCore; | 127 import org.chromium.content.browser.ContentViewCore; |
| 128 import org.chromium.content.common.ContentSwitches; | 128 import org.chromium.content.common.ContentSwitches; |
| 129 import org.chromium.content_public.browser.ContentBitmapCallback; | 129 import org.chromium.content_public.browser.ContentBitmapCallback; |
| 130 import org.chromium.content_public.browser.LoadUrlParams; | 130 import org.chromium.content_public.browser.LoadUrlParams; |
| 131 import org.chromium.content_public.browser.WebContents; |
| 131 import org.chromium.content_public.browser.readback_types.ReadbackResponse; | 132 import org.chromium.content_public.browser.readback_types.ReadbackResponse; |
| 132 import org.chromium.policy.CombinedPolicyProvider.PolicyChangeListener; | 133 import org.chromium.policy.CombinedPolicyProvider.PolicyChangeListener; |
| 133 import org.chromium.printing.PrintManagerDelegateImpl; | 134 import org.chromium.printing.PrintManagerDelegateImpl; |
| 134 import org.chromium.printing.PrintingController; | 135 import org.chromium.printing.PrintingController; |
| 135 import org.chromium.ui.base.ActivityWindowAndroid; | 136 import org.chromium.ui.base.ActivityWindowAndroid; |
| 136 import org.chromium.ui.base.PageTransition; | 137 import org.chromium.ui.base.PageTransition; |
| 137 import org.chromium.ui.base.WindowAndroid; | 138 import org.chromium.ui.base.WindowAndroid; |
| 138 | 139 |
| 139 import java.util.ArrayList; | 140 import java.util.ArrayList; |
| 140 import java.util.List; | 141 import java.util.List; |
| (...skipping 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1569 if (mSetWindowHWA) { | 1570 if (mSetWindowHWA) { |
| 1570 mSetWindowHWA = false; | 1571 mSetWindowHWA = false; |
| 1571 getWindow().setWindowManager( | 1572 getWindow().setWindowManager( |
| 1572 getWindow().getWindowManager(), | 1573 getWindow().getWindowManager(), |
| 1573 getWindow().getAttributes().token, | 1574 getWindow().getAttributes().token, |
| 1574 getComponentName().flattenToString(), | 1575 getComponentName().flattenToString(), |
| 1575 true /* hardwareAccelerated */); | 1576 true /* hardwareAccelerated */); |
| 1576 } | 1577 } |
| 1577 } | 1578 } |
| 1578 | 1579 |
| 1580 @Override |
| 1581 public void onContextMenuClosed(Menu menu) { |
| 1582 final Tab currentTab = getActivityTab(); |
| 1583 if (currentTab == null) return; |
| 1584 WebContents webContents = currentTab.getWebContents(); |
| 1585 if (webContents == null) return; |
| 1586 webContents.onContextMenuClosed(); |
| 1587 } |
| 1588 |
| 1579 private void enableHardwareAcceleration() { | 1589 private void enableHardwareAcceleration() { |
| 1580 // HW acceleration is disabled in the manifest. Enable it only on high-e
nd devices. | 1590 // HW acceleration is disabled in the manifest. Enable it only on high-e
nd devices. |
| 1581 if (!SysUtils.isLowEndDevice()) { | 1591 if (!SysUtils.isLowEndDevice()) { |
| 1582 getWindow().addFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELE
RATED); | 1592 getWindow().addFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELE
RATED); |
| 1583 | 1593 |
| 1584 // When HW acceleration is enabled manually for an activity, child w
indows (e.g. | 1594 // When HW acceleration is enabled manually for an activity, child w
indows (e.g. |
| 1585 // dialogs) don't inherit HW acceleration state. However, when HW ac
celeration is | 1595 // dialogs) don't inherit HW acceleration state. However, when HW ac
celeration is |
| 1586 // enabled in the manifest, child windows do inherit HW acceleration
state. That | 1596 // enabled in the manifest, child windows do inherit HW acceleration
state. That |
| 1587 // looks like a bug, so I filed b/23036374 | 1597 // looks like a bug, so I filed b/23036374 |
| 1588 // | 1598 // |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1599 public static int getThemeId() { | 1609 public static int getThemeId() { |
| 1600 boolean useLowEndTheme = | 1610 boolean useLowEndTheme = |
| 1601 SysUtils.isLowEndDevice() && Build.VERSION.SDK_INT >= Build.VERS
ION_CODES.LOLLIPOP; | 1611 SysUtils.isLowEndDevice() && Build.VERSION.SDK_INT >= Build.VERS
ION_CODES.LOLLIPOP; |
| 1602 return (useLowEndTheme ? R.style.MainTheme_LowEnd : R.style.MainTheme); | 1612 return (useLowEndTheme ? R.style.MainTheme_LowEnd : R.style.MainTheme); |
| 1603 } | 1613 } |
| 1604 | 1614 |
| 1605 private void setLowEndTheme() { | 1615 private void setLowEndTheme() { |
| 1606 if (getThemeId() == R.style.MainTheme_LowEnd) setTheme(R.style.MainTheme
_LowEnd); | 1616 if (getThemeId() == R.style.MainTheme_LowEnd) setTheme(R.style.MainTheme
_LowEnd); |
| 1607 } | 1617 } |
| 1608 } | 1618 } |
| OLD | NEW |