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