Chromium Code Reviews| 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 1435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1576 if (mSetWindowHWA) { | 1577 if (mSetWindowHWA) { |
| 1577 mSetWindowHWA = false; | 1578 mSetWindowHWA = false; |
| 1578 getWindow().setWindowManager( | 1579 getWindow().setWindowManager( |
| 1579 getWindow().getWindowManager(), | 1580 getWindow().getWindowManager(), |
| 1580 getWindow().getAttributes().token, | 1581 getWindow().getAttributes().token, |
| 1581 getComponentName().flattenToString(), | 1582 getComponentName().flattenToString(), |
| 1582 true /* hardwareAccelerated */); | 1583 true /* hardwareAccelerated */); |
| 1583 } | 1584 } |
| 1584 } | 1585 } |
| 1585 | 1586 |
| 1587 @Override | |
| 1588 public void onContextMenuClosed(Menu menu) { | |
|
no sievers
2015/11/30 21:25:00
I can't find where this is overriden from.
Ted C
2015/11/30 21:30:49
Hmm...it is sad that we have to add this at this h
Changwan Ryu
2015/12/01 05:54:01
This overrides Activity#onContextMenuClosed. Added
Changwan Ryu
2015/12/01 05:54:01
Hmm.. I considered it, but if context menu opens y
| |
| 1589 final Tab currentTab = getActivityTab(); | |
| 1590 if (currentTab == null) return; | |
| 1591 WebContents webContents = currentTab.getWebContents(); | |
| 1592 if (webContents == null) return; | |
| 1593 webContents.onContextMenuClosed(); | |
|
Ted C
2015/11/30 21:30:49
What happens if the web contents was not the thing
Changwan Ryu
2015/12/01 05:54:01
Good point! I've added WebContents#onContextMenuOp
| |
| 1594 } | |
| 1595 | |
| 1586 private void enableHardwareAcceleration() { | 1596 private void enableHardwareAcceleration() { |
| 1587 // HW acceleration is disabled in the manifest. Enable it only on high-e nd devices. | 1597 // HW acceleration is disabled in the manifest. Enable it only on high-e nd devices. |
| 1588 if (!SysUtils.isLowEndDevice()) { | 1598 if (!SysUtils.isLowEndDevice()) { |
| 1589 getWindow().addFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELE RATED); | 1599 getWindow().addFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELE RATED); |
| 1590 | 1600 |
| 1591 // When HW acceleration is enabled manually for an activity, child w indows (e.g. | 1601 // When HW acceleration is enabled manually for an activity, child w indows (e.g. |
| 1592 // dialogs) don't inherit HW acceleration state. However, when HW ac celeration is | 1602 // dialogs) don't inherit HW acceleration state. However, when HW ac celeration is |
| 1593 // enabled in the manifest, child windows do inherit HW acceleration state. That | 1603 // enabled in the manifest, child windows do inherit HW acceleration state. That |
| 1594 // looks like a bug, so I filed b/23036374 | 1604 // looks like a bug, so I filed b/23036374 |
| 1595 // | 1605 // |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 1606 public static int getThemeId() { | 1616 public static int getThemeId() { |
| 1607 boolean useLowEndTheme = | 1617 boolean useLowEndTheme = |
| 1608 SysUtils.isLowEndDevice() && Build.VERSION.SDK_INT >= Build.VERS ION_CODES.LOLLIPOP; | 1618 SysUtils.isLowEndDevice() && Build.VERSION.SDK_INT >= Build.VERS ION_CODES.LOLLIPOP; |
| 1609 return (useLowEndTheme ? R.style.MainTheme_LowEnd : R.style.MainTheme); | 1619 return (useLowEndTheme ? R.style.MainTheme_LowEnd : R.style.MainTheme); |
| 1610 } | 1620 } |
| 1611 | 1621 |
| 1612 private void setLowEndTheme() { | 1622 private void setLowEndTheme() { |
| 1613 if (getThemeId() == R.style.MainTheme_LowEnd) setTheme(R.style.MainTheme _LowEnd); | 1623 if (getThemeId() == R.style.MainTheme_LowEnd) setTheme(R.style.MainTheme _LowEnd); |
| 1614 } | 1624 } |
| 1615 } | 1625 } |
| OLD | NEW |