Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(504)

Side by Side Diff: chrome/browser/ui/startup/startup_browser_creator_impl.cc

Issue 2564973002: Add an infobar if a session is being controlled by an automated test. (Closed)
Patch Set: rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 #include "chrome/browser/ui/browser_list.h" 59 #include "chrome/browser/ui/browser_list.h"
60 #include "chrome/browser/ui/browser_navigator.h" 60 #include "chrome/browser/ui/browser_navigator.h"
61 #include "chrome/browser/ui/browser_navigator_params.h" 61 #include "chrome/browser/ui/browser_navigator_params.h"
62 #include "chrome/browser/ui/browser_tabrestore.h" 62 #include "chrome/browser/ui/browser_tabrestore.h"
63 #include "chrome/browser/ui/browser_tabstrip.h" 63 #include "chrome/browser/ui/browser_tabstrip.h"
64 #include "chrome/browser/ui/browser_window.h" 64 #include "chrome/browser/ui/browser_window.h"
65 #include "chrome/browser/ui/chrome_pages.h" 65 #include "chrome/browser/ui/chrome_pages.h"
66 #include "chrome/browser/ui/extensions/app_launch_params.h" 66 #include "chrome/browser/ui/extensions/app_launch_params.h"
67 #include "chrome/browser/ui/extensions/application_launch.h" 67 #include "chrome/browser/ui/extensions/application_launch.h"
68 #include "chrome/browser/ui/session_crashed_bubble.h" 68 #include "chrome/browser/ui/session_crashed_bubble.h"
69 #include "chrome/browser/ui/startup/automation_infobar_delegate.h"
69 #include "chrome/browser/ui/startup/bad_flags_prompt.h" 70 #include "chrome/browser/ui/startup/bad_flags_prompt.h"
70 #include "chrome/browser/ui/startup/default_browser_prompt.h" 71 #include "chrome/browser/ui/startup/default_browser_prompt.h"
71 #include "chrome/browser/ui/startup/google_api_keys_infobar_delegate.h" 72 #include "chrome/browser/ui/startup/google_api_keys_infobar_delegate.h"
72 #include "chrome/browser/ui/startup/obsolete_system_infobar_delegate.h" 73 #include "chrome/browser/ui/startup/obsolete_system_infobar_delegate.h"
73 #include "chrome/browser/ui/startup/startup_browser_creator.h" 74 #include "chrome/browser/ui/startup/startup_browser_creator.h"
74 #include "chrome/browser/ui/startup/startup_features.h" 75 #include "chrome/browser/ui/startup/startup_features.h"
75 #include "chrome/browser/ui/tabs/pinned_tab_codec.h" 76 #include "chrome/browser/ui/tabs/pinned_tab_codec.h"
76 #include "chrome/browser/ui/tabs/tab_strip_model.h" 77 #include "chrome/browser/ui/tabs/tab_strip_model.h"
77 #include "chrome/common/chrome_constants.h" 78 #include "chrome/common/chrome_constants.h"
78 #include "chrome/common/chrome_paths.h" 79 #include "chrome/common/chrome_paths.h"
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 if (!browser || !profile_ || browser->tab_strip_model()->count() == 0) 810 if (!browser || !profile_ || browser->tab_strip_model()->count() == 0)
810 return; 811 return;
811 812
812 if (HasPendingUncleanExit(browser->profile()) && 813 if (HasPendingUncleanExit(browser->profile()) &&
813 !SessionCrashedBubble::Show(browser)) { 814 !SessionCrashedBubble::Show(browser)) {
814 #if defined(OS_MACOSX) && !BUILDFLAG(MAC_VIEWS_BROWSER) 815 #if defined(OS_MACOSX) && !BUILDFLAG(MAC_VIEWS_BROWSER)
815 SessionCrashedInfoBarDelegate::Create(browser); 816 SessionCrashedInfoBarDelegate::Create(browser);
816 #endif 817 #endif
817 } 818 }
818 819
820 if (command_line_.HasSwitch(switches::kEnableAutomation))
821 AutomationInfoBarDelegate::Create();
822
819 // The below info bars are only added to the first profile which is launched. 823 // The below info bars are only added to the first profile which is launched.
820 // Other profiles might be restoring the browsing sessions asynchronously, 824 // Other profiles might be restoring the browsing sessions asynchronously,
821 // so we cannot add the info bars to the focused tabs here. 825 // so we cannot add the info bars to the focused tabs here.
826 //
827 // These info bars are not shown when the browser is being controlled by
828 // automated tests, so that they don't interfere with tests that assume no
829 // info bars.
822 if (is_process_startup == chrome::startup::IS_PROCESS_STARTUP && 830 if (is_process_startup == chrome::startup::IS_PROCESS_STARTUP &&
823 !command_line_.HasSwitch(switches::kTestType)) { 831 !command_line_.HasSwitch(switches::kTestType) &&
832 !command_line_.HasSwitch(switches::kEnableAutomation)) {
824 chrome::ShowBadFlagsPrompt(browser); 833 chrome::ShowBadFlagsPrompt(browser);
825 GoogleApiKeysInfoBarDelegate::Create(InfoBarService::FromWebContents( 834 GoogleApiKeysInfoBarDelegate::Create(InfoBarService::FromWebContents(
826 browser->tab_strip_model()->GetActiveWebContents())); 835 browser->tab_strip_model()->GetActiveWebContents()));
827 ObsoleteSystemInfoBarDelegate::Create(InfoBarService::FromWebContents( 836 ObsoleteSystemInfoBarDelegate::Create(InfoBarService::FromWebContents(
828 browser->tab_strip_model()->GetActiveWebContents())); 837 browser->tab_strip_model()->GetActiveWebContents()));
829 838
830 #if !defined(OS_CHROMEOS) 839 #if !defined(OS_CHROMEOS)
831 if (!command_line_.HasSwitch(switches::kNoDefaultBrowserCheck)) { 840 if (!command_line_.HasSwitch(switches::kNoDefaultBrowserCheck)) {
832 // Generally, the default browser prompt should not be shown on first 841 // Generally, the default browser prompt should not be shown on first
833 // run. However, when the set-as-default dialog has been suppressed, we 842 // run. However, when the set-as-default dialog has been suppressed, we
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
1234 #if defined(OS_WIN) 1243 #if defined(OS_WIN)
1235 TriggeredProfileResetter* triggered_profile_resetter = 1244 TriggeredProfileResetter* triggered_profile_resetter =
1236 TriggeredProfileResetterFactory::GetForBrowserContext(profile_); 1245 TriggeredProfileResetterFactory::GetForBrowserContext(profile_);
1237 // TriggeredProfileResetter instance will be nullptr for incognito profiles. 1246 // TriggeredProfileResetter instance will be nullptr for incognito profiles.
1238 if (triggered_profile_resetter) { 1247 if (triggered_profile_resetter) {
1239 has_reset_trigger = triggered_profile_resetter->HasResetTrigger(); 1248 has_reset_trigger = triggered_profile_resetter->HasResetTrigger();
1240 } 1249 }
1241 #endif // defined(OS_WIN) 1250 #endif // defined(OS_WIN)
1242 return has_reset_trigger; 1251 return has_reset_trigger;
1243 } 1252 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/startup/automation_infobar_delegate.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698