OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.shell; | 5 package org.chromium.chrome.shell; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.content.Intent; | 8 import android.content.Intent; |
9 import android.os.Bundle; | 9 import android.os.Bundle; |
10 import android.text.TextUtils; | 10 import android.text.TextUtils; |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 197 |
198 @Override | 198 @Override |
199 protected void onSaveInstanceState(Bundle outState) { | 199 protected void onSaveInstanceState(Bundle outState) { |
200 // TODO(dtrainor): Save/restore the tab state. | 200 // TODO(dtrainor): Save/restore the tab state. |
201 if (mWindow != null) mWindow.saveInstanceState(outState); | 201 if (mWindow != null) mWindow.saveInstanceState(outState); |
202 } | 202 } |
203 | 203 |
204 @Override | 204 @Override |
205 public boolean onKeyUp(int keyCode, KeyEvent event) { | 205 public boolean onKeyUp(int keyCode, KeyEvent event) { |
206 if (keyCode == KeyEvent.KEYCODE_BACK) { | 206 if (keyCode == KeyEvent.KEYCODE_BACK) { |
| 207 if (mTabManager.isTabSwitcherVisible()) { |
| 208 mTabManager.hideTabSwitcher(); |
| 209 return true; |
| 210 } |
207 ChromeShellTab tab = getActiveTab(); | 211 ChromeShellTab tab = getActiveTab(); |
208 if (tab != null && tab.canGoBack()) { | 212 if (tab != null && tab.canGoBack()) { |
209 tab.goBack(); | 213 tab.goBack(); |
210 return true; | 214 return true; |
211 } | 215 } |
212 } | 216 } |
213 | |
214 return super.onKeyUp(keyCode, event); | 217 return super.onKeyUp(keyCode, event); |
215 } | 218 } |
216 | 219 |
217 @Override | 220 @Override |
218 protected void onNewIntent(Intent intent) { | 221 protected void onNewIntent(Intent intent) { |
219 if (MemoryPressureListener.handleDebugIntent(this, intent.getAction()))
return; | 222 if (MemoryPressureListener.handleDebugIntent(this, intent.getAction()))
return; |
220 | 223 |
221 String url = getUrlFromIntent(intent); | 224 String url = getUrlFromIntent(intent); |
222 if (!TextUtils.isEmpty(url)) { | 225 if (!TextUtils.isEmpty(url)) { |
223 ChromeShellTab tab = getActiveTab(); | 226 ChromeShellTab tab = getActiveTab(); |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 @VisibleForTesting | 428 @VisibleForTesting |
426 public static void setActivityWindowAndroidFactory(ActivityWindowAndroidFact
ory factory) { | 429 public static void setActivityWindowAndroidFactory(ActivityWindowAndroidFact
ory factory) { |
427 sWindowAndroidFactory = factory; | 430 sWindowAndroidFactory = factory; |
428 } | 431 } |
429 | 432 |
430 @VisibleForTesting | 433 @VisibleForTesting |
431 public static void setAppMenuHandlerFactory(AppMenuHandlerFactory factory) { | 434 public static void setAppMenuHandlerFactory(AppMenuHandlerFactory factory) { |
432 sAppMenuHandlerFactory = factory; | 435 sAppMenuHandlerFactory = factory; |
433 } | 436 } |
434 } | 437 } |
OLD | NEW |