| 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.TargetApi; | 7 import android.annotation.TargetApi; |
| 8 import android.app.Activity; | 8 import android.app.Activity; |
| 9 import android.app.ActivityManager; | 9 import android.app.ActivityManager; |
| 10 import android.content.Context; | 10 import android.content.Context; |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 if (getFullscreenManager() != null | 506 if (getFullscreenManager() != null |
| 507 && getFullscreenManager().getPersistentFullscreenMod
e()) { | 507 && getFullscreenManager().getPersistentFullscreenMod
e()) { |
| 508 return; | 508 return; |
| 509 } | 509 } |
| 510 toggleOverview(); | 510 toggleOverview(); |
| 511 } | 511 } |
| 512 }; | 512 }; |
| 513 OnClickListener newTabClickHandler = new OnClickListener() { | 513 OnClickListener newTabClickHandler = new OnClickListener() { |
| 514 @Override | 514 @Override |
| 515 public void onClick(View v) { | 515 public void onClick(View v) { |
| 516 getTabModelSelector().getModel(false).commitAllTabClosures()
; |
| 516 // This assumes that the keyboard can not be seen at the sam
e time as the | 517 // This assumes that the keyboard can not be seen at the sam
e time as the |
| 517 // newtab button on the toolbar. | 518 // newtab button on the toolbar. |
| 518 getCurrentTabCreator().launchNTP(); | 519 getCurrentTabCreator().launchNTP(); |
| 519 } | 520 } |
| 520 }; | 521 }; |
| 521 OnClickListener bookmarkClickHandler = new OnClickListener() { | 522 OnClickListener bookmarkClickHandler = new OnClickListener() { |
| 522 @Override | 523 @Override |
| 523 public void onClick(View v) { | 524 public void onClick(View v) { |
| 524 addOrEditBookmark(getActivityTab()); | 525 addOrEditBookmark(getActivityTab()); |
| 525 } | 526 } |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1050 public void terminateIncognitoSession() { | 1051 public void terminateIncognitoSession() { |
| 1051 getTabModelSelector().getModel(true).closeAllTabs(); | 1052 getTabModelSelector().getModel(true).closeAllTabs(); |
| 1052 } | 1053 } |
| 1053 | 1054 |
| 1054 @Override | 1055 @Override |
| 1055 public boolean onMenuOrKeyboardAction(final int id, boolean fromMenu) { | 1056 public boolean onMenuOrKeyboardAction(final int id, boolean fromMenu) { |
| 1056 final Tab currentTab = getActivityTab(); | 1057 final Tab currentTab = getActivityTab(); |
| 1057 if (id == R.id.move_to_other_window_menu_id) { | 1058 if (id == R.id.move_to_other_window_menu_id) { |
| 1058 if (currentTab != null) moveTabToOtherWindow(currentTab); | 1059 if (currentTab != null) moveTabToOtherWindow(currentTab); |
| 1059 } else if (id == R.id.new_tab_menu_id) { | 1060 } else if (id == R.id.new_tab_menu_id) { |
| 1061 getTabModelSelector().getModel(false).commitAllTabClosures(); |
| 1060 RecordUserAction.record("MobileMenuNewTab"); | 1062 RecordUserAction.record("MobileMenuNewTab"); |
| 1061 RecordUserAction.record("MobileNewTabOpened"); | 1063 RecordUserAction.record("MobileNewTabOpened"); |
| 1062 getTabCreator(false).launchUrl(UrlConstants.NTP_URL, TabLaunchType.F
ROM_CHROME_UI); | 1064 getTabCreator(false).launchUrl(UrlConstants.NTP_URL, TabLaunchType.F
ROM_CHROME_UI); |
| 1063 } else if (id == R.id.new_incognito_tab_menu_id) { | 1065 } else if (id == R.id.new_incognito_tab_menu_id) { |
| 1064 if (PrefServiceBridge.getInstance().isIncognitoModeEnabled()) { | 1066 if (PrefServiceBridge.getInstance().isIncognitoModeEnabled()) { |
| 1067 getTabModelSelector().getModel(false).commitAllTabClosures(); |
| 1065 // This action must be recorded before opening the incognito tab
since UMA actions | 1068 // This action must be recorded before opening the incognito tab
since UMA actions |
| 1066 // are dropped when an incognito tab is open. | 1069 // are dropped when an incognito tab is open. |
| 1067 RecordUserAction.record("MobileMenuNewIncognitoTab"); | 1070 RecordUserAction.record("MobileMenuNewIncognitoTab"); |
| 1068 RecordUserAction.record("MobileNewTabOpened"); | 1071 RecordUserAction.record("MobileNewTabOpened"); |
| 1069 getTabCreator(true).launchUrl(UrlConstants.NTP_URL, TabLaunchTyp
e.FROM_CHROME_UI); | 1072 getTabCreator(true).launchUrl(UrlConstants.NTP_URL, TabLaunchTyp
e.FROM_CHROME_UI); |
| 1070 } | 1073 } |
| 1071 } else if (id == R.id.all_bookmarks_menu_id) { | 1074 } else if (id == R.id.all_bookmarks_menu_id) { |
| 1072 if (currentTab != null) { | 1075 if (currentTab != null) { |
| 1073 getCompositorViewHolder().hideKeyboard(new Runnable() { | 1076 getCompositorViewHolder().hideKeyboard(new Runnable() { |
| 1074 @Override | 1077 @Override |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1561 } | 1564 } |
| 1562 // 3. Kill the other activity's task to remove it from Android recen
ts. | 1565 // 3. Kill the other activity's task to remove it from Android recen
ts. |
| 1563 otherActivityTask.finishAndRemoveTask(); | 1566 otherActivityTask.finishAndRemoveTask(); |
| 1564 } | 1567 } |
| 1565 | 1568 |
| 1566 // 4. Ask TabPersistentStore to merge state. | 1569 // 4. Ask TabPersistentStore to merge state. |
| 1567 RecordUserAction.record("Android.MergeState.Live"); | 1570 RecordUserAction.record("Android.MergeState.Live"); |
| 1568 mTabModelSelectorImpl.mergeState(); | 1571 mTabModelSelectorImpl.mergeState(); |
| 1569 } | 1572 } |
| 1570 } | 1573 } |
| OLD | NEW |