OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" | 5 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 #include "chrome/browser/ui/browser_list.h" | 60 #include "chrome/browser/ui/browser_list.h" |
61 #include "chrome/browser/ui/browser_navigator.h" | 61 #include "chrome/browser/ui/browser_navigator.h" |
62 #include "chrome/browser/ui/browser_navigator_params.h" | 62 #include "chrome/browser/ui/browser_navigator_params.h" |
63 #include "chrome/browser/ui/browser_tabrestore.h" | 63 #include "chrome/browser/ui/browser_tabrestore.h" |
64 #include "chrome/browser/ui/browser_tabstrip.h" | 64 #include "chrome/browser/ui/browser_tabstrip.h" |
65 #include "chrome/browser/ui/browser_window.h" | 65 #include "chrome/browser/ui/browser_window.h" |
66 #include "chrome/browser/ui/chrome_pages.h" | 66 #include "chrome/browser/ui/chrome_pages.h" |
67 #include "chrome/browser/ui/extensions/app_launch_params.h" | 67 #include "chrome/browser/ui/extensions/app_launch_params.h" |
68 #include "chrome/browser/ui/extensions/application_launch.h" | 68 #include "chrome/browser/ui/extensions/application_launch.h" |
69 #include "chrome/browser/ui/session_crashed_bubble.h" | 69 #include "chrome/browser/ui/session_crashed_bubble.h" |
| 70 #include "chrome/browser/ui/startup/automation_infobar_delegate.h" |
70 #include "chrome/browser/ui/startup/bad_flags_prompt.h" | 71 #include "chrome/browser/ui/startup/bad_flags_prompt.h" |
71 #include "chrome/browser/ui/startup/default_browser_prompt.h" | 72 #include "chrome/browser/ui/startup/default_browser_prompt.h" |
72 #include "chrome/browser/ui/startup/google_api_keys_infobar_delegate.h" | 73 #include "chrome/browser/ui/startup/google_api_keys_infobar_delegate.h" |
73 #include "chrome/browser/ui/startup/obsolete_system_infobar_delegate.h" | 74 #include "chrome/browser/ui/startup/obsolete_system_infobar_delegate.h" |
74 #include "chrome/browser/ui/startup/session_crashed_infobar_delegate.h" | 75 #include "chrome/browser/ui/startup/session_crashed_infobar_delegate.h" |
75 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 76 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
76 #include "chrome/browser/ui/startup/startup_features.h" | 77 #include "chrome/browser/ui/startup/startup_features.h" |
77 #include "chrome/browser/ui/tabs/pinned_tab_codec.h" | 78 #include "chrome/browser/ui/tabs/pinned_tab_codec.h" |
78 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 79 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
79 #include "chrome/common/chrome_constants.h" | 80 #include "chrome/common/chrome_constants.h" |
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 Browser* browser, | 795 Browser* browser, |
795 chrome::startup::IsProcessStartup is_process_startup) { | 796 chrome::startup::IsProcessStartup is_process_startup) { |
796 if (!browser || !profile_ || browser->tab_strip_model()->count() == 0) | 797 if (!browser || !profile_ || browser->tab_strip_model()->count() == 0) |
797 return; | 798 return; |
798 | 799 |
799 if (HasPendingUncleanExit(browser->profile()) && | 800 if (HasPendingUncleanExit(browser->profile()) && |
800 !SessionCrashedBubble::Show(browser)) { | 801 !SessionCrashedBubble::Show(browser)) { |
801 SessionCrashedInfoBarDelegate::Create(browser); | 802 SessionCrashedInfoBarDelegate::Create(browser); |
802 } | 803 } |
803 | 804 |
| 805 if (command_line_.HasSwitch(switches::kEnableAutomation)) |
| 806 AutomationInfoBarDelegate::Create(); |
| 807 |
804 // The below info bars are only added to the first profile which is launched. | 808 // The below info bars are only added to the first profile which is launched. |
805 // Other profiles might be restoring the browsing sessions asynchronously, | 809 // Other profiles might be restoring the browsing sessions asynchronously, |
806 // so we cannot add the info bars to the focused tabs here. | 810 // so we cannot add the info bars to the focused tabs here. |
| 811 // |
| 812 // These info bars are not shown when the browser is being controlled by |
| 813 // automated tests, so that they don't interfere with tests that assume no |
| 814 // info bars. |
807 if (is_process_startup == chrome::startup::IS_PROCESS_STARTUP && | 815 if (is_process_startup == chrome::startup::IS_PROCESS_STARTUP && |
808 !command_line_.HasSwitch(switches::kTestType)) { | 816 !command_line_.HasSwitch(switches::kTestType) && |
| 817 !command_line_.HasSwitch(switches::kEnableAutomation)) { |
809 chrome::ShowBadFlagsPrompt(browser); | 818 chrome::ShowBadFlagsPrompt(browser); |
810 GoogleApiKeysInfoBarDelegate::Create(InfoBarService::FromWebContents( | 819 GoogleApiKeysInfoBarDelegate::Create(InfoBarService::FromWebContents( |
811 browser->tab_strip_model()->GetActiveWebContents())); | 820 browser->tab_strip_model()->GetActiveWebContents())); |
812 ObsoleteSystemInfoBarDelegate::Create(InfoBarService::FromWebContents( | 821 ObsoleteSystemInfoBarDelegate::Create(InfoBarService::FromWebContents( |
813 browser->tab_strip_model()->GetActiveWebContents())); | 822 browser->tab_strip_model()->GetActiveWebContents())); |
814 | 823 |
815 #if !defined(OS_CHROMEOS) | 824 #if !defined(OS_CHROMEOS) |
816 if (!command_line_.HasSwitch(switches::kNoDefaultBrowserCheck)) { | 825 if (!command_line_.HasSwitch(switches::kNoDefaultBrowserCheck)) { |
817 // Generally, the default browser prompt should not be shown on first | 826 // Generally, the default browser prompt should not be shown on first |
818 // run. However, when the set-as-default dialog has been suppressed, we | 827 // run. However, when the set-as-default dialog has been suppressed, we |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1223 #if defined(OS_WIN) | 1232 #if defined(OS_WIN) |
1224 TriggeredProfileResetter* triggered_profile_resetter = | 1233 TriggeredProfileResetter* triggered_profile_resetter = |
1225 TriggeredProfileResetterFactory::GetForBrowserContext(profile_); | 1234 TriggeredProfileResetterFactory::GetForBrowserContext(profile_); |
1226 // TriggeredProfileResetter instance will be nullptr for incognito profiles. | 1235 // TriggeredProfileResetter instance will be nullptr for incognito profiles. |
1227 if (triggered_profile_resetter) { | 1236 if (triggered_profile_resetter) { |
1228 has_reset_trigger = triggered_profile_resetter->HasResetTrigger(); | 1237 has_reset_trigger = triggered_profile_resetter->HasResetTrigger(); |
1229 } | 1238 } |
1230 #endif // defined(OS_WIN) | 1239 #endif // defined(OS_WIN) |
1231 return has_reset_trigger; | 1240 return has_reset_trigger; |
1232 } | 1241 } |
OLD | NEW |