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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 mTabManager.createTab(url, TabLaunchType.FROM_EXTERNAL_APP); | 287 mTabManager.createTab(url, TabLaunchType.FROM_EXTERNAL_APP); |
288 } | 288 } |
289 | 289 |
290 /** | 290 /** |
291 * Closes all current tabs. | 291 * Closes all current tabs. |
292 */ | 292 */ |
293 public void closeAllTabs() { | 293 public void closeAllTabs() { |
294 mTabManager.closeAllTabs(); | 294 mTabManager.closeAllTabs(); |
295 } | 295 } |
296 | 296 |
| 297 @VisibleForTesting |
| 298 public void closeTab() { |
| 299 mTabManager.closeTab(); |
| 300 } |
| 301 |
297 /** | 302 /** |
298 * Override the menu key event to show AppMenu. | 303 * Override the menu key event to show AppMenu. |
299 */ | 304 */ |
300 @Override | 305 @Override |
301 public boolean onKeyDown(int keyCode, KeyEvent event) { | 306 public boolean onKeyDown(int keyCode, KeyEvent event) { |
302 if (keyCode == KeyEvent.KEYCODE_MENU && event.getRepeatCount() == 0) { | 307 if (keyCode == KeyEvent.KEYCODE_MENU && event.getRepeatCount() == 0) { |
303 if (mToolbar != null) mToolbar.hideSuggestions(); | 308 if (mToolbar != null) mToolbar.hideSuggestions(); |
304 mAppMenuHandler.showAppMenu(findViewById(R.id.menu_button), true, fa
lse); | 309 mAppMenuHandler.showAppMenu(findViewById(R.id.menu_button), true, fa
lse); |
305 return true; | 310 return true; |
306 } | 311 } |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 @VisibleForTesting | 438 @VisibleForTesting |
434 public static void setActivityWindowAndroidFactory(ActivityWindowAndroidFact
ory factory) { | 439 public static void setActivityWindowAndroidFactory(ActivityWindowAndroidFact
ory factory) { |
435 sWindowAndroidFactory = factory; | 440 sWindowAndroidFactory = factory; |
436 } | 441 } |
437 | 442 |
438 @VisibleForTesting | 443 @VisibleForTesting |
439 public static void setAppMenuHandlerFactory(AppMenuHandlerFactory factory) { | 444 public static void setAppMenuHandlerFactory(AppMenuHandlerFactory factory) { |
440 sAppMenuHandlerFactory = factory; | 445 sAppMenuHandlerFactory = factory; |
441 } | 446 } |
442 } | 447 } |
OLD | NEW |