| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "apps/app_restore_service.h" | 10 #include "apps/app_restore_service.h" |
| (...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 return browser; | 838 return browser; |
| 839 } | 839 } |
| 840 | 840 |
| 841 void StartupBrowserCreatorImpl::AddInfoBarsIfNecessary( | 841 void StartupBrowserCreatorImpl::AddInfoBarsIfNecessary( |
| 842 Browser* browser, | 842 Browser* browser, |
| 843 chrome::startup::IsProcessStartup is_process_startup) { | 843 chrome::startup::IsProcessStartup is_process_startup) { |
| 844 if (!browser || !profile_ || browser->tab_strip_model()->count() == 0) | 844 if (!browser || !profile_ || browser->tab_strip_model()->count() == 0) |
| 845 return; | 845 return; |
| 846 | 846 |
| 847 if (HasPendingUncleanExit(browser->profile())) { | 847 if (HasPendingUncleanExit(browser->profile())) { |
| 848 if (!command_line_.HasSwitch(switches::kEnableSessionCrashedBubble) || | 848 // Can't use command_line_ here because command_line_ isn't set to have |
| 849 // correct values when a profile window is opened after the browser starts |
| 850 // up (via profile switcher). See function FindOrCreateNewWindowForProfile. |
| 851 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 852 switches::kEnableSessionCrashedBubble) || |
| 849 !ShowSessionCrashedBubble(browser)) | 853 !ShowSessionCrashedBubble(browser)) |
| 850 SessionCrashedInfoBarDelegate::Create(browser); | 854 SessionCrashedInfoBarDelegate::Create(browser); |
| 851 } | 855 } |
| 852 | 856 |
| 853 // The below info bars are only added to the first profile which is launched. | 857 // The below info bars are only added to the first profile which is launched. |
| 854 // Other profiles might be restoring the browsing sessions asynchronously, | 858 // Other profiles might be restoring the browsing sessions asynchronously, |
| 855 // so we cannot add the info bars to the focused tabs here. | 859 // so we cannot add the info bars to the focused tabs here. |
| 856 if (is_process_startup == chrome::startup::IS_PROCESS_STARTUP && | 860 if (is_process_startup == chrome::startup::IS_PROCESS_STARTUP && |
| 857 !command_line_.HasSwitch(switches::kTestType)) { | 861 !command_line_.HasSwitch(switches::kTestType)) { |
| 858 chrome::ShowBadFlagsPrompt(browser); | 862 chrome::ShowBadFlagsPrompt(browser); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 933 // If the first URL is the NTP, replace it with the sync promo. This | 937 // If the first URL is the NTP, replace it with the sync promo. This |
| 934 // behavior is desired because completing or skipping the sync promo | 938 // behavior is desired because completing or skipping the sync promo |
| 935 // causes a redirect to the NTP. | 939 // causes a redirect to the NTP. |
| 936 if (!startup_urls->empty() && IsNewTabURL(profile_, startup_urls->at(0))) | 940 if (!startup_urls->empty() && IsNewTabURL(profile_, startup_urls->at(0))) |
| 937 startup_urls->at(0) = sync_promo_url; | 941 startup_urls->at(0) = sync_promo_url; |
| 938 else | 942 else |
| 939 startup_urls->insert(startup_urls->begin(), sync_promo_url); | 943 startup_urls->insert(startup_urls->begin(), sync_promo_url); |
| 940 } | 944 } |
| 941 } | 945 } |
| 942 } | 946 } |
| OLD | NEW |