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/webui/sync_setup_handler.h" | 5 #include "chrome/browser/ui/webui/sync_setup_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 return false; | 118 return false; |
119 if (sync_extensions) | 119 if (sync_extensions) |
120 config->data_types.insert(syncable::EXTENSIONS); | 120 config->data_types.insert(syncable::EXTENSIONS); |
121 | 121 |
122 bool sync_typed_urls; | 122 bool sync_typed_urls; |
123 if (!result->GetBoolean("syncTypedUrls", &sync_typed_urls)) | 123 if (!result->GetBoolean("syncTypedUrls", &sync_typed_urls)) |
124 return false; | 124 return false; |
125 if (sync_typed_urls) | 125 if (sync_typed_urls) |
126 config->data_types.insert(syncable::TYPED_URLS); | 126 config->data_types.insert(syncable::TYPED_URLS); |
127 | 127 |
128 bool sync_search_engines; | |
129 if (!result->GetBoolean("syncSearchEngines", &sync_search_engines)) | |
130 return false; | |
131 if (sync_search_engines) | |
132 config->data_types.insert(syncable::SEARCH_ENGINES); | |
133 | |
134 bool sync_sessions; | 128 bool sync_sessions; |
135 if (!result->GetBoolean("syncSessions", &sync_sessions)) | 129 if (!result->GetBoolean("syncSessions", &sync_sessions)) |
136 return false; | 130 return false; |
137 if (sync_sessions) | 131 if (sync_sessions) |
138 config->data_types.insert(syncable::SESSIONS); | 132 config->data_types.insert(syncable::SESSIONS); |
139 | 133 |
140 bool sync_apps; | 134 bool sync_apps; |
141 if (!result->GetBoolean("syncApps", &sync_apps)) | 135 if (!result->GetBoolean("syncApps", &sync_apps)) |
142 return false; | 136 return false; |
143 if (sync_apps) | 137 if (sync_apps) |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 ((types.find(syncable::THEMES) != types.end()) != | 197 ((types.find(syncable::THEMES) != types.end()) != |
204 pref_service->GetBoolean(prefs::kSyncThemes)) || | 198 pref_service->GetBoolean(prefs::kSyncThemes)) || |
205 ((types.find(syncable::PASSWORDS) != types.end()) != | 199 ((types.find(syncable::PASSWORDS) != types.end()) != |
206 pref_service->GetBoolean(prefs::kSyncPasswords)) || | 200 pref_service->GetBoolean(prefs::kSyncPasswords)) || |
207 ((types.find(syncable::AUTOFILL) != types.end()) != | 201 ((types.find(syncable::AUTOFILL) != types.end()) != |
208 pref_service->GetBoolean(prefs::kSyncAutofill)) || | 202 pref_service->GetBoolean(prefs::kSyncAutofill)) || |
209 ((types.find(syncable::EXTENSIONS) != types.end()) != | 203 ((types.find(syncable::EXTENSIONS) != types.end()) != |
210 pref_service->GetBoolean(prefs::kSyncExtensions)) || | 204 pref_service->GetBoolean(prefs::kSyncExtensions)) || |
211 ((types.find(syncable::TYPED_URLS) != types.end()) != | 205 ((types.find(syncable::TYPED_URLS) != types.end()) != |
212 pref_service->GetBoolean(prefs::kSyncTypedUrls)) || | 206 pref_service->GetBoolean(prefs::kSyncTypedUrls)) || |
213 ((types.find(syncable::SEARCH_ENGINES) != types.end()) != | |
214 pref_service->GetBoolean(prefs::kSyncSearchEngines)) || | |
215 ((types.find(syncable::SESSIONS) != types.end()) != | 207 ((types.find(syncable::SESSIONS) != types.end()) != |
216 pref_service->GetBoolean(prefs::kSyncSessions)) || | 208 pref_service->GetBoolean(prefs::kSyncSessions)) || |
217 ((types.find(syncable::APPS) != types.end()) != | 209 ((types.find(syncable::APPS) != types.end()) != |
218 pref_service->GetBoolean(prefs::kSyncApps))) | 210 pref_service->GetBoolean(prefs::kSyncApps))) |
219 return true; | 211 return true; |
220 | 212 |
221 return false; | 213 return false; |
222 } | 214 } |
223 | 215 |
224 bool GetPassphrase(const std::string& json, std::string* passphrase) { | 216 bool GetPassphrase(const std::string& json, std::string* passphrase) { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 { "syncAllDataTypes", IDS_SYNC_EVERYTHING }, | 326 { "syncAllDataTypes", IDS_SYNC_EVERYTHING }, |
335 { "chooseDataTypes", IDS_SYNC_CHOOSE_DATATYPES }, | 327 { "chooseDataTypes", IDS_SYNC_CHOOSE_DATATYPES }, |
336 { "bookmarks", IDS_SYNC_DATATYPE_BOOKMARKS }, | 328 { "bookmarks", IDS_SYNC_DATATYPE_BOOKMARKS }, |
337 { "preferences", IDS_SYNC_DATATYPE_PREFERENCES }, | 329 { "preferences", IDS_SYNC_DATATYPE_PREFERENCES }, |
338 { "autofill", IDS_SYNC_DATATYPE_AUTOFILL }, | 330 { "autofill", IDS_SYNC_DATATYPE_AUTOFILL }, |
339 { "themes", IDS_SYNC_DATATYPE_THEMES }, | 331 { "themes", IDS_SYNC_DATATYPE_THEMES }, |
340 { "passwords", IDS_SYNC_DATATYPE_PASSWORDS }, | 332 { "passwords", IDS_SYNC_DATATYPE_PASSWORDS }, |
341 { "extensions", IDS_SYNC_DATATYPE_EXTENSIONS }, | 333 { "extensions", IDS_SYNC_DATATYPE_EXTENSIONS }, |
342 { "typedURLs", IDS_SYNC_DATATYPE_TYPED_URLS }, | 334 { "typedURLs", IDS_SYNC_DATATYPE_TYPED_URLS }, |
343 { "apps", IDS_SYNC_DATATYPE_APPS }, | 335 { "apps", IDS_SYNC_DATATYPE_APPS }, |
344 { "searchEngines", IDS_SYNC_DATATYPE_SEARCH_ENGINES }, | |
345 { "openTabs", IDS_SYNC_DATATYPE_TABS }, | 336 { "openTabs", IDS_SYNC_DATATYPE_TABS }, |
346 { "syncZeroDataTypesError", IDS_SYNC_ZERO_DATA_TYPES_ERROR }, | 337 { "syncZeroDataTypesError", IDS_SYNC_ZERO_DATA_TYPES_ERROR }, |
347 { "serviceUnavailableError", IDS_SYNC_SETUP_ABORTED_BY_PENDING_CLEAR }, | 338 { "serviceUnavailableError", IDS_SYNC_SETUP_ABORTED_BY_PENDING_CLEAR }, |
348 { "encryptAllLabel", IDS_SYNC_ENCRYPT_ALL_LABEL }, | 339 { "encryptAllLabel", IDS_SYNC_ENCRYPT_ALL_LABEL }, |
349 { "googleOption", IDS_SYNC_PASSPHRASE_OPT_GOOGLE }, | 340 { "googleOption", IDS_SYNC_PASSPHRASE_OPT_GOOGLE }, |
350 { "explicitOption", IDS_SYNC_PASSPHRASE_OPT_EXPLICIT }, | 341 { "explicitOption", IDS_SYNC_PASSPHRASE_OPT_EXPLICIT }, |
351 { "sectionGoogleMessage", IDS_SYNC_PASSPHRASE_MSG_GOOGLE }, | 342 { "sectionGoogleMessage", IDS_SYNC_PASSPHRASE_MSG_GOOGLE }, |
352 { "sectionExplicitMessage", IDS_SYNC_PASSPHRASE_MSG_EXPLICIT }, | 343 { "sectionExplicitMessage", IDS_SYNC_PASSPHRASE_MSG_EXPLICIT }, |
353 { "passphraseLabel", IDS_SYNC_PASSPHRASE_LABEL }, | 344 { "passphraseLabel", IDS_SYNC_PASSPHRASE_LABEL }, |
354 { "confirmLabel", IDS_SYNC_CONFIRM_PASSPHRASE_LABEL }, | 345 { "confirmLabel", IDS_SYNC_CONFIRM_PASSPHRASE_LABEL }, |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncThemes", | 578 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncThemes", |
588 types.find(syncable::THEMES) != types.end()); | 579 types.find(syncable::THEMES) != types.end()); |
589 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncPasswords", | 580 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncPasswords", |
590 types.find(syncable::PASSWORDS) != types.end()); | 581 types.find(syncable::PASSWORDS) != types.end()); |
591 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncAutofill", | 582 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncAutofill", |
592 types.find(syncable::AUTOFILL) != types.end()); | 583 types.find(syncable::AUTOFILL) != types.end()); |
593 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncExtensions", | 584 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncExtensions", |
594 types.find(syncable::EXTENSIONS) != types.end()); | 585 types.find(syncable::EXTENSIONS) != types.end()); |
595 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncTypedUrls", | 586 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncTypedUrls", |
596 types.find(syncable::TYPED_URLS) != types.end()); | 587 types.find(syncable::TYPED_URLS) != types.end()); |
597 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncSearchEngines", | |
598 types.find(syncable::SEARCH_ENGINES) != types.end()); | |
599 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncSessions", | 588 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncSessions", |
600 types.find(syncable::SESSIONS) != types.end()); | 589 types.find(syncable::SESSIONS) != types.end()); |
601 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncApps", | 590 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncApps", |
602 types.find(syncable::APPS) != types.end()); | 591 types.find(syncable::APPS) != types.end()); |
603 COMPILE_ASSERT(17 == syncable::MODEL_TYPE_COUNT, | 592 COMPILE_ASSERT(17 == syncable::MODEL_TYPE_COUNT, |
604 UpdateCustomConfigHistogram); | 593 UpdateCustomConfigHistogram); |
605 } | 594 } |
606 UMA_HISTOGRAM_BOOLEAN("Sync.EncryptAllData", configuration.encrypt_all); | 595 UMA_HISTOGRAM_BOOLEAN("Sync.EncryptAllData", configuration.encrypt_all); |
607 UMA_HISTOGRAM_BOOLEAN("Sync.CustomPassphrase", | 596 UMA_HISTOGRAM_BOOLEAN("Sync.CustomPassphrase", |
608 configuration.set_gaia_passphrase || | 597 configuration.set_gaia_passphrase || |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 } | 740 } |
752 | 741 |
753 void SyncSetupHandler::ShowLoginErrorMessage(const string16& error_message) { | 742 void SyncSetupHandler::ShowLoginErrorMessage(const string16& error_message) { |
754 DictionaryValue args; | 743 DictionaryValue args; |
755 Profile* profile = Profile::FromWebUI(web_ui_); | 744 Profile* profile = Profile::FromWebUI(web_ui_); |
756 ProfileSyncService* service = profile->GetProfileSyncService(); | 745 ProfileSyncService* service = profile->GetProfileSyncService(); |
757 SyncSetupFlow::GetArgsForGaiaLogin(service, &args); | 746 SyncSetupFlow::GetArgsForGaiaLogin(service, &args); |
758 args.SetString("error_message", error_message); | 747 args.SetString("error_message", error_message); |
759 ShowGaiaLogin(args); | 748 ShowGaiaLogin(args); |
760 } | 749 } |
OLD | NEW |