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.ActivityManager; | 10 import android.app.ActivityManager; |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 | 423 |
424 ApiCompatibilityUtils.setWindowIndeterminateProgress(getWindow()); | 424 ApiCompatibilityUtils.setWindowIndeterminateProgress(getWindow()); |
425 | 425 |
426 // Check for incognito tabs to handle the case where Chrome was swip
ed away in the | 426 // Check for incognito tabs to handle the case where Chrome was swip
ed away in the |
427 // background. | 427 // background. |
428 int incognitoCount = TabWindowManager.getInstance().getIncognitoTabC
ount(); | 428 int incognitoCount = TabWindowManager.getInstance().getIncognitoTabC
ount(); |
429 if (incognitoCount == 0) IncognitoNotificationManager.dismissIncogni
toNotification(); | 429 if (incognitoCount == 0) IncognitoNotificationManager.dismissIncogni
toNotification(); |
430 | 430 |
431 // LocaleManager can only function after the native library is loade
d. | 431 // LocaleManager can only function after the native library is loade
d. |
432 mLocaleManager = LocaleManager.getInstance(); | 432 mLocaleManager = LocaleManager.getInstance(); |
433 mLocaleManager.showSearchEnginePromoIfNeeded(this); | 433 mLocaleManager.showSearchEnginePromoIfNeeded(this, null); |
434 | 434 |
435 super.finishNativeInitialization(); | 435 super.finishNativeInitialization(); |
436 } finally { | 436 } finally { |
437 TraceEvent.end("ChromeTabbedActivity.finishNativeInitialization"); | 437 TraceEvent.end("ChromeTabbedActivity.finishNativeInitialization"); |
438 } | 438 } |
439 } | 439 } |
440 | 440 |
441 /** | 441 /** |
442 * Determine whether the incognito profile needs to be destroyed as part of
startup. This is | 442 * Determine whether the incognito profile needs to be destroyed as part of
startup. This is |
443 * only needed on L+ when it is possible to swipe away tasks from Android re
cents without | 443 * only needed on L+ when it is possible to swipe away tasks from Android re
cents without |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 toggleOverview(); | 658 toggleOverview(); |
659 } | 659 } |
660 }; | 660 }; |
661 OnClickListener newTabClickHandler = new OnClickListener() { | 661 OnClickListener newTabClickHandler = new OnClickListener() { |
662 @Override | 662 @Override |
663 public void onClick(View v) { | 663 public void onClick(View v) { |
664 getTabModelSelector().getModel(false).commitAllTabClosures()
; | 664 getTabModelSelector().getModel(false).commitAllTabClosures()
; |
665 // This assumes that the keyboard can not be seen at the sam
e time as the | 665 // This assumes that the keyboard can not be seen at the sam
e time as the |
666 // newtab button on the toolbar. | 666 // newtab button on the toolbar. |
667 getCurrentTabCreator().launchNTP(); | 667 getCurrentTabCreator().launchNTP(); |
668 mLocaleManager.showSearchEnginePromoIfNeeded(ChromeTabbedAct
ivity.this); | 668 mLocaleManager.showSearchEnginePromoIfNeeded(ChromeTabbedAct
ivity.this, null); |
669 } | 669 } |
670 }; | 670 }; |
671 OnClickListener bookmarkClickHandler = new OnClickListener() { | 671 OnClickListener bookmarkClickHandler = new OnClickListener() { |
672 @Override | 672 @Override |
673 public void onClick(View v) { | 673 public void onClick(View v) { |
674 addOrEditBookmark(getActivityTab()); | 674 addOrEditBookmark(getActivityTab()); |
675 } | 675 } |
676 }; | 676 }; |
677 | 677 |
678 getToolbarManager().initializeWithNative(mTabModelSelectorImpl, | 678 getToolbarManager().initializeWithNative(mTabModelSelectorImpl, |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 } | 874 } |
875 | 875 |
876 @Override | 876 @Override |
877 public boolean onActivityResultWithNative(int requestCode, int resultCode, I
ntent data) { | 877 public boolean onActivityResultWithNative(int requestCode, int resultCode, I
ntent data) { |
878 if (super.onActivityResultWithNative(requestCode, resultCode, data)) ret
urn true; | 878 if (super.onActivityResultWithNative(requestCode, resultCode, data)) ret
urn true; |
879 | 879 |
880 if (requestCode == FIRST_RUN_EXPERIENCE_RESULT) { | 880 if (requestCode == FIRST_RUN_EXPERIENCE_RESULT) { |
881 mIsOnFirstRun = false; | 881 mIsOnFirstRun = false; |
882 if (resultCode == RESULT_OK) { | 882 if (resultCode == RESULT_OK) { |
883 refreshSignIn(); | 883 refreshSignIn(); |
884 mLocaleManager.showSearchEnginePromoIfNeeded(this); | 884 mLocaleManager.showSearchEnginePromoIfNeeded(this, null); |
885 } else { | 885 } else { |
886 if (data != null && data.getBooleanExtra( | 886 if (data != null && data.getBooleanExtra( |
887 FirstRunActivity.RESULT_CLOSE_APP, false)) { | 887 FirstRunActivity.RESULT_CLOSE_APP, false)) { |
888 getTabModelSelector().closeAllTabs(true); | 888 getTabModelSelector().closeAllTabs(true); |
889 finish(); | 889 finish(); |
890 } else { | 890 } else { |
891 launchFirstRunExperience(); | 891 launchFirstRunExperience(); |
892 } | 892 } |
893 } | 893 } |
894 return true; | 894 return true; |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1383 final Tab currentTab = getActivityTab(); | 1383 final Tab currentTab = getActivityTab(); |
1384 boolean currentTabIsNtp = currentTab != null && NewTabPage.isNTPUrl(curr
entTab.getUrl()); | 1384 boolean currentTabIsNtp = currentTab != null && NewTabPage.isNTPUrl(curr
entTab.getUrl()); |
1385 if (id == R.id.move_to_other_window_menu_id) { | 1385 if (id == R.id.move_to_other_window_menu_id) { |
1386 if (currentTab != null) moveTabToOtherWindow(currentTab); | 1386 if (currentTab != null) moveTabToOtherWindow(currentTab); |
1387 } else if (id == R.id.new_tab_menu_id) { | 1387 } else if (id == R.id.new_tab_menu_id) { |
1388 getTabModelSelector().getModel(false).commitAllTabClosures(); | 1388 getTabModelSelector().getModel(false).commitAllTabClosures(); |
1389 RecordUserAction.record("MobileMenuNewTab"); | 1389 RecordUserAction.record("MobileMenuNewTab"); |
1390 RecordUserAction.record("MobileNewTabOpened"); | 1390 RecordUserAction.record("MobileNewTabOpened"); |
1391 reportNewTabShortcutUsed(false); | 1391 reportNewTabShortcutUsed(false); |
1392 getTabCreator(false).launchUrl(UrlConstants.NTP_URL, TabLaunchType.F
ROM_CHROME_UI); | 1392 getTabCreator(false).launchUrl(UrlConstants.NTP_URL, TabLaunchType.F
ROM_CHROME_UI); |
1393 mLocaleManager.showSearchEnginePromoIfNeeded(this); | 1393 mLocaleManager.showSearchEnginePromoIfNeeded(this, null); |
1394 } else if (id == R.id.new_incognito_tab_menu_id) { | 1394 } else if (id == R.id.new_incognito_tab_menu_id) { |
1395 if (PrefServiceBridge.getInstance().isIncognitoModeEnabled()) { | 1395 if (PrefServiceBridge.getInstance().isIncognitoModeEnabled()) { |
1396 getTabModelSelector().getModel(false).commitAllTabClosures(); | 1396 getTabModelSelector().getModel(false).commitAllTabClosures(); |
1397 // This action must be recorded before opening the incognito tab
since UMA actions | 1397 // This action must be recorded before opening the incognito tab
since UMA actions |
1398 // are dropped when an incognito tab is open. | 1398 // are dropped when an incognito tab is open. |
1399 RecordUserAction.record("MobileMenuNewIncognitoTab"); | 1399 RecordUserAction.record("MobileMenuNewIncognitoTab"); |
1400 RecordUserAction.record("MobileNewTabOpened"); | 1400 RecordUserAction.record("MobileNewTabOpened"); |
1401 reportNewTabShortcutUsed(true); | 1401 reportNewTabShortcutUsed(true); |
1402 getTabCreator(true).launchUrl(UrlConstants.NTP_URL, TabLaunchTyp
e.FROM_CHROME_UI); | 1402 getTabCreator(true).launchUrl(UrlConstants.NTP_URL, TabLaunchTyp
e.FROM_CHROME_UI); |
1403 } | 1403 } |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1989 | 1989 |
1990 ActivityManager manager = (ActivityManager) getSystemService(Context.ACT
IVITY_SERVICE); | 1990 ActivityManager manager = (ActivityManager) getSystemService(Context.ACT
IVITY_SERVICE); |
1991 for (AppTask task : manager.getAppTasks()) { | 1991 for (AppTask task : manager.getAppTasks()) { |
1992 RecentTaskInfo info = DocumentUtils.getTaskInfoFromTask(task); | 1992 RecentTaskInfo info = DocumentUtils.getTaskInfoFromTask(task); |
1993 if (info == null) continue; | 1993 if (info == null) continue; |
1994 if (info.id == sMergedInstanceTaskId) return true; | 1994 if (info.id == sMergedInstanceTaskId) return true; |
1995 } | 1995 } |
1996 return false; | 1996 return false; |
1997 } | 1997 } |
1998 } | 1998 } |
OLD | NEW |