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 && !tabs.empty()) { | 1110 } else if (pref.type == SessionStartupPref::DEFAULT) { |
1111 // Make sure the home page is opened even if there are pinned tabs. | 1111 BrowserInit::LaunchWithProfile::Tab tab; |
1112 std::vector<GURL> urls; | 1112 tab.is_pinned = false; |
1113 AddStartupURLs(&urls); | 1113 tab.url = GURL(chrome::kChromeUINewTabURL); |
1114 UrlsToTabs(urls, &tabs); | 1114 tabs.push_back(tab); |
| 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(); |
1115 } | 1120 } |
1116 | 1121 |
1117 if (tabs.empty()) | 1122 if (tabs.empty()) |
1118 return NULL; | 1123 return NULL; |
1119 | 1124 |
1120 Browser* browser = OpenTabsInBrowser(NULL, true, tabs); | 1125 Browser* browser = OpenTabsInBrowser(NULL, true, tabs); |
1121 return browser; | 1126 return browser; |
1122 } | 1127 } |
1123 | 1128 |
1124 void BrowserInit::LaunchWithProfile::AddUniqueURLs( | 1129 void BrowserInit::LaunchWithProfile::AddUniqueURLs( |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1836 | 1841 |
1837 Profile* profile = ProfileManager::GetLastUsedProfile(); | 1842 Profile* profile = ProfileManager::GetLastUsedProfile(); |
1838 if (!profile) { | 1843 if (!profile) { |
1839 // We should only be able to get here if the profile already exists and | 1844 // We should only be able to get here if the profile already exists and |
1840 // has been created. | 1845 // has been created. |
1841 NOTREACHED(); | 1846 NOTREACHED(); |
1842 return; | 1847 return; |
1843 } | 1848 } |
1844 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, Profiles(), NULL, NULL); | 1849 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, Profiles(), NULL, NULL); |
1845 } | 1850 } |
OLD | NEW |