Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: chrome/browser/ui/browser_init.cc

Issue 8093016: Show sync promo at startup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 #include "chrome/browser/sessions/session_service_factory.h" 51 #include "chrome/browser/sessions/session_service_factory.h"
52 #include "chrome/browser/shell_integration.h" 52 #include "chrome/browser/shell_integration.h"
53 #include "chrome/browser/tab_contents/link_infobar_delegate.h" 53 #include "chrome/browser/tab_contents/link_infobar_delegate.h"
54 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" 54 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h"
55 #include "chrome/browser/tabs/pinned_tab_codec.h" 55 #include "chrome/browser/tabs/pinned_tab_codec.h"
56 #include "chrome/browser/tabs/tab_strip_model.h" 56 #include "chrome/browser/tabs/tab_strip_model.h"
57 #include "chrome/browser/ui/browser_list.h" 57 #include "chrome/browser/ui/browser_list.h"
58 #include "chrome/browser/ui/browser_navigator.h" 58 #include "chrome/browser/ui/browser_navigator.h"
59 #include "chrome/browser/ui/browser_window.h" 59 #include "chrome/browser/ui/browser_window.h"
60 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 60 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
61 #include "chrome/browser/ui/webui/sync_promo_ui.h"
61 #include "chrome/common/chrome_constants.h" 62 #include "chrome/common/chrome_constants.h"
62 #include "chrome/common/chrome_paths.h" 63 #include "chrome/common/chrome_paths.h"
63 #include "chrome/common/chrome_result_codes.h" 64 #include "chrome/common/chrome_result_codes.h"
64 #include "chrome/common/chrome_switches.h" 65 #include "chrome/common/chrome_switches.h"
65 #include "chrome/common/extensions/extension_constants.h" 66 #include "chrome/common/extensions/extension_constants.h"
66 #include "chrome/common/pref_names.h" 67 #include "chrome/common/pref_names.h"
67 #include "chrome/common/url_constants.h" 68 #include "chrome/common/url_constants.h"
68 #include "chrome/installer/util/browser_distribution.h" 69 #include "chrome/installer/util/browser_distribution.h"
69 #include "content/browser/browser_thread.h" 70 #include "content/browser/browser_thread.h"
70 #include "content/browser/child_process_security_policy.h" 71 #include "content/browser/child_process_security_policy.h"
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 if (!startup_urls->empty()) 1243 if (!startup_urls->empty())
1243 return; 1244 return;
1244 // If we have urls specified by the first run master preferences use them 1245 // If we have urls specified by the first run master preferences use them
1245 // and nothing else. 1246 // and nothing else.
1246 if (browser_init_) { 1247 if (browser_init_) {
1247 if (!browser_init_->first_run_tabs_.empty()) { 1248 if (!browser_init_->first_run_tabs_.empty()) {
1248 std::vector<GURL>::iterator it = browser_init_->first_run_tabs_.begin(); 1249 std::vector<GURL>::iterator it = browser_init_->first_run_tabs_.begin();
1249 while (it != browser_init_->first_run_tabs_.end()) { 1250 while (it != browser_init_->first_run_tabs_.end()) {
1250 // Replace magic names for the actual urls. 1251 // Replace magic names for the actual urls.
1251 if (it->host() == "new_tab_page") { 1252 if (it->host() == "new_tab_page") {
1252 startup_urls->push_back(GURL(chrome::kChromeUINewTabURL)); 1253 if (SyncPromoUI::ShouldShowSyncPromoAtStartup(profile_,
1254 FirstRun::IsChromeFirstRun())) {
1255 SyncPromoUI::DidShowSyncPromoAtStartup(profile_);
1256 startup_urls->push_back(GURL(chrome::kChromeUISyncPromoURL));
1257 } else {
1258 startup_urls->push_back(GURL(chrome::kChromeUINewTabURL));
1259 }
1253 } else if (it->host() == "welcome_page") { 1260 } else if (it->host() == "welcome_page") {
1254 startup_urls->push_back(GetWelcomePageURL()); 1261 startup_urls->push_back(GetWelcomePageURL());
1255 } else { 1262 } else {
1256 startup_urls->push_back(*it); 1263 startup_urls->push_back(*it);
1257 } 1264 }
1258 ++it; 1265 ++it;
1259 } 1266 }
1260 browser_init_->first_run_tabs_.clear(); 1267 browser_init_->first_run_tabs_.clear();
1261 return; 1268 return;
1262 } 1269 }
1263 } 1270 }
1264 1271
1265 // Otherwise open at least the new tab page (and the welcome page, if this 1272 // Otherwise open at least the new tab page (and the welcome page, if this
1266 // is the first time the browser is being started), or the set of URLs 1273 // is the first time the browser is being started), or the set of URLs
1267 // specified on the command line. 1274 // specified on the command line.
1268 startup_urls->push_back(GURL()); // New tab page. 1275 if (SyncPromoUI::ShouldShowSyncPromoAtStartup(profile_,
1276 FirstRun::IsChromeFirstRun())) {
1277 SyncPromoUI::DidShowSyncPromoAtStartup(profile_);
1278 startup_urls->push_back(GURL(chrome::kChromeUISyncPromoURL));
1279 } else {
1280 startup_urls->push_back(GURL()); // New tab page.
1281 }
1269 PrefService* prefs = g_browser_process->local_state(); 1282 PrefService* prefs = g_browser_process->local_state();
1270 if (prefs->FindPreference(prefs::kShouldShowWelcomePage) && 1283 if (prefs->FindPreference(prefs::kShouldShowWelcomePage) &&
1271 prefs->GetBoolean(prefs::kShouldShowWelcomePage)) { 1284 prefs->GetBoolean(prefs::kShouldShowWelcomePage)) {
1272 // 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.
1273 prefs->ClearPref(prefs::kShouldShowWelcomePage); 1286 prefs->ClearPref(prefs::kShouldShowWelcomePage);
1274 startup_urls->push_back(GetWelcomePageURL()); 1287 startup_urls->push_back(GetWelcomePageURL());
1275 } 1288 }
1276 } 1289 }
1277 1290
1278 void BrowserInit::LaunchWithProfile::CheckDefaultBrowser(Profile* profile) { 1291 void BrowserInit::LaunchWithProfile::CheckDefaultBrowser(Profile* profile) {
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1503 if (!automation->InitializeChannel(channel_id)) 1516 if (!automation->InitializeChannel(channel_id))
1504 return false; 1517 return false;
1505 automation->SetExpectedTabCount(expected_tabs); 1518 automation->SetExpectedTabCount(expected_tabs);
1506 1519
1507 AutomationProviderList* list = g_browser_process->GetAutomationProviderList(); 1520 AutomationProviderList* list = g_browser_process->GetAutomationProviderList();
1508 DCHECK(list); 1521 DCHECK(list);
1509 list->AddProvider(automation); 1522 list->AddProvider(automation);
1510 1523
1511 return true; 1524 return true;
1512 } 1525 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698