diff options
author | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-22 17:42:49 +0000 |
---|---|---|
committer | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-22 17:42:49 +0000 |
commit | e5ee0f700f5059047fbb0290c117daae25c88fb7 (patch) | |
tree | 8cd93b7e8f1ae7890a760a944517bbc6fb4a8ab2 /chrome/browser/ui/browser_init.cc | |
parent | 20e4e24e9e739ad01e9b096582078cc2a53d65ff (diff) | |
download | chromium_src-e5ee0f700f5059047fbb0290c117daae25c88fb7.zip chromium_src-e5ee0f700f5059047fbb0290c117daae25c88fb7.tar.gz chromium_src-e5ee0f700f5059047fbb0290c117daae25c88fb7.tar.bz2 |
Show startup infobars when restoring session.
At the moment, startup infobars (such as the bar which warns about
--no-sandbox) doesn't show at startup if the user has their preferences
set to restore the previous session. This is because the
RestoreSessionSynchronously code path never hits the logic to show them.
BUG=none
TEST=Set preferences to restore previous session at startup. Close and restart Chrome with --no-sandbox. Verify that the warning infobar appears.
Review URL: http://codereview.chromium.org/6532062
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75602 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/browser_init.cc')
-rw-r--r-- | chrome/browser/ui/browser_init.cc | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc index 30cc3af..56d0def 100644 --- a/chrome/browser/ui/browser_init.cc +++ b/chrome/browser/ui/browser_init.cc @@ -843,7 +843,8 @@ void BrowserInit::LaunchWithProfile::ProcessLaunchURLs( else if (!command_line_.HasSwitch(switches::kOpenInNewWindow)) browser = BrowserList::GetLastActiveWithProfile(profile_); - OpenURLsInBrowser(browser, process_startup, adjust_urls); + browser = OpenURLsInBrowser(browser, process_startup, adjust_urls); + AddInfoBarsIfNecessary(browser); } bool BrowserInit::LaunchWithProfile::ProcessStartupURLs( @@ -868,7 +869,9 @@ bool BrowserInit::LaunchWithProfile::ProcessStartupURLs( // infobar. return false; } - SessionRestore::RestoreSessionSynchronously(profile_, urls_to_open); + Browser* browser = + SessionRestore::RestoreSessionSynchronously(profile_, urls_to_open); + AddInfoBarsIfNecessary(browser); return true; } @@ -888,7 +891,8 @@ bool BrowserInit::LaunchWithProfile::ProcessStartupURLs( if (tabs.empty()) return false; - OpenTabsInBrowser(NULL, true, tabs); + Browser* browser = OpenTabsInBrowser(NULL, true, tabs); + AddInfoBarsIfNecessary(browser); return true; } @@ -953,11 +957,6 @@ Browser* BrowserInit::LaunchWithProfile::OpenTabsInBrowser( params.extension_app_id = tabs[i].app_id; browser::Navigate(¶ms); - if (profile_ && first_tab && process_startup) { - AddCrashedInfoBarIfNecessary(params.target_contents->tab_contents()); - AddBadFlagsInfoBarIfNecessary(params.target_contents->tab_contents()); - } - first_tab = false; } browser->window()->Show(); @@ -968,6 +967,15 @@ Browser* BrowserInit::LaunchWithProfile::OpenTabsInBrowser( return browser; } +void BrowserInit::LaunchWithProfile::AddInfoBarsIfNecessary(Browser* browser) { + if (!browser || !profile_ || browser->tab_count() == 0) + return; + + TabContents* tab_contents = browser->GetSelectedTabContents(); + AddCrashedInfoBarIfNecessary(tab_contents); + AddBadFlagsInfoBarIfNecessary(tab_contents); +} + void BrowserInit::LaunchWithProfile::AddCrashedInfoBarIfNecessary( TabContents* tab) { // Assume that if the user is launching incognito they were previously |