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 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1172 RecordAppLaunches(profile_, urls_to_open, tabs); | 1172 RecordAppLaunches(profile_, urls_to_open, tabs); |
1173 | 1173 |
1174 if (!urls_to_open.empty()) { | 1174 if (!urls_to_open.empty()) { |
1175 // If urls were specified on the command line, use them. | 1175 // If urls were specified on the command line, use them. |
1176 UrlsToTabs(urls_to_open, &tabs); | 1176 UrlsToTabs(urls_to_open, &tabs); |
1177 } else if (pref.type == SessionStartupPref::URLS && !pref.urls.empty()) { | 1177 } else if (pref.type == SessionStartupPref::URLS && !pref.urls.empty()) { |
1178 // Only use the set of urls specified in preferences if nothing was | 1178 // Only use the set of urls specified in preferences if nothing was |
1179 // specified on the command line. Filter out any urls that are to be | 1179 // specified on the command line. Filter out any urls that are to be |
1180 // restored by virtue of having been previously pinned. | 1180 // restored by virtue of having been previously pinned. |
1181 AddUniqueURLs(pref.urls, &tabs); | 1181 AddUniqueURLs(pref.urls, &tabs); |
| 1182 } else if (pref.type == SessionStartupPref::HOMEPAGE && !tabs.empty()) { |
| 1183 // Make sure the home page is opened even if there are pinned tabs. |
| 1184 std::vector<GURL> urls; |
| 1185 AddStartupURLs(&urls); |
| 1186 UrlsToTabs(urls, &tabs); |
1182 } else if (pref.type == SessionStartupPref::DEFAULT) { | 1187 } else if (pref.type == SessionStartupPref::DEFAULT) { |
1183 Tab tab; | 1188 Tab tab; |
1184 tab.is_pinned = false; | 1189 tab.is_pinned = false; |
1185 tab.url = GURL(chrome::kChromeUINewTabURL); | 1190 tab.url = GURL(chrome::kChromeUINewTabURL); |
1186 tabs.push_back(tab); | 1191 tabs.push_back(tab); |
1187 } else if (pref.type == SessionStartupPref::HOMEPAGE) { | |
1188 // If the user had 'homepage' selected, we should have migrated them to | |
1189 // 'URLs' instead. | |
1190 DLOG(ERROR) << "pref.type == HOMEPAGE"; | |
1191 NOTREACHED(); | |
1192 } | 1192 } |
1193 | 1193 |
1194 if (tabs.empty()) | 1194 if (tabs.empty()) |
1195 return NULL; | 1195 return NULL; |
1196 | 1196 |
1197 Browser* browser = OpenTabsInBrowser(NULL, true, tabs); | 1197 Browser* browser = OpenTabsInBrowser(NULL, true, tabs); |
1198 return browser; | 1198 return browser; |
1199 } | 1199 } |
1200 | 1200 |
1201 void BrowserInit::LaunchWithProfile::AddUniqueURLs( | 1201 void BrowserInit::LaunchWithProfile::AddUniqueURLs( |
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1925 | 1925 |
1926 Profile* profile = ProfileManager::GetLastUsedProfile(); | 1926 Profile* profile = ProfileManager::GetLastUsedProfile(); |
1927 if (!profile) { | 1927 if (!profile) { |
1928 // We should only be able to get here if the profile already exists and | 1928 // We should only be able to get here if the profile already exists and |
1929 // has been created. | 1929 // has been created. |
1930 NOTREACHED(); | 1930 NOTREACHED(); |
1931 return; | 1931 return; |
1932 } | 1932 } |
1933 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, Profiles(), NULL, NULL); | 1933 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, Profiles(), NULL, NULL); |
1934 } | 1934 } |
OLD | NEW |