OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/environment.h" | 10 #include "base/environment.h" |
(...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1281 startup_urls->push_back(GURL()); // New tab page. | 1281 startup_urls->push_back(GURL()); // New tab page. |
1282 PrefService* prefs = g_browser_process->local_state(); | 1282 PrefService* prefs = g_browser_process->local_state(); |
1283 if (prefs->FindPreference(prefs::kShouldShowWelcomePage) && | 1283 if (prefs->FindPreference(prefs::kShouldShowWelcomePage) && |
1284 prefs->GetBoolean(prefs::kShouldShowWelcomePage)) { | 1284 prefs->GetBoolean(prefs::kShouldShowWelcomePage)) { |
1285 // Reset the preference so we don't show the welcome page next time. | 1285 // Reset the preference so we don't show the welcome page next time. |
1286 prefs->ClearPref(prefs::kShouldShowWelcomePage); | 1286 prefs->ClearPref(prefs::kShouldShowWelcomePage); |
1287 startup_urls->push_back(GetWelcomePageURL()); | 1287 startup_urls->push_back(GetWelcomePageURL()); |
1288 } | 1288 } |
1289 } | 1289 } |
1290 | 1290 |
1291 // If the sync promo page is going to be displayed then replace the first | 1291 // If the sync promo page is going to be displayed then insert it at the front |
1292 // startup URL with the sync promo page. | 1292 // of the list. |
1293 if (SyncPromoUI::ShouldShowSyncPromoAtStartup(profile_, is_first_run_)) { | 1293 if (SyncPromoUI::ShouldShowSyncPromoAtStartup(profile_, is_first_run_)) { |
1294 SyncPromoUI::DidShowSyncPromoAtStartup(profile_); | 1294 SyncPromoUI::DidShowSyncPromoAtStartup(profile_); |
1295 (*startup_urls)[0] = SyncPromoUI::GetSyncPromoURL((*startup_urls)[0], true); | 1295 GURL old_url = (*startup_urls)[0]; |
| 1296 (*startup_urls)[0] = |
| 1297 SyncPromoUI::GetSyncPromoURL(GURL(chrome::kChromeUINewTabURL), true); |
| 1298 |
| 1299 // An empty URL means to go to the home page. |
| 1300 if (old_url.is_empty() && |
| 1301 profile_->GetHomePage() == GURL(chrome::kChromeUINewTabURL)) { |
| 1302 old_url = GURL(chrome::kChromeUINewTabURL); |
| 1303 } |
| 1304 |
| 1305 // If the old URL is not the NTP then insert it right after the sync promo. |
| 1306 if (old_url != GURL(chrome::kChromeUINewTabURL)) |
| 1307 startup_urls->insert(startup_urls->begin() + 1, old_url); |
| 1308 |
| 1309 // If we have more than two startup tabs then skip the welcome page. |
| 1310 if (startup_urls->size() > 2) { |
| 1311 std::vector<GURL>::iterator it = std::find( |
| 1312 startup_urls->begin(), startup_urls->end(), GetWelcomePageURL()); |
| 1313 if (it != startup_urls->end()) |
| 1314 startup_urls->erase(it); |
| 1315 } |
1296 } | 1316 } |
1297 } | 1317 } |
1298 | 1318 |
1299 void BrowserInit::LaunchWithProfile::CheckDefaultBrowser(Profile* profile) { | 1319 void BrowserInit::LaunchWithProfile::CheckDefaultBrowser(Profile* profile) { |
1300 // We do not check if we are the default browser if: | 1320 // We do not check if we are the default browser if: |
1301 // - the user said "don't ask me again" on the infobar earlier. | 1321 // - the user said "don't ask me again" on the infobar earlier. |
1302 // - this is the first launch after the first run flow. | 1322 // - this is the first launch after the first run flow. |
1303 // - There is a policy in control of this setting. | 1323 // - There is a policy in control of this setting. |
1304 if (!profile->GetPrefs()->GetBoolean(prefs::kCheckDefaultBrowser) || | 1324 if (!profile->GetPrefs()->GetBoolean(prefs::kCheckDefaultBrowser) || |
1305 is_first_run_) { | 1325 is_first_run_) { |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1527 if (!automation->InitializeChannel(channel_id)) | 1547 if (!automation->InitializeChannel(channel_id)) |
1528 return false; | 1548 return false; |
1529 automation->SetExpectedTabCount(expected_tabs); | 1549 automation->SetExpectedTabCount(expected_tabs); |
1530 | 1550 |
1531 AutomationProviderList* list = g_browser_process->GetAutomationProviderList(); | 1551 AutomationProviderList* list = g_browser_process->GetAutomationProviderList(); |
1532 DCHECK(list); | 1552 DCHECK(list); |
1533 list->AddProvider(automation); | 1553 list->AddProvider(automation); |
1534 | 1554 |
1535 return true; | 1555 return true; |
1536 } | 1556 } |
OLD | NEW |