Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java |
| index aa4ed4d5627730b5ea879a3e6683882f36156014..4f4665d09c46987c491d5701f166c0bf74724bfc 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java |
| @@ -1427,28 +1427,30 @@ public abstract class ChromeActivity extends AsyncInitializationActivity |
| @Override |
| public final void onBackPressed() { |
| + RecordUserAction.record("SystemBack"); |
| if (mCompositorViewHolder != null) { |
| LayoutManager layoutManager = mCompositorViewHolder.getLayoutManager(); |
| - boolean layoutConsumed = layoutManager != null && layoutManager.onBackPressed(); |
| - if (layoutConsumed || mContextualSearchManager != null |
| - && mContextualSearchManager.onBackPressed()) { |
| - RecordUserAction.record("SystemBack"); |
| - return; |
| - } |
| + if (layoutManager != null && layoutManager.onBackPressed()) return; |
| } |
| - if (!isSelectActionBarShowing() && handleBackPressed()) { |
| + |
| + ContentViewCore contentViewCore = getContentViewCore(); |
| + if (contentViewCore != null && contentViewCore.isSelectActionBarShowing()) { |
| + contentViewCore.clearSelection(); |
| return; |
| } |
| - // This will close the select action bar if it is showing, otherwise close the activity. |
| + |
| + if (mContextualSearchManager != null && mContextualSearchManager.onBackPressed()) return; |
|
gone
2016/06/14 23:30:10
Why'd you pull this logic out? Before, mContextua
amaralp
2016/06/14 23:50:12
I thought that the check wouldn't be necessary and
gone
2016/06/15 00:29:18
Hokay. So after lots and lots of archaeology, we
|
| + |
| + if (handleBackPressed()) return; |
| + |
| super.onBackPressed(); |
| } |
| - private boolean isSelectActionBarShowing() { |
| + |
| + private ContentViewCore getContentViewCore() { |
| Tab tab = getActivityTab(); |
| - if (tab == null) return false; |
| - ContentViewCore contentViewCore = tab.getContentViewCore(); |
| - if (contentViewCore == null) return false; |
| - return contentViewCore.isSelectActionBarShowing(); |
| + if (tab == null) return null; |
| + return tab.getContentViewCore(); |
| } |
| @Override |