diff options
-rw-r--r-- | chrome/browser/sync/glue/sync_backend_host.cc | 4 | ||||
-rw-r--r-- | chrome/browser/sync/profile_sync_service.cc | 30 | ||||
-rw-r--r-- | chrome/browser/sync/profile_sync_service.h | 13 | ||||
-rwxr-xr-x | chrome/browser/sync/resources/choose_datatypes.html | 33 | ||||
-rw-r--r-- | chrome/browser/sync/resources/gaia_login.html | 221 | ||||
-rw-r--r-- | chrome/browser/sync/resources/setup_flow.html | 30 | ||||
-rw-r--r-- | chrome/browser/sync/sync_setup_flow.cc | 173 | ||||
-rw-r--r-- | chrome/browser/sync/sync_setup_flow.h | 13 | ||||
-rw-r--r-- | chrome/browser/sync/sync_setup_wizard.cc | 45 | ||||
-rw-r--r-- | chrome/browser/sync/sync_setup_wizard.h | 19 | ||||
-rw-r--r-- | chrome/browser/sync/sync_setup_wizard_unittest.cc | 62 | ||||
-rw-r--r-- | chrome/browser/sync/syncable/model_type.cc | 4 | ||||
-rw-r--r-- | chrome/browser/views/options/content_page_view.cc | 3 | ||||
-rw-r--r-- | chrome/common/pref_names.cc | 5 | ||||
-rw-r--r-- | chrome/common/pref_names.h | 1 | ||||
-rw-r--r-- | chrome/common/url_constants.cc | 2 | ||||
-rw-r--r-- | chrome/common/url_constants.h | 1 |
17 files changed, 499 insertions, 160 deletions
diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc index 0c36f3d..02c03d8 100644 --- a/chrome/browser/sync/glue/sync_backend_host.cc +++ b/chrome/browser/sync/glue/sync_backend_host.cc @@ -403,10 +403,6 @@ void SyncBackendHost::Core::DoInitialize(const DoInitializeOptions& options) { options.lsid.c_str(), options.notification_method); DCHECK(success) << "Syncapi initialization failed!"; - - // TODO(dantasse): this call is in a temporary position in order to enable - // the new sync setup/passphrase UI. http://crbug.com/45869 - DoStartSyncing(); } void SyncBackendHost::Core::DoAuthenticate(const std::string& username, diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc index 7b4f3fb..9f778f5 100644 --- a/chrome/browser/sync/profile_sync_service.cc +++ b/chrome/browser/sync/profile_sync_service.cc @@ -200,6 +200,7 @@ void ProfileSyncService::RegisterPreferences() { return; pref_service->RegisterInt64Pref(prefs::kSyncLastSyncedTime, 0); pref_service->RegisterBooleanPref(prefs::kSyncHasSetupCompleted, false); + pref_service->RegisterBooleanPref(prefs::kKeepEverythingSynced, false); // If you've never synced before, or if you're using Chrome OS, all datatypes // are on by default. @@ -510,6 +511,15 @@ void ProfileSyncService::ShowLoginDialog() { } } +void ProfileSyncService::ShowChooseDataTypes() { + if (WizardIsVisible()) { + wizard_.Focus(); + return; + } + + wizard_.Step(SyncSetupWizard::CHOOSE_DATA_TYPES); +} + SyncBackendHost::StatusSummary ProfileSyncService::QuerySyncStatusSummary() { if (backend_.get()) return backend_->GetStatusSummary(); @@ -583,10 +593,21 @@ void ProfileSyncService::OnUserSubmittedAuth( } void ProfileSyncService::OnUserChoseDatatypes(bool sync_everything, - const syncable::ModelTypeSet& data_types) { - // TODO(dantasse): save sync_everything to prefs - // call StartSyncing(data_types) - // call ChangePreferredDataTypes(data_types) + const syncable::ModelTypeSet& chosen_types) { + if (!backend_.get()) { + NOTREACHED(); + return; + } + profile_->GetPrefs()->SetBoolean(prefs::kKeepEverythingSynced, + sync_everything); + + ChangePreferredDataTypes(chosen_types); + profile_->GetPrefs()->ScheduleSavePersistentPrefs(); + + // If the backend has already started syncing, that's okay; + // SyncerThread::Start() checks if it's already running before starting. + backend_->StartSyncing(); + // TODO(dantasse): pass the chosen_types parameter through to the backend } void ProfileSyncService::OnUserCancelledDialog() { @@ -719,6 +740,7 @@ void ProfileSyncService::Observe(NotificationType type, // TODO(sync): Less wizard, more toast. wizard_.Step(SyncSetupWizard::DONE); FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged()); + break; } case NotificationType::SYNC_PASSPHRASE_REQUIRED: { diff --git a/chrome/browser/sync/profile_sync_service.h b/chrome/browser/sync/profile_sync_service.h index 929d8bd..ece018a 100644 --- a/chrome/browser/sync/profile_sync_service.h +++ b/chrome/browser/sync/profile_sync_service.h @@ -112,7 +112,8 @@ class ProfileSyncService : public browser_sync::SyncFrontend, CANCEL_FROM_SIGNON_WITHOUT_AUTH = 10, // Cancelled before submitting // username and password. CANCEL_DURING_SIGNON = 11, // Cancelled after auth. - + CANCEL_FROM_CHOOSE_DATA_TYPES = 12, // Cancelled before choosing data + // types and clicking OK. // Events resulting in the stoppage of sync service. STOP_FROM_OPTIONS = 20, // Sync was stopped from Wrench->Options. @@ -169,11 +170,11 @@ class ProfileSyncService : public browser_sync::SyncFrontend, // Called when a user chooses which data types to sync as part of the sync // setup wizard. |sync_everything| represents whether they chose the - // "keep everything synced" option; if true, data_types will be ignored and - // all data types will be synced. |sync_everything| means "sync all current - // and future data types." + // "keep everything synced" option; if true, |chosen_types| will be ignored + // and all data types will be synced. |sync_everything| means "sync all + // current and future data types." virtual void OnUserChoseDatatypes(bool sync_everything, - const syncable::ModelTypeSet& data_types); + const syncable::ModelTypeSet& chosen_types); // Called when a user cancels any setup dialog (login, etc). virtual void OnUserCancelledDialog(); @@ -201,6 +202,8 @@ class ProfileSyncService : public browser_sync::SyncFrontend, } void ShowLoginDialog(); + void ShowChooseDataTypes(); + // Pretty-printed strings for a given StatusSummary. static std::wstring BuildSyncStatusSummaryText( const browser_sync::SyncBackendHost::StatusSummary& summary); diff --git a/chrome/browser/sync/resources/choose_datatypes.html b/chrome/browser/sync/resources/choose_datatypes.html index e48675c..300dfd0 100755 --- a/chrome/browser/sync/resources/choose_datatypes.html +++ b/chrome/browser/sync/resources/choose_datatypes.html @@ -102,6 +102,15 @@ input[type='submit'] { document.getElementById("extensionsCheckbox").style.display = "none"; document.getElementById("extensionsCheckboxLabel").style.display = "none"; } + if (args.typedUrlsRegistered) { + document.getElementById("typedUrlsCheckbox").checked = args.syncTypedUrls; + document.getElementById("typedUrlsCheckbox").style.display = "inline"; + document.getElementById("typedUrlsCheckboxLabel").style.display = + "inline"; + } else { + document.getElementById("typedUrlsCheckbox").style.display = "none"; + document.getElementById("typedUrlsCheckboxLabel").style.display = "none"; + } } function setDataTypeCheckboxesEnabled(enabled) { @@ -111,6 +120,7 @@ input[type='submit'] { document.getElementById("passwordsCheckbox").disabled = !enabled; document.getElementById("autofillCheckbox").disabled = !enabled; document.getElementById("extensionsCheckbox").disabled = !enabled; + document.getElementById("typedUrlsCheckbox").disabled = !enabled; } function advanceThrobber() { @@ -143,7 +153,8 @@ input[type='submit'] { "syncThemes": syncAll || f.themesCheckbox.checked, "syncPasswords": syncAll || f.passwordsCheckbox.checked, "syncAutofill": syncAll || f.autofillCheckbox.checked, - "syncExtensions": syncAll || f.extensionsCheckbox.checked + "syncExtensions": syncAll || f.extensionsCheckbox.checked, + "syncTypedUrls": syncAll || f.typedUrlsCheckbox.checked }); chrome.send("ChooseDataTypes", [result]); } @@ -178,8 +189,8 @@ input[type='submit'] { <label id="bookmarksCheckboxLabel" for="bookmarksCheckbox" i18n-content="bookmarks"></label> </td> <td> - <input id="passwordsCheckbox" type="checkbox"/> - <label id="passwordsCheckboxLabel" for="passwordsCheckbox" i18n-content="passwords"></label> + <input id="autofillCheckbox" type="checkbox"/> + <label id="autofillCheckboxLabel" for="autofillCheckbox" i18n-content="autofill"></label> </td> </tr> <tr> @@ -188,8 +199,8 @@ input[type='submit'] { <label id="preferencesCheckboxLabel" for="preferencesCheckbox" i18n-content="preferences"></label> </td> <td> - <input id="autofillCheckbox" type="checkbox"/> - <label id="autofillCheckboxLabel" for="autofillCheckbox" i18n-content="autofill"></label> + <input id="extensionsCheckbox" type="checkbox"/> + <label id="extensionsCheckboxLabel" for="extensionsCheckbox" i18n-content="extensions"></label> </td> </tr> <tr> @@ -198,8 +209,16 @@ input[type='submit'] { <label id="themesCheckboxLabel" for="themesCheckbox" i18n-content="themes"></label> </td> <td> - <input id="extensionsCheckbox" type="checkbox"/> - <label id="extensionsCheckboxLabel" for="extensionsCheckbox" i18n-content="extensions"></label> + <input id="typedUrlsCheckbox" type="checkbox"/> + <label id="typedUrlsCheckboxLabel" for="typedUrlsCheckbox" i18n-content="typedurls"></label> + </td> + </tr> + <tr> + <td> + <input id="passwordsCheckbox" type="checkbox"/> + <label id="passwordsCheckboxLabel" for="passwordsCheckbox" i18n-content="passwords"></label> + </td> + <td> </td> </tr> </table> diff --git a/chrome/browser/sync/resources/gaia_login.html b/chrome/browser/sync/resources/gaia_login.html index 7473ef3b..a9d8417 100644 --- a/chrome/browser/sync/resources/gaia_login.html +++ b/chrome/browser/sync/resources/gaia_login.html @@ -1,84 +1,89 @@ <html i18n-values="dir:textdirection;"> - <head> -<style type="text/css"><!-- +<head> +<style type="text/css"> body,td,div,p,a,font,span {font-family: arial,sans-serif;} body { background-color:#ffffff } A:link {color:#0000cc; } A:visited { color:#551a8b; } A:active { color:#ff0000; } .form-noindent {background-color: #ffffff; border: #C3D9FF 1px solid} ---></style> - <style type="text/css"><!-- - .body { margin-left: 3em; - margin-right: 5em; - font-family: arial,sans-serif; } - .endaligned { - text-align: right; - } - html[dir='rtl'] .endaligned { - text-align: left; - } - #gaia_account_text { font-weight: bold; } - div.errorbox-good {} - div.errorbox-bad {} - div.errormsg { color: red; font-size: smaller; - font-family: arial,sans-serif; - display: none;} - font.errormsg { color: red; font-size: smaller; - font-family: arial,sans-serif;} - div.errormsgspacer { min-height: 1em;} - font.errormsgspacer { font-size: smaller; - font-family: arial,sans-serif;} + .body { margin-left: 3em; + margin-right: 5em; + font-family: arial,sans-serif; } + .endaligned { + text-align: right; + } + html[dir='rtl'] .endaligned { + text-align: left; + } + #gaia_account_text { font-weight: bold; } + div.errorbox-good {} + div.errorbox-bad {} + div.errormsg { color: red; font-size: smaller; + font-family: arial,sans-serif; + display: none;} + font.errormsg { color: red; font-size: smaller; + font-family: arial,sans-serif;} + div.errormsgspacer { min-height: 1em;} + font.errormsgspacer { font-size: smaller; + font-family: arial,sans-serif;} - hr { - border: 0; - background-color:#DDDDDD; - height: 1px; - width: 100%; - text-align: left; - margin: 5px; - } - #gaia_loginform { - margin-bottom: 0; - } + hr { + border: 0; + background-color:#DDDDDD; + height: 1px; + width: 100%; + text-align: left; + margin: 5px; + } + #gaia_loginform { + margin-bottom: 0; + } - #captcha_wrapper { - background-size: 200px 70px; - background: no-repeat; - background-position: center; - background-color: #e8eefa; - display: block; - } - .captcha_image { - display: block; - width: 200px; - height: 70px; - } - .toppageverticalspace { - height: 15px; - } - .bottompaddedcell { - padding-bottom: 3px; - } - .noverticalpadding { - padding-top: 0; - padding-bottom: 0; - } - .cancelspacenocaptcha { - height: 22px; - } - .cancelspaceforcaptcha { - height: 5px; - } - #top_blurb { - text-align: justify; - } - --> - </style> - </head> - <body bgcolor="#ffffff" vlink="#666666" - i18n-values=".style.fontFamily:fontfamily;.style.fontSize:fontsize" - style="margin-bottom: 6px; margin-top: 6px;" onload="initForm();"> + #captcha_wrapper { + background-size: 200px 70px; + background: no-repeat; + background-position: center; + background-color: #e8eefa; + display: block; + } + .captcha_image { + display: block; + width: 200px; + height: 70px; + } + .toppageverticalspace { + height: 15px; + } + .bottompaddedcell { + padding-bottom: 3px; + } + .noverticalpadding { + padding-top: 0; + padding-bottom: 0; + } + .cancelspacenocaptcha { + height: 22px; + } + .cancelspaceforcaptcha { + height: 5px; + } + #top_blurb { + text-align: justify; + } + input[type='button'] { + min-width: 87px; + min-height: 26px; + } + input[type='submit'] { + min-width: 87px; + min-height: 26px; + } +</style> +</head> +<body bgcolor="#ffffff" vlink="#666666" + i18n-values=".style.fontFamily:fontfamily;.style.fontSize:fontsize" + style="margin-bottom: 6px; margin-top: 6px;" onload="initGaiaLoginForm();"> <table width="100%" height="100%" align="center" cellpadding="1" cellspacing="1"> <tr> <td valign="top"> <!-- LOGIN BOX --> @@ -149,10 +154,6 @@ } document.getElementById("signIn").disabled = false; document.getElementById("signIn").value = templateData['signin']; - if (args.showCustomize) { - document.getElementById("customize").disabled = false; - document.getElementById("customize").style.visibility = "visible"; - } gaia_setFocus(); } @@ -181,14 +182,9 @@ } function CloseDialog() { - chrome.send("ClickCustomizeCancel", [""]); chrome.send("DialogClose", [""]); } - function showCustomize() { - chrome.send("ShowCustomize", [""]); - } - function showGaiaSuccessAndClose() { document.getElementById("signIn").value = templateData['success']; setTimeout(CloseDialog, 1600); @@ -198,7 +194,8 @@ document.getElementById("signIn").value = templateData['settingup']; } - function initForm() { + // Called once, when this html/js is loaded. + function initGaiaLoginForm() { var acct_text = document.getElementById("gaia_account_text"); var translated_text = acct_text.textContent; var posGoogle = translated_text.indexOf('Google'); @@ -220,16 +217,13 @@ function sendCredentialsAndClose() { - chrome.send("ClickCustomizeOk", [""]); if (!setErrorVisibility()) return false; document.getElementById('Email').disabled = true; document.getElementById('Passwd').disabled = true; document.getElementById('CaptchaValue').disabled = true; - if (document.getElementById('customize')) { - document.getElementById('customize').disabled = true; - } + var throbber = document.getElementById('throbber_container'); throbber.style.display = "inline"; var f = document.getElementById("gaia_loginform"); @@ -278,30 +272,30 @@ return true; } </script> -<style type="text/css"><!-- - div.errormsg { color: red; font-size: smaller; font-family:arial,sans-serif; } - font.errormsg { color: red; font-size: smaller; font-family:arial,sans-serif;} ---></style> -<style type="text/css"><!-- -.gaia.le.lbl { font-family: Arial, Helvetica, sans-serif; font-size: smaller; } -.gaia.le.fpwd { font-family: Arial, Helvetica, sans-serif; font-size: 70%; } -.gaia.le.chusr { font-family: Arial, Helvetica, sans-serif; font-size: 70%; } -.gaia.le.val { font-family: Arial, Helvetica, sans-serif; font-size: smaller; } -.gaia.le.button { font-family: Arial, Helvetica, sans-serif; } -.gaia.le.rem { font-family: Arial, Helvetica, sans-serif; font-size: smaller; } -.gaia.captchahtml.desc { font-family: arial, sans-serif; font-size: smaller; } -.gaia.captchahtml.cmt { font-family: arial, sans-serif; font-size: smaller; - font-style: italic; } ---></style> -<div id="top_blurb"> - <p><font size="-1"><span i18n-content="introduction"></span></font></p> -</div> -<div id="top_blurb_error" style="display:none"> - <p><font size="-1"> - <span i18n-content="settingupsync"></span><br/><br/> - <b><span i18n-content="errorsigningin"></span></b> - </font></p> -</div> + <style type="text/css"> + div.errormsg { color: red; font-size: smaller; font-family:arial,sans-serif; } + font.errormsg { color: red; font-size: smaller; font-family:arial,sans-serif;} + </style> + <style type="text/css"> + .gaia.le.lbl { font-family: Arial, Helvetica, sans-serif; font-size: smaller; } + .gaia.le.fpwd { font-family: Arial, Helvetica, sans-serif; font-size: 70%; } + .gaia.le.chusr { font-family: Arial, Helvetica, sans-serif; font-size: 70%; } + .gaia.le.val { font-family: Arial, Helvetica, sans-serif; font-size: smaller; } + .gaia.le.button { font-family: Arial, Helvetica, sans-serif; } + .gaia.le.rem { font-family: Arial, Helvetica, sans-serif; font-size: smaller; } + .gaia.captchahtml.desc { font-family: arial, sans-serif; font-size: smaller; } + .gaia.captchahtml.cmt { font-family: arial, sans-serif; font-size: smaller; + font-style: italic; } + </style> + <div id="top_blurb"> + <p><font size="-1"><span i18n-content="introduction"></span></font></p> + </div> + <div id="top_blurb_error" style="display:none"> + <p><font size="-1"> + <span i18n-content="settingupsync"></span><br/><br/> + <b><span i18n-content="errorsigningin"></span></b> + </font></p> + </div> <form id="gaia_loginform" onsubmit="sendCredentialsAndClose(); return false;"> <div id="gaia_loginbox"> <table id="content_table" class="form-noindent" cellspacing="0" cellpadding="5" @@ -331,7 +325,7 @@ </table> </td> </tr> - <script type="text/javascript"><!-- + <script type="text/javascript"> function onPreCreateAccount() { return true; } @@ -342,7 +336,7 @@ return true; } } - --></script> + </script> <tr> <td colspan="2" align="center"> </td> </tr> @@ -491,9 +485,6 @@ </tr> <tr> <td class="endaligned noverticalpadding" colspan="2" style="vertical-align: bottom"> - <input id="customize" type="button" name="customize" - i18n-values="value:customize" onclick="showCustomize();" - style="visibility:hidden" disabled="disabled"> <input type="button" name="cancel" i18n-values="value:cancel" onclick="CloseDialog();" style="width:85"> </td> diff --git a/chrome/browser/sync/resources/setup_flow.html b/chrome/browser/sync/resources/setup_flow.html index 258e2cf..4b1dede 100644 --- a/chrome/browser/sync/resources/setup_flow.html +++ b/chrome/browser/sync/resources/setup_flow.html @@ -1,16 +1,38 @@ <html id='t'> <head> <title></title> -<script> - function showSetupDone() { +<script type="text/javascript"> + + // Called once, when this html/js is loaded. + function showTheRightIframe() { + hideAllPages(); + var args = JSON.parse(chrome.dialogArguments); + document.getElementById(args.iframeToShow).style.display = 'block'; + } + + function hideAllPages() { document.getElementById('login').style.display = 'none'; + document.getElementById('choose_data_types').style.display = 'none'; + document.getElementById('done').style.display = 'none'; + } + + function showChooseDataTypes() { + hideAllPages(); + document.getElementById('choose_data_types').style.display = 'block'; + } + + function showSetupDone() { + hideAllPages(); document.getElementById('done').style.display = 'block'; } </script> </head> -<body style="margin:0; border:0;"> +<body style="margin:0; border:0;" onload="showTheRightIframe();"> <iframe id="login" frameborder="0" width="100%" scrolling="no" height="100%" - src="chrome://syncresources/gaialogin"></iframe> + src="chrome://syncresources/gaialogin" style="display:none"></iframe> + <iframe id="choose_data_types" frameborder="0" width="100%" scrolling="no" + height="100%" src="chrome://syncresources/choosedatatypes" + style="display:none"></iframe> <iframe id="done" frameborder="0" width="100%" scrolling="no" height="100%" src="chrome://syncresources/setupdone" style="display:none"></iframe> </body> diff --git a/chrome/browser/sync/sync_setup_flow.cc b/chrome/browser/sync/sync_setup_flow.cc index 92e345e..9afda35 100644 --- a/chrome/browser/sync/sync_setup_flow.cc +++ b/chrome/browser/sync/sync_setup_flow.cc @@ -32,6 +32,8 @@ // XPath expression for finding specific iframes. static const wchar_t* kLoginIFrameXPath = L"//iframe[@id='login']"; +static const wchar_t* kChooseDataTypesIFrameXPath = + L"//iframe[@id='choose_data_types']"; static const wchar_t* kDoneIframeXPath = L"//iframe[@id='done']"; void FlowHandler::RegisterMessages() { @@ -47,6 +49,8 @@ void FlowHandler::RegisterMessages() { #endif dom_ui_->RegisterMessageCallback("SubmitAuth", NewCallback(this, &FlowHandler::HandleSubmitAuth)); + dom_ui_->RegisterMessageCallback("ChooseDataTypes", + NewCallback(this, &FlowHandler::HandleChooseDataTypes)); } static bool GetAuthData(const std::string& json, @@ -64,6 +68,63 @@ static bool GetAuthData(const std::string& json, return true; } +static bool GetDataTypeChoiceData(const std::string& json, + bool* sync_everything, syncable::ModelTypeSet* data_types) { + scoped_ptr<Value> parsed_value(base::JSONReader::Read(json, false)); + if (!parsed_value.get() || !parsed_value->IsType(Value::TYPE_DICTIONARY)) + return false; + + DictionaryValue* result = static_cast<DictionaryValue*>(parsed_value.get()); + if (!result->GetBoolean(L"keepEverythingSynced", sync_everything)) + return false; + + // These values need to be kept in sync with where they are written in + // choose_datatypes.html. + bool sync_bookmarks; + if (!result->GetBoolean(L"syncBookmarks", &sync_bookmarks)) + return false; + if (sync_bookmarks) + data_types->insert(syncable::BOOKMARKS); + + bool sync_preferences; + if (!result->GetBoolean(L"syncPreferences", &sync_preferences)) + return false; + if (sync_preferences) + data_types->insert(syncable::PREFERENCES); + + bool sync_themes; + if (!result->GetBoolean(L"syncThemes", &sync_themes)) + return false; + if (sync_themes) + data_types->insert(syncable::THEMES); + + bool sync_passwords; + if (!result->GetBoolean(L"syncPasswords", &sync_passwords)) + return false; + if (sync_passwords) + data_types->insert(syncable::PASSWORDS); + + bool sync_autofill; + if (!result->GetBoolean(L"syncAutofill", &sync_autofill)) + return false; + if (sync_autofill) + data_types->insert(syncable::AUTOFILL); + + bool sync_extensions; + if (!result->GetBoolean(L"syncExtensions", &sync_extensions)) + return false; + if (sync_extensions) + data_types->insert(syncable::EXTENSIONS); + + bool sync_typed_urls; + if (!result->GetBoolean(L"syncTypedUrls", &sync_typed_urls)) + return false; + if (sync_typed_urls) + data_types->insert(syncable::TYPED_URLS); + + return true; +} + void FlowHandler::HandleUserClickedCustomize(const Value* value) { if (flow_) flow_->OnUserClickedCustomize(); @@ -111,8 +172,39 @@ void FlowHandler::HandleSubmitAuth(const Value* value) { flow_->OnUserSubmittedAuth(username, password, captcha); } + +void FlowHandler::HandleChooseDataTypes(const Value* value) { + std::string json(dom_ui_util::GetJsonResponseFromFirstArgumentInList(value)); + bool sync_everything; + syncable::ModelTypeSet chosen_types; + if (json.empty()) + return; + + if (!GetDataTypeChoiceData(json, &sync_everything, &chosen_types)) { + // The page sent us something that we didn't understand. + // This probably indicates a programming error. + NOTREACHED(); + return; + } + + DCHECK(flow_); + flow_->OnUserChoseDataTypes(sync_everything, chosen_types); + + return; +} + // Called by SyncSetupFlow::Advance. void FlowHandler::ShowGaiaLogin(const DictionaryValue& args) { + // Whenever you start a wizard, you pass in an arg so it starts on the right + // iframe (see setup_flow.html's showTheRightIframe() method). But when you + // transition from one flow to another, you have to explicitly call the JS + // function to show the next iframe. + // So if you ever made a wizard that involved a gaia login as not the first + // frame, this call would be necessary to ensure that this method actually + // shows the gaia login. + if (dom_ui_) + dom_ui_->CallJavascriptFunction(L"showGaiaLoginIframe"); + std::string json; base::JSONWriter::Write(&args, false, &json); std::wstring javascript = std::wstring(L"showGaiaLogin") + @@ -129,6 +221,22 @@ void FlowHandler::ShowGaiaSuccessAndSettingUp() { L"showGaiaSuccessAndSettingUp();"); } +// Called by SyncSetupFlow::Advance. +void FlowHandler::ShowChooseDataTypes(const DictionaryValue& args) { + + // If you're starting the wizard at the Choose Data Types screen (i.e. from + // "Customize Sync"), this will be redundant. However, if you're coming from + // another wizard state, this will make sure Choose Data Types is on top. + if (dom_ui_) + dom_ui_->CallJavascriptFunction(L"showChooseDataTypes"); + + std::string json; + base::JSONWriter::Write(&args, false, &json); + std::wstring javascript = std::wstring(L"setChooseDataTypesCheckboxes") + + L"(" + UTF8ToWide(json) + L");"; + ExecuteJavascriptInIFrame(kChooseDataTypesIFrameXPath, javascript); +} + void FlowHandler::ShowSetupDone(const std::wstring& user) { StringValue synced_to_string(WideToUTF8(l10n_util::GetStringF( IDS_SYNC_NTP_SYNCED_TO, user))); @@ -229,8 +337,13 @@ void SyncSetupFlow::OnDialogClosed(const std::string& json_retval) { ProfileSyncService::SyncEvent( ProfileSyncService::CANCEL_DURING_SIGNON); break; + case SyncSetupWizard::CHOOSE_DATA_TYPES: + ProfileSyncService::SyncEvent( + ProfileSyncService::CANCEL_FROM_CHOOSE_DATA_TYPES); case SyncSetupWizard::DONE_FIRST_TIME: case SyncSetupWizard::DONE: + // TODO(sync): rename this histogram; it's tracking authorization AND + // initial sync download time. UMA_HISTOGRAM_MEDIUM_TIMES("Sync.UserPerceivedAuthorizationTime", base::TimeTicks::Now() - login_start_time_); break; @@ -245,6 +358,7 @@ void SyncSetupFlow::OnDialogClosed(const std::string& json_retval) { // static void SyncSetupFlow::GetArgsForGaiaLogin(const ProfileSyncService* service, DictionaryValue* args) { + args->SetString(L"iframeToShow", "login"); const GoogleServiceAuthError& error = service->GetAuthError(); if (!service->last_attempted_user_email().empty()) { args->SetString(L"user", service->last_attempted_user_email()); @@ -260,6 +374,42 @@ void SyncSetupFlow::GetArgsForGaiaLogin(const ProfileSyncService* service, args->SetBoolean(L"showCustomize", true); } +// static +void SyncSetupFlow::GetArgsForChooseDataTypes(ProfileSyncService* service, + DictionaryValue* args) { + args->SetString(L"iframeToShow", "choose_data_types"); + args->SetBoolean(L"keepEverythingSynced", + service->profile()->GetPrefs()->GetBoolean(prefs::kKeepEverythingSynced)); + + // Bookmarks, Preferences, and Themes are launched for good, there's no + // going back now. Check if the other data types are registered though. + syncable::ModelTypeSet registered_types; + service->GetRegisteredDataTypes(®istered_types); + args->SetBoolean(L"passwordsRegistered", + registered_types.count(syncable::PASSWORDS) > 0); + args->SetBoolean(L"autofillRegistered", + registered_types.count(syncable::AUTOFILL) > 0); + args->SetBoolean(L"extensionsRegistered", + registered_types.count(syncable::EXTENSIONS) > 0); + args->SetBoolean(L"typedUrlsRegistered", + registered_types.count(syncable::TYPED_URLS) > 0); + + args->SetBoolean(L"syncBookmarks", + service->profile()->GetPrefs()->GetBoolean(prefs::kSyncBookmarks)); + args->SetBoolean(L"syncPreferences", + service->profile()->GetPrefs()->GetBoolean(prefs::kSyncPreferences)); + args->SetBoolean(L"syncThemes", + service->profile()->GetPrefs()->GetBoolean(prefs::kSyncThemes)); + args->SetBoolean(L"syncPasswords", + service->profile()->GetPrefs()->GetBoolean(prefs::kSyncPasswords)); + args->SetBoolean(L"syncAutofill", + service->profile()->GetPrefs()->GetBoolean(prefs::kSyncAutofill)); + args->SetBoolean(L"syncExtensions", + service->profile()->GetPrefs()->GetBoolean(prefs::kSyncExtensions)); + args->SetBoolean(L"syncTypedUrls", + service->profile()->GetPrefs()->GetBoolean(prefs::kSyncTypedUrls)); +} + void SyncSetupFlow::GetDOMMessageHandlers( std::vector<DOMMessageHandler*>* handlers) const { handlers->push_back(flow_handler_); @@ -271,14 +421,17 @@ void SyncSetupFlow::GetDOMMessageHandlers( bool SyncSetupFlow::ShouldAdvance(SyncSetupWizard::State state) { switch (state) { case SyncSetupWizard::GAIA_LOGIN: - return current_state_ == SyncSetupWizard::GAIA_LOGIN; + return current_state_ == SyncSetupWizard::FATAL_ERROR || + current_state_ == SyncSetupWizard::GAIA_LOGIN; case SyncSetupWizard::GAIA_SUCCESS: return current_state_ == SyncSetupWizard::GAIA_LOGIN; + case SyncSetupWizard::CHOOSE_DATA_TYPES: + return current_state_ == SyncSetupWizard::GAIA_SUCCESS; case SyncSetupWizard::FATAL_ERROR: return true; // You can always hit the panic button. case SyncSetupWizard::DONE_FIRST_TIME: case SyncSetupWizard::DONE: - return current_state_ == SyncSetupWizard::GAIA_SUCCESS; + return current_state_ == SyncSetupWizard::CHOOSE_DATA_TYPES; default: NOTREACHED() << "Unhandled State: " << state; return false; @@ -288,6 +441,7 @@ bool SyncSetupFlow::ShouldAdvance(SyncSetupWizard::State state) { void SyncSetupFlow::Advance(SyncSetupWizard::State advance_state) { if (!ShouldAdvance(advance_state)) return; + switch (advance_state) { case SyncSetupWizard::GAIA_LOGIN: { DictionaryValue args; @@ -296,11 +450,18 @@ void SyncSetupFlow::Advance(SyncSetupWizard::State advance_state) { break; } case SyncSetupWizard::GAIA_SUCCESS: - if (end_state_ == SyncSetupWizard::GAIA_SUCCESS) + if (end_state_ == SyncSetupWizard::GAIA_SUCCESS) { flow_handler_->ShowGaiaSuccessAndClose(); - else - flow_handler_->ShowGaiaSuccessAndSettingUp(); + break; + } + advance_state = SyncSetupWizard::CHOOSE_DATA_TYPES; + // Fall through. + case SyncSetupWizard::CHOOSE_DATA_TYPES: { + DictionaryValue args; + SyncSetupFlow::GetArgsForChooseDataTypes(service_, &args); + flow_handler_->ShowChooseDataTypes(args); break; + } case SyncSetupWizard::FATAL_ERROR: { // This shows the user the "Could not connect to server" error. // TODO(sync): Update this error messaging. @@ -345,6 +506,8 @@ SyncSetupFlow* SyncSetupFlow::Run(ProfileSyncService* service, DictionaryValue args; if (start == SyncSetupWizard::GAIA_LOGIN) SyncSetupFlow::GetArgsForGaiaLogin(service, &args); + else if (start == SyncSetupWizard::CHOOSE_DATA_TYPES) + SyncSetupFlow::GetArgsForChooseDataTypes(service, &args); std::string json_args; base::JSONWriter::Write(&args, false, &json_args); diff --git a/chrome/browser/sync/sync_setup_flow.h b/chrome/browser/sync/sync_setup_flow.h index b7dfe24..dcc7fe7 100644 --- a/chrome/browser/sync/sync_setup_flow.h +++ b/chrome/browser/sync/sync_setup_flow.h @@ -47,6 +47,11 @@ class SyncSetupFlow : public HtmlDialogUIDelegate { const ProfileSyncService* service, DictionaryValue* args); + // Fills |args| with "user" and "error" arguments by querying |service|. + static void GetArgsForChooseDataTypes( + ProfileSyncService* service, + DictionaryValue* args); + // Triggers a state machine transition to advance_state. void Advance(SyncSetupWizard::State advance_state); @@ -127,8 +132,14 @@ class SyncSetupFlow : public HtmlDialogUIDelegate { service_->OnUserSubmittedAuth(username, password, captcha); } + void OnUserChoseDataTypes(bool sync_everything, + syncable::ModelTypeSet& chosen_types) { + service_->OnUserChoseDatatypes(sync_everything, chosen_types); + } + private: FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, InitialStepLogin); + FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, ChooseDataTypesSetsPrefs); FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, InitialStepMergeAndSync); FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, DialogCancelled); FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, InvalidTransitions); @@ -204,12 +215,14 @@ class FlowHandler : public DOMMessageHandler { void ClickCustomizeOk(const Value* value); void ClickCustomizeCancel(const Value* value); void HandleSubmitAuth(const Value* value); + void HandleChooseDataTypes(const Value* value); void HandleSubmitMergeAndSync(const Value* value); // These functions control which part of the HTML is visible. void ShowGaiaLogin(const DictionaryValue& args); void ShowGaiaSuccessAndClose(); void ShowGaiaSuccessAndSettingUp(); + void ShowChooseDataTypes(const DictionaryValue& args); void ShowSetupDone(const std::wstring& user); void ShowFirstTimeDone(const std::wstring& user); diff --git a/chrome/browser/sync/sync_setup_wizard.cc b/chrome/browser/sync/sync_setup_wizard.cc index 25b537b..9d62a61 100644 --- a/chrome/browser/sync/sync_setup_wizard.cc +++ b/chrome/browser/sync/sync_setup_wizard.cc @@ -126,6 +126,42 @@ void SyncResourcesSource::StartDataRequest(const std::string& path_raw, SetFontAndTextDirection(&localized_strings); response = jstemplate_builder::GetI18nTemplateHtml( html, &localized_strings); + } else if (path_raw == chrome::kSyncChooseDataTypesPath) { + DictionaryValue localized_strings; + localized_strings.SetString(L"choosedatatypesheader", + l10n_util::GetString(IDS_SYNC_CHOOSE_DATATYPES_HEADER)); + localized_strings.SetString(L"choosedatatypesinstructions", + l10n_util::GetStringF(IDS_SYNC_CHOOSE_DATATYPES_INSTRUCTIONS, + l10n_util::GetString(IDS_PRODUCT_NAME))); + localized_strings.SetString(L"keepeverythingsynced", + l10n_util::GetString(IDS_SYNC_EVERYTHING)); + localized_strings.SetString(L"choosedatatypes", + l10n_util::GetString(IDS_SYNC_CHOOSE_DATATYPES)); + localized_strings.SetString(L"bookmarks", + l10n_util::GetString(IDS_SYNC_DATATYPE_BOOKMARKS)); + localized_strings.SetString(L"preferences", + l10n_util::GetString(IDS_SYNC_DATATYPE_PREFERENCES)); + localized_strings.SetString(L"autofill", + l10n_util::GetString(IDS_SYNC_DATATYPE_AUTOFILL)); + localized_strings.SetString(L"themes", + l10n_util::GetString(IDS_SYNC_DATATYPE_THEMES)); + localized_strings.SetString(L"passwords", + l10n_util::GetString(IDS_SYNC_DATATYPE_PASSWORDS)); + localized_strings.SetString(L"extensions", + l10n_util::GetString(IDS_SYNC_DATATYPE_EXTENSIONS)); + localized_strings.SetString(L"typedurls", + l10n_util::GetString(IDS_SYNC_DATATYPE_TYPED_URLS)); + localized_strings.SetString(L"ok", + l10n_util::GetString(IDS_OK)); + localized_strings.SetString(L"cancel", + l10n_util::GetString(IDS_CANCEL)); + localized_strings.SetString(L"settingup", + l10n_util::GetString(IDS_SYNC_LOGIN_SETTING_UP)); + static const base::StringPiece html(ResourceBundle::GetSharedInstance() + .GetRawDataResource(IDR_SYNC_CHOOSE_DATATYPES_HTML)); + SetFontAndTextDirection(&localized_strings); + response = jstemplate_builder::GetI18nTemplateHtml( + html, &localized_strings); } else if (path_raw == chrome::kSyncSetupDonePath) { DictionaryValue localized_strings; localized_strings.SetString(L"success", @@ -222,8 +258,13 @@ void SyncSetupWizard::Focus() { // static SyncSetupWizard::State SyncSetupWizard::GetEndStateForDiscreteRun( State start_state) { - State result = start_state == GAIA_LOGIN ? GAIA_SUCCESS : DONE; - DCHECK_NE(DONE, result) << + State result = FATAL_ERROR; + if (start_state == GAIA_LOGIN) { + result = GAIA_SUCCESS; + } else if (start_state == CHOOSE_DATA_TYPES) { + result = DONE; + } + DCHECK_NE(FATAL_ERROR, result) << "Invalid start state for discrete run: " << start_state; return result; } diff --git a/chrome/browser/sync/sync_setup_wizard.h b/chrome/browser/sync/sync_setup_wizard.h index 1e3c242..acd4650 100644 --- a/chrome/browser/sync/sync_setup_wizard.h +++ b/chrome/browser/sync/sync_setup_wizard.h @@ -16,10 +16,20 @@ class SyncSetupWizard { enum State { // Show the Google Account login UI. GAIA_LOGIN = 0, - // A login attempt succeeded. Depending on initial conditions, this may - // cause a transition to DONE, or to wait for an explicit transition (via - // Step) to the next state. + // A login attempt succeeded. This will wait for an explicit transition + // (via Step) to the next state. GAIA_SUCCESS, + // Show the screen that lets you click either "Keep everything synced" or + // "Choose which data types to sync", and checkboxes for each data type. + CHOOSE_DATA_TYPES, + // Show the screen that lets you create a passphrase (if you've never set + // one up before). + CREATE_PASSPHRASE, + // Show the screen that lets you enter the passphrase (if you've set one up + // on another machine). + ENTER_PASSPHRASE, + // Show the screen that lets you reset your passphrase (if you forgot it). + RESET_PASSPHRASE, // The panic switch. Something went terribly wrong during setup and we // can't recover. FATAL_ERROR, @@ -62,9 +72,6 @@ class SyncSetupWizard { ProfileSyncService* service_; - // The use of ShowHtmlDialog and SyncSetupFlowContainer is disabled on Linux - // until BrowserShowHtmlDialog() is implemented. - // See: http://code.google.com/p/chromium/issues/detail?id=25260 SyncSetupFlowContainer* flow_container_; DISALLOW_COPY_AND_ASSIGN(SyncSetupWizard); diff --git a/chrome/browser/sync/sync_setup_wizard_unittest.cc b/chrome/browser/sync/sync_setup_wizard_unittest.cc index ca63f97..c20c6e5 100644 --- a/chrome/browser/sync/sync_setup_wizard_unittest.cc +++ b/chrome/browser/sync/sync_setup_wizard_unittest.cc @@ -49,6 +49,13 @@ class ProfileSyncServiceForWizardTest : public ProfileSyncService { password_ = password; captcha_ = captcha; } + + virtual void OnUserChoseDatatypes(bool sync_everything, + const syncable::ModelTypeSet& chosen_types) { + user_chose_data_types_ = true; + chosen_data_types_ = chosen_types; + } + virtual void OnUserAcceptedMergeAndSync() { user_accepted_merge_and_sync_ = true; } @@ -72,6 +79,9 @@ class ProfileSyncServiceForWizardTest : public ProfileSyncService { captcha_.clear(); user_accepted_merge_and_sync_ = false; user_cancelled_dialog_ = false; + user_chose_data_types_ = false; + keep_everything_synced_ = false; + chosen_data_types_.clear(); } std::string username_; @@ -79,6 +89,9 @@ class ProfileSyncServiceForWizardTest : public ProfileSyncService { std::string captcha_; bool user_accepted_merge_and_sync_; bool user_cancelled_dialog_; + bool user_chose_data_types_; + bool keep_everything_synced_; + syncable::ModelTypeSet chosen_data_types_; private: chrome_common_net::FakeNetworkChangeNotifierThread @@ -249,7 +262,10 @@ TEST_F(SyncSetupWizardTest, InitialStepLogin) { EXPECT_EQ(SyncSetupWizard::GAIA_LOGIN, test_window_->flow()->current_state_); dialog_args.Clear(); SyncSetupFlow::GetArgsForGaiaLogin(service_, &dialog_args); - EXPECT_EQ(4U, dialog_args.size()); + EXPECT_EQ(5U, dialog_args.size()); + std::string iframe_to_show; + dialog_args.GetString(L"iframeToShow", &iframe_to_show); + EXPECT_EQ("login", iframe_to_show); std::string actual_user; dialog_args.GetString(L"user", &actual_user); EXPECT_EQ(kTestUser, actual_user); @@ -264,7 +280,9 @@ TEST_F(SyncSetupWizardTest, InitialStepLogin) { service_->set_auth_state(kTestUser, captcha_error); wizard_->Step(SyncSetupWizard::GAIA_LOGIN); SyncSetupFlow::GetArgsForGaiaLogin(service_, &dialog_args); - EXPECT_EQ(4U, dialog_args.size()); + EXPECT_EQ(5U, dialog_args.size()); + dialog_args.GetString(L"iframeToShow", &iframe_to_show); + EXPECT_EQ("login", iframe_to_show); std::string captcha_url; dialog_args.GetString(L"captchaUrl", &captcha_url); EXPECT_EQ(kTestCaptchaUrl, GURL(captcha_url).spec()); @@ -277,15 +295,48 @@ TEST_F(SyncSetupWizardTest, InitialStepLogin) { wizard_->Step(SyncSetupWizard::GAIA_SUCCESS); EXPECT_TRUE(wizard_->IsVisible()); EXPECT_FALSE(test_window_->TestAndResetWasShowHTMLDialogCalled()); - EXPECT_EQ(SyncSetupWizard::GAIA_SUCCESS, + // In a non-discrete run, GAIA_SUCCESS immediately transitions you to + // CHOOSE_DATA_TYPES. + EXPECT_EQ(SyncSetupWizard::CHOOSE_DATA_TYPES, test_window_->flow()->current_state_); + // That's all we're testing here, just move on to DONE. We'll test the + // "choose data types" scenarios elsewhere. wizard_->Step(SyncSetupWizard::DONE); // No merge and sync. EXPECT_TRUE(wizard_->IsVisible()); EXPECT_FALSE(test_window_->TestAndResetWasShowHTMLDialogCalled()); EXPECT_EQ(SyncSetupWizard::DONE, test_window_->flow()->current_state_); } +TEST_F(SyncSetupWizardTest, ChooseDataTypesSetsPrefs) { + SKIP_TEST_ON_MACOSX(); + wizard_->Step(SyncSetupWizard::GAIA_LOGIN); + wizard_->Step(SyncSetupWizard::CHOOSE_DATA_TYPES); + + ListValue data_type_choices_value; + std::string data_type_choices = "{\"keepEverythingSynced\":false,"; + data_type_choices += "\"syncBookmarks\":true,\"syncPreferences\":true,"; + data_type_choices += "\"syncThemes\":false,\"syncPasswords\":false,"; + data_type_choices += "\"syncAutofill\":false,\"syncExtensions\":false,"; + data_type_choices += "\"syncTypedUrls\":true}"; + data_type_choices_value.Append(new StringValue(data_type_choices)); + + // Simulate the user choosing data types; bookmarks and prefs are on, the rest + // are off. + test_window_->flow()->flow_handler_->HandleChooseDataTypes( + &data_type_choices_value); + EXPECT_TRUE(wizard_->IsVisible()); + EXPECT_TRUE(test_window_->TestAndResetWasShowHTMLDialogCalled()); + EXPECT_FALSE(service_->keep_everything_synced_); + EXPECT_EQ(service_->chosen_data_types_.count(syncable::BOOKMARKS), 1U); + EXPECT_EQ(service_->chosen_data_types_.count(syncable::PREFERENCES), 1U); + EXPECT_EQ(service_->chosen_data_types_.count(syncable::THEMES), 0U); + EXPECT_EQ(service_->chosen_data_types_.count(syncable::PASSWORDS), 0U); + EXPECT_EQ(service_->chosen_data_types_.count(syncable::AUTOFILL), 0U); + EXPECT_EQ(service_->chosen_data_types_.count(syncable::EXTENSIONS), 0U); + EXPECT_EQ(service_->chosen_data_types_.count(syncable::TYPED_URLS), 1U); +} + TEST_F(SyncSetupWizardTest, DialogCancelled) { SKIP_TEST_ON_MACOSX(); wizard_->Step(SyncSetupWizard::GAIA_LOGIN); @@ -378,7 +429,10 @@ TEST_F(SyncSetupWizardTest, DiscreteRun) { wizard_->Step(SyncSetupWizard::GAIA_LOGIN); EXPECT_TRUE(wizard_->IsVisible()); SyncSetupFlow::GetArgsForGaiaLogin(service_, &dialog_args); - EXPECT_EQ(4U, dialog_args.size()); + EXPECT_EQ(5U, dialog_args.size()); + std::string iframe_to_show; + dialog_args.GetString(L"iframeToShow", &iframe_to_show); + EXPECT_EQ("login", iframe_to_show); std::string actual_user; dialog_args.GetString(L"user", &actual_user); EXPECT_EQ(kTestUser, actual_user); diff --git a/chrome/browser/sync/syncable/model_type.cc b/chrome/browser/sync/syncable/model_type.cc index a03a794..f03373e 100644 --- a/chrome/browser/sync/syncable/model_type.cc +++ b/chrome/browser/sync/syncable/model_type.cc @@ -114,6 +114,8 @@ std::string ModelTypeToString(ModelType model_type) { return "Bookmarks"; case PREFERENCES: return "Preferences"; + case PASSWORDS: + return "Passwords"; case AUTOFILL: return "Autofill"; case THEMES: @@ -122,8 +124,6 @@ std::string ModelTypeToString(ModelType model_type) { return "Typed URLs"; case EXTENSIONS: return "Extensions"; - case PASSWORDS: - return "Passwords"; case NIGORI: return "Encryption keys"; default: diff --git a/chrome/browser/views/options/content_page_view.cc b/chrome/browser/views/options/content_page_view.cc index 5a84125..71e3d5c 100644 --- a/chrome/browser/views/options/content_page_view.cc +++ b/chrome/browser/views/options/content_page_view.cc @@ -22,6 +22,7 @@ #include "chrome/browser/importer/importer_data_types.h" #include "chrome/browser/profile.h" #include "chrome/browser/sync/sync_ui_util.h" +#include "chrome/browser/sync/sync_setup_wizard.h" #include "chrome/browser/views/importer_view.h" #include "chrome/browser/views/options/customize_sync_window_view.h" #include "chrome/browser/views/options/options_group_view.h" @@ -157,7 +158,7 @@ void ContentPageView::ButtonPressed( } else if (sender == sync_customize_button_) { // sync_customize_button_ should be invisible if sync is not yet set up. DCHECK(sync_service_->HasSyncSetupCompleted()); - CustomizeSyncWindowView::Show(GetWindow()->GetNativeWindow(), profile()); + sync_service_->ShowChooseDataTypes(); } } diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index 09cca77..a12decc 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc @@ -846,6 +846,11 @@ const wchar_t kSyncLastSyncedTime[] = L"sync.last_synced_time"; // Boolean specifying whether the user finished setting up sync. const wchar_t kSyncHasSetupCompleted[] = L"sync.has_setup_completed"; +// Boolean specifying whether to automatically sync all data types (including +// future ones, as they're added). If this is true, the following preferences +// (kSyncBookmarks, kSyncPasswords, etc.) can all be ignored. +const wchar_t kKeepEverythingSynced[] = L"sync.keep_everything_synced"; + // Booleans specifying whether the user has selected to sync the following // datatypes. const wchar_t kSyncBookmarks[] = L"sync.bookmarks"; diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index 61763e0..90593f9 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h @@ -308,6 +308,7 @@ extern const wchar_t kDevToolsSplitLocation[]; extern const wchar_t kSyncLastSyncedTime[]; extern const wchar_t kSyncHasSetupCompleted[]; +extern const wchar_t kKeepEverythingSynced[]; extern const wchar_t kSyncBookmarks[]; extern const wchar_t kSyncPasswords[]; extern const wchar_t kSyncPreferences[]; diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc index 58a7a69..5bb6ba8 100644 --- a/chrome/common/url_constants.cc +++ b/chrome/common/url_constants.cc @@ -98,7 +98,7 @@ const char kChromeUIThumbnailPath[] = "thumb"; const char kSyncResourcesHost[] = "syncresources"; const char kSyncGaiaLoginPath[] = "gaialogin"; -const char kSyncMergeAndSyncPath[] = "mergeandsync"; +const char kSyncChooseDataTypesPath[] = "choosedatatypes"; const char kSyncThrobberPath[] = "throbber.png"; const char kSyncSetupFlowPath[] = "setup"; const char kSyncSetupDonePath[] = "setupdone"; diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h index d878e10..b83c928 100644 --- a/chrome/common/url_constants.h +++ b/chrome/common/url_constants.h @@ -95,6 +95,7 @@ extern const char kChromeUIThemePath[]; extern const char kSyncResourcesHost[]; extern const char kSyncGaiaLoginPath[]; extern const char kSyncMergeAndSyncPath[]; +extern const char kSyncChooseDataTypesPath[]; extern const char kSyncSetupDonePath[]; extern const char kSyncSetupFlowPath[]; extern const char kSyncThrobberPath[]; |