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/browser_init.h" | 5 #include "chrome/browser/ui/browser_init.h" |
6 | 6 |
7 #include <algorithm> // For max(). | 7 #include <algorithm> // For max(). |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1100 RecordAppLaunches(profile_, urls_to_open, tabs); | 1100 RecordAppLaunches(profile_, urls_to_open, tabs); |
1101 | 1101 |
1102 if (!urls_to_open.empty()) { | 1102 if (!urls_to_open.empty()) { |
1103 // If urls were specified on the command line, use them. | 1103 // If urls were specified on the command line, use them. |
1104 UrlsToTabs(urls_to_open, &tabs); | 1104 UrlsToTabs(urls_to_open, &tabs); |
1105 } else if (pref.type == SessionStartupPref::URLS && !pref.urls.empty()) { | 1105 } else if (pref.type == SessionStartupPref::URLS && !pref.urls.empty()) { |
1106 // Only use the set of urls specified in preferences if nothing was | 1106 // Only use the set of urls specified in preferences if nothing was |
1107 // specified on the command line. Filter out any urls that are to be | 1107 // specified on the command line. Filter out any urls that are to be |
1108 // restored by virtue of having been previously pinned. | 1108 // restored by virtue of having been previously pinned. |
1109 AddUniqueURLs(pref.urls, &tabs); | 1109 AddUniqueURLs(pref.urls, &tabs); |
1110 } else if (pref.type == SessionStartupPref::DEFAULT) { | 1110 } else if (pref.type == SessionStartupPref::DEFAULT && !tabs.empty()) { |
1111 BrowserInit::LaunchWithProfile::Tab tab; | 1111 // Make sure the home page is opened even if there are pinned tabs. |
1112 tab.is_pinned = false; | 1112 std::vector<GURL> urls; |
1113 tab.url = GURL(chrome::kChromeUINewTabURL); | 1113 AddStartupURLs(&urls); |
1114 tabs.push_back(tab); | 1114 UrlsToTabs(urls, &tabs); |
1115 } else if (pref.type == SessionStartupPref::HOMEPAGE) { | |
1116 // If the user had 'homepage' selected, we should have migrated | |
1117 // them to 'URLS' instead. | |
1118 DLOG(ERROR) << "pref.type == HOMEPAGE"; | |
1119 NOTREACHED(); | |
1120 } | 1115 } |
1121 | 1116 |
1122 if (tabs.empty()) | 1117 if (tabs.empty()) |
1123 return NULL; | 1118 return NULL; |
1124 | 1119 |
1125 Browser* browser = OpenTabsInBrowser(NULL, true, tabs); | 1120 Browser* browser = OpenTabsInBrowser(NULL, true, tabs); |
1126 return browser; | 1121 return browser; |
1127 } | 1122 } |
1128 | 1123 |
1129 void BrowserInit::LaunchWithProfile::AddUniqueURLs( | 1124 void BrowserInit::LaunchWithProfile::AddUniqueURLs( |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1849 | 1844 |
1850 Profile* profile = ProfileManager::GetLastUsedProfile(); | 1845 Profile* profile = ProfileManager::GetLastUsedProfile(); |
1851 if (!profile) { | 1846 if (!profile) { |
1852 // We should only be able to get here if the profile already exists and | 1847 // We should only be able to get here if the profile already exists and |
1853 // has been created. | 1848 // has been created. |
1854 NOTREACHED(); | 1849 NOTREACHED(); |
1855 return; | 1850 return; |
1856 } | 1851 } |
1857 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, Profiles(), NULL, NULL); | 1852 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, Profiles(), NULL, NULL); |
1858 } | 1853 } |
OLD | NEW |