diff options
-rw-r--r-- | chrome/browser/app_controller_mac.mm | 5 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/login_utils.cc | 6 | ||||
-rw-r--r-- | chrome/browser/profiles/profile_manager.cc | 12 | ||||
-rw-r--r-- | chrome/browser/ui/browser_browsertest.cc | 9 | ||||
-rw-r--r-- | chrome/browser/ui/browser_init.cc | 48 | ||||
-rw-r--r-- | chrome/browser/ui/browser_init.h | 30 | ||||
-rw-r--r-- | chrome/browser/ui/browser_init_browsertest.cc | 29 | ||||
-rw-r--r-- | chrome/browser/ui/webui/sync_promo_ui.cc | 41 | ||||
-rw-r--r-- | chrome/browser/ui/webui/sync_promo_ui.h | 9 | ||||
-rw-r--r-- | chrome/common/pref_names.cc | 3 | ||||
-rw-r--r-- | chrome/common/pref_names.h | 1 |
11 files changed, 159 insertions, 34 deletions
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm index 4acf0c6..0a8eac7 100644 --- a/chrome/browser/app_controller_mac.mm +++ b/chrome/browser/app_controller_mac.mm @@ -19,6 +19,7 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_shutdown.h" #include "chrome/browser/command_updater.h" +#include "chrome/browser/first_run/first_run.h" #include "chrome/browser/instant/instant_confirm_dialog.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/printing/cloud_print/virtual_driver_install_helper.h" @@ -1066,7 +1067,9 @@ const AEEventClass kAECloudPrintUninstallClass = 'GCPu'; } CommandLine dummy(CommandLine::NO_PROGRAM); - BrowserInit::LaunchWithProfile launch(FilePath(), dummy); + BrowserInit::IsFirstRun first_run = FirstRun::IsChromeFirstRun() ? + BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN; + BrowserInit::LaunchWithProfile launch(FilePath(), dummy, first_run); launch.OpenURLsInBrowser(browser, false, urls); } diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc index 7dab1eb..c1a383b 100644 --- a/chrome/browser/chromeos/login/login_utils.cc +++ b/chrome/browser/chromeos/login/login_utils.cc @@ -38,6 +38,7 @@ #include "chrome/browser/chromeos/login/screen_locker.h" #include "chrome/browser/chromeos/login/user_manager.h" #include "chrome/browser/extensions/extension_service.h" +#include "chrome/browser/first_run/first_run.h" #include "chrome/browser/net/chrome_url_request_context.h" #include "chrome/browser/net/gaia/gaia_oauth_consumer.h" #include "chrome/browser/net/gaia/gaia_oauth_fetcher.h" @@ -1183,10 +1184,13 @@ void LoginUtils::DoBrowserLaunch(Profile* profile, VLOG(1) << "Launching browser..."; BrowserInit browser_init; int return_code; + BrowserInit::IsFirstRun first_run = FirstRun::IsChromeFirstRun() ? + BrowserInit::IS_FIRST_RUN: BrowserInit::IS_NOT_FIRST_RUN; browser_init.LaunchBrowser(*CommandLine::ForCurrentProcess(), profile, FilePath(), - true, + BrowserInit::IS_PROCESS_STARTUP, + first_run, &return_code); // Mark login host for deletion after browser starts. This diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc index 3f966e3..d38777a 100644 --- a/chrome/browser/profiles/profile_manager.cc +++ b/chrome/browser/profiles/profile_manager.cc @@ -19,7 +19,9 @@ #include "chrome/browser/profiles/profile_info_cache.h" #include "chrome/browser/sessions/session_service_factory.h" #include "chrome/browser/sync/profile_sync_service.h" +#include "chrome/browser/ui/browser_init.h" #include "chrome/browser/ui/browser_window.h" +#include "chrome/browser/ui/webui/sync_promo_ui.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_switches.h" @@ -65,10 +67,12 @@ class NewProfileLauncher : public ProfileManagerObserver { virtual void OnProfileCreated(Profile* profile, Status status) { if (status == STATUS_INITIALIZED) { DCHECK(profile); - Browser* browser = Browser::Create(profile); - browser->AddSelectedTabWithURL(GURL(chrome::kChromeUINewTabURL), - PageTransition::LINK); - browser->window()->Show(); + CommandLine command_line(CommandLine::NO_PROGRAM); + int return_code; + BrowserInit browser_init; + browser_init.LaunchBrowser( + command_line, profile, FilePath(), BrowserInit::IS_PROCESS_STARTUP, + BrowserInit::IS_FIRST_RUN, &return_code); } } diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc index 7cf1054..10ebfc0 100644 --- a/chrome/browser/ui/browser_browsertest.cc +++ b/chrome/browser/ui/browser_browsertest.cc @@ -16,6 +16,7 @@ #include "chrome/browser/extensions/extension_browsertest.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_tab_helper.h" +#include "chrome/browser/first_run/first_run.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/tabs/pinned_tab_codec.h" #include "chrome/browser/tabs/tab_strip_model.h" @@ -731,7 +732,9 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, AppIdSwitch) { CommandLine command_line(CommandLine::NO_PROGRAM); command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); - BrowserInit::LaunchWithProfile launch(FilePath(), command_line); + BrowserInit::IsFirstRun first_run = FirstRun::IsChromeFirstRun() ? + BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN; + BrowserInit::LaunchWithProfile launch(FilePath(), command_line, first_run); ASSERT_TRUE(launch.OpenApplicationWindow(browser()->profile())); // Check that the new browser has an app name. @@ -936,7 +939,9 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, RestorePinnedTabs) { // Simulate launching again. CommandLine dummy(CommandLine::NO_PROGRAM); - BrowserInit::LaunchWithProfile launch(FilePath(), dummy); + BrowserInit::IsFirstRun first_run = FirstRun::IsChromeFirstRun() ? + BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN; + BrowserInit::LaunchWithProfile launch(FilePath(), dummy, first_run); launch.profile_ = browser()->profile(); launch.ProcessStartupURLs(std::vector<GURL>()); diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc index 121a546..6835301 100644 --- a/chrome/browser/ui/browser_init.cc +++ b/chrome/browser/ui/browser_init.cc @@ -58,6 +58,7 @@ #include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/webui/sync_promo_ui.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_result_codes.h" @@ -561,9 +562,10 @@ bool BrowserInit::InProcessStartup() { bool BrowserInit::LaunchBrowser(const CommandLine& command_line, Profile* profile, const FilePath& cur_dir, - bool process_startup, + IsProcessStartup process_startup, + IsFirstRun is_first_run, int* return_code) { - in_startup = process_startup; + in_startup = process_startup == IS_PROCESS_STARTUP; DCHECK(profile); // Continue with the incognito profile from here on if Incognito mode @@ -575,10 +577,10 @@ bool BrowserInit::LaunchBrowser(const CommandLine& command_line, << "browser session."; } - BrowserInit::LaunchWithProfile lwp(cur_dir, command_line, this); + BrowserInit::LaunchWithProfile lwp(cur_dir, command_line, this, is_first_run); std::vector<GURL> urls_to_launch = BrowserInit::GetURLsFromCommandLine( command_line, cur_dir, profile); - bool launched = lwp.Launch(profile, urls_to_launch, process_startup); + bool launched = lwp.Launch(profile, urls_to_launch, in_startup); in_startup = false; if (!launched) { @@ -645,21 +647,25 @@ BrowserInit::LaunchWithProfile::Tab::~Tab() {} BrowserInit::LaunchWithProfile::LaunchWithProfile( const FilePath& cur_dir, - const CommandLine& command_line) + const CommandLine& command_line, + IsFirstRun is_first_run) : cur_dir_(cur_dir), command_line_(command_line), profile_(NULL), - browser_init_(NULL) { + browser_init_(NULL), + is_first_run_(is_first_run == IS_FIRST_RUN) { } BrowserInit::LaunchWithProfile::LaunchWithProfile( const FilePath& cur_dir, const CommandLine& command_line, - BrowserInit* browser_init) + BrowserInit* browser_init, + IsFirstRun is_first_run) : cur_dir_(cur_dir), command_line_(command_line), profile_(NULL), - browser_init_(browser_init) { + browser_init_(browser_init), + is_first_run_(is_first_run == IS_FIRST_RUN) { } BrowserInit::LaunchWithProfile::~LaunchWithProfile() { @@ -1246,6 +1252,7 @@ void BrowserInit::LaunchWithProfile::AddStartupURLs( // and nothing else. if (!startup_urls->empty()) return; + // If we have urls specified by the first run master preferences use them // and nothing else. if (browser_init_) { @@ -1254,7 +1261,13 @@ void BrowserInit::LaunchWithProfile::AddStartupURLs( while (it != browser_init_->first_run_tabs_.end()) { // Replace magic names for the actual urls. if (it->host() == "new_tab_page") { - startup_urls->push_back(GURL(chrome::kChromeUINewTabURL)); + if (SyncPromoUI::ShouldShowSyncPromoAtStartup(profile_, + is_first_run_)) { + SyncPromoUI::DidShowSyncPromoAtStartup(profile_); + startup_urls->push_back(GURL(chrome::kChromeUISyncPromoURL)); + } else { + startup_urls->push_back(GURL(chrome::kChromeUINewTabURL)); + } } else if (it->host() == "welcome_page") { startup_urls->push_back(GetWelcomePageURL()); } else { @@ -1270,7 +1283,12 @@ void BrowserInit::LaunchWithProfile::AddStartupURLs( // Otherwise open at least the new tab page (and the welcome page, if this // is the first time the browser is being started), or the set of URLs // specified on the command line. - startup_urls->push_back(GURL()); // New tab page. + if (SyncPromoUI::ShouldShowSyncPromoAtStartup(profile_, is_first_run_)) { + SyncPromoUI::DidShowSyncPromoAtStartup(profile_); + startup_urls->push_back(GURL(chrome::kChromeUISyncPromoURL)); + } else { + startup_urls->push_back(GURL()); // New tab page. + } PrefService* prefs = g_browser_process->local_state(); if (prefs->FindPreference(prefs::kShouldShowWelcomePage) && prefs->GetBoolean(prefs::kShouldShowWelcomePage)) { @@ -1286,7 +1304,7 @@ void BrowserInit::LaunchWithProfile::CheckDefaultBrowser(Profile* profile) { // - this is the first launch after the first run flow. // - There is a policy in control of this setting. if (!profile->GetPrefs()->GetBoolean(prefs::kCheckDefaultBrowser) || - FirstRun::IsChromeFirstRun()) { + is_first_run_) { return; } if (g_browser_process->local_state()->IsManagedPreference( @@ -1492,8 +1510,12 @@ bool BrowserInit::ProcessCmdLineImpl(const CommandLine& command_line, // If we don't want to launch a new browser window or tab (in the case // of an automation request), we are done here. if (!silent_launch) { - return browser_init->LaunchBrowser( - command_line, profile, cur_dir, process_startup, return_code); + IsProcessStartup is_process_startup = process_startup ? + IS_PROCESS_STARTUP : IS_NOT_PROCESS_STARTUP; + IsFirstRun is_first_run = FirstRun::IsChromeFirstRun() ? + IS_FIRST_RUN : IS_NOT_FIRST_RUN; + return browser_init->LaunchBrowser(command_line, profile, cur_dir, + is_process_startup, is_first_run, return_code); } return true; } diff --git a/chrome/browser/ui/browser_init.h b/chrome/browser/ui/browser_init.h index 24466ea..46ae72f 100644 --- a/chrome/browser/ui/browser_init.h +++ b/chrome/browser/ui/browser_init.h @@ -24,6 +24,15 @@ class TabContentsWrapper; // initialize the profile. class BrowserInit { public: + enum IsProcessStartup { + IS_NOT_PROCESS_STARTUP, + IS_PROCESS_STARTUP + }; + enum IsFirstRun { + IS_NOT_FIRST_RUN, + IS_FIRST_RUN + }; + BrowserInit(); ~BrowserInit(); @@ -64,8 +73,12 @@ class BrowserInit { // be the command line passed to this process. |cur_dir| can be empty, which // implies that the directory of the executable should be used. // |process_startup| indicates whether this is the first browser. - bool LaunchBrowser(const CommandLine& command_line, Profile* profile, - const FilePath& cur_dir, bool process_startup, + // |is_first_run| indicates that this is a new profile. + bool LaunchBrowser(const CommandLine& command_line, + Profile* profile, + const FilePath& cur_dir, + IsProcessStartup is_process_startup, + IsFirstRun is_first_run, int* return_code); // LaunchWithProfile --------------------------------------------------------- @@ -97,10 +110,14 @@ class BrowserInit { // There are two ctors. The first one implies a NULL browser_init object // and thus no access to distribution-specific first-run behaviors. The // second one is always called when the browser starts even if it is not - // the first run. - LaunchWithProfile(const FilePath& cur_dir, const CommandLine& command_line); - LaunchWithProfile(const FilePath& cur_dir, const CommandLine& command_line, - BrowserInit* browser_init); + // the first run. |is_first_run| indicates that this is a new profile. + LaunchWithProfile(const FilePath& cur_dir, + const CommandLine& command_line, + IsFirstRun is_first_run); + LaunchWithProfile(const FilePath& cur_dir, + const CommandLine& command_line, + BrowserInit* browser_init, + IsFirstRun is_first_run); ~LaunchWithProfile(); // Creates the necessary windows for startup. Returns true on success, @@ -213,6 +230,7 @@ class BrowserInit { const CommandLine& command_line_; Profile* profile_; BrowserInit* browser_init_; + bool is_first_run_; DISALLOW_COPY_AND_ASSIGN(LaunchWithProfile); }; diff --git a/chrome/browser/ui/browser_init_browsertest.cc b/chrome/browser/ui/browser_init_browsertest.cc index 4a2fda3..e6ad36b9 100644 --- a/chrome/browser/ui/browser_init_browsertest.cc +++ b/chrome/browser/ui/browser_init_browsertest.cc @@ -7,6 +7,7 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/extensions/extension_browsertest.h" #include "chrome/browser/extensions/extension_service.h" +#include "chrome/browser/first_run/first_run.h" #include "chrome/browser/prefs/session_startup_pref.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" @@ -95,7 +96,9 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest, OpenURLsPopup) { ASSERT_EQ(popup, observer.added_browser_); CommandLine dummy(CommandLine::NO_PROGRAM); - BrowserInit::LaunchWithProfile launch(FilePath(), dummy); + BrowserInit::IsFirstRun first_run = FirstRun::IsChromeFirstRun() ? + BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN; + BrowserInit::LaunchWithProfile launch(FilePath(), dummy, first_run); // This should create a new window, but re-use the profile from |popup|. If // it used a NULL or invalid profile, it would crash. launch.OpenURLsInBrowser(popup, false, urls); @@ -127,7 +130,9 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest, // Do a simple non-process-startup browser launch. CommandLine dummy(CommandLine::NO_PROGRAM); - BrowserInit::LaunchWithProfile launch(FilePath(), dummy); + BrowserInit::IsFirstRun first_run = FirstRun::IsChromeFirstRun() ? + BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN; + BrowserInit::LaunchWithProfile launch(FilePath(), dummy, first_run); ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); // This should have created a new browser window. |browser()| is still @@ -163,7 +168,9 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest, // Do a simple non-process-startup browser launch. CommandLine dummy(CommandLine::NO_PROGRAM); - BrowserInit::LaunchWithProfile launch(FilePath(), dummy); + BrowserInit::IsFirstRun first_run = FirstRun::IsChromeFirstRun() ? + BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN; + BrowserInit::LaunchWithProfile launch(FilePath(), dummy, first_run); ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); // This should have created a new browser window. @@ -185,7 +192,9 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest, OpenAppShortcutNoPref) { CommandLine command_line(CommandLine::NO_PROGRAM); command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); - BrowserInit::LaunchWithProfile launch(FilePath(), command_line); + BrowserInit::IsFirstRun first_run = FirstRun::IsChromeFirstRun() ? + BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN; + BrowserInit::LaunchWithProfile launch(FilePath(), command_line, first_run); ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); // No pref was set, so the app should have opened in a window. @@ -211,7 +220,9 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest, OpenAppShortcutWindowPref) { CommandLine command_line(CommandLine::NO_PROGRAM); command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); - BrowserInit::LaunchWithProfile launch(FilePath(), command_line); + BrowserInit::IsFirstRun first_run = FirstRun::IsChromeFirstRun() ? + BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN; + BrowserInit::LaunchWithProfile launch(FilePath(), command_line, first_run); ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); // Pref was set to open in a window, so the app should have opened in a @@ -239,7 +250,9 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest, OpenAppShortcutTabPref) { CommandLine command_line(CommandLine::NO_PROGRAM); command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); - BrowserInit::LaunchWithProfile launch(FilePath(), command_line); + BrowserInit::IsFirstRun first_run = FirstRun::IsChromeFirstRun() ? + BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN; + BrowserInit::LaunchWithProfile launch(FilePath(), command_line, first_run); ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); // When an app shortcut is open and the pref indicates a tab should @@ -266,7 +279,9 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest, OpenAppShortcutPanel) { CommandLine command_line(CommandLine::NO_PROGRAM); command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); - BrowserInit::LaunchWithProfile launch(FilePath(), command_line); + BrowserInit::IsFirstRun first_run = FirstRun::IsChromeFirstRun() ? + BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN; + BrowserInit::LaunchWithProfile launch(FilePath(), command_line, first_run); ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); // The launch should have created a new browser, with a panel type. diff --git a/chrome/browser/ui/webui/sync_promo_ui.cc b/chrome/browser/ui/webui/sync_promo_ui.cc index 81630eb..40a2089 100644 --- a/chrome/browser/ui/webui/sync_promo_ui.cc +++ b/chrome/browser/ui/webui/sync_promo_ui.cc @@ -5,12 +5,15 @@ #include "chrome/browser/ui/webui/sync_promo_ui.h" #include "base/command_line.h" +#include "chrome/browser/first_run/first_run.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/ui/webui/chrome_url_data_manager.h" #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" #include "chrome/browser/ui/webui/sync_promo_handler.h" #include "chrome/browser/ui/webui/theme_source.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" #include "content/browser/tab_contents/tab_contents.h" #include "grit/browser_resources.h" @@ -23,6 +26,16 @@ namespace { const char kStringsJsFile[] = "strings.js"; const char kSyncPromoJsFile[] = "sync_promo.js"; +// The maximum number of times we want to show the sync promo at startup. +const int kSyncPromoShowAtStartupMaxiumum = 10; + +void RegisterSyncPromoPrefs(Profile* profile) { + if (!profile->GetPrefs()->FindPreference(prefs::kSyncPromoStartupCount)) { + profile->GetPrefs()->RegisterIntegerPref( + prefs::kSyncPromoStartupCount, 0, PrefService::UNSYNCABLE_PREF); + } +} + // The Web UI data source for the sync promo page. class SyncPromoUIHTMLSource : public ChromeWebUIDataSource { public: @@ -74,3 +87,31 @@ bool SyncPromoUI::ShouldShowSyncPromo() { CommandLine* command_line = CommandLine::ForCurrentProcess(); return command_line->HasSwitch(switches::kSyncShowPromo); } + +bool IsFirstRun(Profile* profile) { + return FirstRun::IsChromeFirstRun(); +} + +bool SyncPromoUI::ShouldShowSyncPromoAtStartup(Profile* profile, + bool is_new_profile) { + if (!ShouldShowSyncPromo()) + return false; + + RegisterSyncPromoPrefs(profile); + if (!is_new_profile) { + if (!profile->GetPrefs()->HasPrefPath(prefs::kSyncPromoStartupCount)) + return false; + } + + int show_count = profile->GetPrefs()->GetInteger( + prefs::kSyncPromoStartupCount); + return show_count < kSyncPromoShowAtStartupMaxiumum; +} + +void SyncPromoUI::DidShowSyncPromoAtStartup(Profile* profile) { + RegisterSyncPromoPrefs(profile); + int show_count = profile->GetPrefs()->GetInteger( + prefs::kSyncPromoStartupCount); + show_count++; + profile->GetPrefs()->SetInteger(prefs::kSyncPromoStartupCount, show_count); +} diff --git a/chrome/browser/ui/webui/sync_promo_ui.h b/chrome/browser/ui/webui/sync_promo_ui.h index 1e1f783..4914369 100644 --- a/chrome/browser/ui/webui/sync_promo_ui.h +++ b/chrome/browser/ui/webui/sync_promo_ui.h @@ -8,6 +8,8 @@ #include "chrome/browser/ui/webui/chrome_web_ui.h" +class Profile; + // The Web UI handler for chrome://syncpromo. class SyncPromoUI : public ChromeWebUI { public: @@ -18,6 +20,13 @@ class SyncPromoUI : public ChromeWebUI { // Returns true if the sync promo should be visible. static bool ShouldShowSyncPromo(); + // Returns true if we should show the sync promo at startup. + static bool ShouldShowSyncPromoAtStartup(Profile* profile, + bool is_new_profile); + // Called when the sync promo has been shown so that we can keep track + // of the number of times we've displayed it. + static void DidShowSyncPromoAtStartup(Profile* profile); + private: DISALLOW_COPY_AND_ASSIGN(SyncPromoUI); }; diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index 570ae72..269a389 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc @@ -1115,6 +1115,9 @@ const char kShouldUseMinimalFirstRunBubble[] = "show-minimal-first-run-bubble"; // Signal that we should show the welcome page when we launch Chrome. const char kShouldShowWelcomePage[] = "show-welcome-page"; +// Tracks the number of times that we have shown the sync promo at startup. +const char kSyncPromoStartupCount[] = "sync-promo-startup-count"; + // String containing the last known Google URL. We re-detect this on startup in // most cases, and use it to send traffic to the correct Google host or with the // correct Google domain/country code for whatever location the user is in. diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index 2c2a71a..c87fe22 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h @@ -395,6 +395,7 @@ extern const char kShouldShowFirstRunBubble[]; extern const char kShouldUseOEMFirstRunBubble[]; extern const char kShouldUseMinimalFirstRunBubble[]; extern const char kShouldShowWelcomePage[]; +extern const char kSyncPromoStartupCount[]; extern const char kLastKnownGoogleURL[]; extern const char kLastPromptedGoogleURL[]; |