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

Side by Side Diff: chrome/browser/ui/webui/sync_setup_handler.cc

Issue 8334030: Merge search engines sync data type with Preferences. Sync the default search provider. Add some ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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/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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 return false; 117 return false;
118 if (sync_extensions) 118 if (sync_extensions)
119 config->data_types.insert(syncable::EXTENSIONS); 119 config->data_types.insert(syncable::EXTENSIONS);
120 120
121 bool sync_typed_urls; 121 bool sync_typed_urls;
122 if (!result->GetBoolean("syncTypedUrls", &sync_typed_urls)) 122 if (!result->GetBoolean("syncTypedUrls", &sync_typed_urls))
123 return false; 123 return false;
124 if (sync_typed_urls) 124 if (sync_typed_urls)
125 config->data_types.insert(syncable::TYPED_URLS); 125 config->data_types.insert(syncable::TYPED_URLS);
126 126
127 bool sync_search_engines;
128 if (!result->GetBoolean("syncSearchEngines", &sync_search_engines))
129 return false;
130 if (sync_search_engines)
131 config->data_types.insert(syncable::SEARCH_ENGINES);
132
133 bool sync_sessions; 127 bool sync_sessions;
134 if (!result->GetBoolean("syncSessions", &sync_sessions)) 128 if (!result->GetBoolean("syncSessions", &sync_sessions))
135 return false; 129 return false;
136 if (sync_sessions) 130 if (sync_sessions)
137 config->data_types.insert(syncable::SESSIONS); 131 config->data_types.insert(syncable::SESSIONS);
138 132
139 bool sync_apps; 133 bool sync_apps;
140 if (!result->GetBoolean("syncApps", &sync_apps)) 134 if (!result->GetBoolean("syncApps", &sync_apps))
141 return false; 135 return false;
142 if (sync_apps) 136 if (sync_apps)
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 pref_service->GetBoolean(prefs::kSyncThemes)) || 197 pref_service->GetBoolean(prefs::kSyncThemes)) ||
204 (types.find(syncable::PASSWORDS) == types.end() && 198 (types.find(syncable::PASSWORDS) == types.end() &&
205 pref_service->GetBoolean(prefs::kSyncPasswords)) || 199 pref_service->GetBoolean(prefs::kSyncPasswords)) ||
206 (types.find(syncable::AUTOFILL) == types.end() && 200 (types.find(syncable::AUTOFILL) == types.end() &&
207 pref_service->GetBoolean(prefs::kSyncAutofill)) || 201 pref_service->GetBoolean(prefs::kSyncAutofill)) ||
208 (types.find(syncable::EXTENSIONS) == types.end() && 202 (types.find(syncable::EXTENSIONS) == types.end() &&
209 pref_service->GetBoolean(prefs::kSyncExtensions)) || 203 pref_service->GetBoolean(prefs::kSyncExtensions)) ||
210 (types.find(syncable::TYPED_URLS) == types.end() && 204 (types.find(syncable::TYPED_URLS) == types.end() &&
211 pref_service->GetBoolean(prefs::kSyncTypedUrls)) || 205 pref_service->GetBoolean(prefs::kSyncTypedUrls)) ||
212 (types.find(syncable::SEARCH_ENGINES) == types.end() && 206 (types.find(syncable::SEARCH_ENGINES) == types.end() &&
213 pref_service->GetBoolean(prefs::kSyncSearchEngines)) || 207 pref_service->GetBoolean(prefs::kSyncSearchEngines)) ||
Raghu Simha 2011/11/09 00:22:53 Delete this line.
SteveT 2011/11/09 16:33:18 Done.
214 (types.find(syncable::SESSIONS) == types.end() && 208 (types.find(syncable::SESSIONS) == types.end() &&
215 pref_service->GetBoolean(prefs::kSyncSessions)) || 209 pref_service->GetBoolean(prefs::kSyncSessions)) ||
216 (types.find(syncable::APPS) == types.end() && 210 (types.find(syncable::APPS) == types.end() &&
217 pref_service->GetBoolean(prefs::kSyncApps))) 211 pref_service->GetBoolean(prefs::kSyncApps)))
218 return true; 212 return true;
219 213
220 return false; 214 return false;
221 } 215 }
222 216
223 bool GetPassphrase(const std::string& json, std::string* passphrase) { 217 bool GetPassphrase(const std::string& json, std::string* passphrase) {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 { "syncAllDataTypes", IDS_SYNC_EVERYTHING }, 317 { "syncAllDataTypes", IDS_SYNC_EVERYTHING },
324 { "chooseDataTypes", IDS_SYNC_CHOOSE_DATATYPES }, 318 { "chooseDataTypes", IDS_SYNC_CHOOSE_DATATYPES },
325 { "bookmarks", IDS_SYNC_DATATYPE_BOOKMARKS }, 319 { "bookmarks", IDS_SYNC_DATATYPE_BOOKMARKS },
326 { "preferences", IDS_SYNC_DATATYPE_PREFERENCES }, 320 { "preferences", IDS_SYNC_DATATYPE_PREFERENCES },
327 { "autofill", IDS_SYNC_DATATYPE_AUTOFILL }, 321 { "autofill", IDS_SYNC_DATATYPE_AUTOFILL },
328 { "themes", IDS_SYNC_DATATYPE_THEMES }, 322 { "themes", IDS_SYNC_DATATYPE_THEMES },
329 { "passwords", IDS_SYNC_DATATYPE_PASSWORDS }, 323 { "passwords", IDS_SYNC_DATATYPE_PASSWORDS },
330 { "extensions", IDS_SYNC_DATATYPE_EXTENSIONS }, 324 { "extensions", IDS_SYNC_DATATYPE_EXTENSIONS },
331 { "typedURLs", IDS_SYNC_DATATYPE_TYPED_URLS }, 325 { "typedURLs", IDS_SYNC_DATATYPE_TYPED_URLS },
332 { "apps", IDS_SYNC_DATATYPE_APPS }, 326 { "apps", IDS_SYNC_DATATYPE_APPS },
333 { "searchEngines", IDS_SYNC_DATATYPE_SEARCH_ENGINES },
334 { "openTabs", IDS_SYNC_DATATYPE_TABS }, 327 { "openTabs", IDS_SYNC_DATATYPE_TABS },
335 { "syncZeroDataTypesError", IDS_SYNC_ZERO_DATA_TYPES_ERROR }, 328 { "syncZeroDataTypesError", IDS_SYNC_ZERO_DATA_TYPES_ERROR },
336 { "serviceUnavailableError", IDS_SYNC_SETUP_ABORTED_BY_PENDING_CLEAR }, 329 { "serviceUnavailableError", IDS_SYNC_SETUP_ABORTED_BY_PENDING_CLEAR },
337 { "encryptAllLabel", IDS_SYNC_ENCRYPT_ALL_LABEL }, 330 { "encryptAllLabel", IDS_SYNC_ENCRYPT_ALL_LABEL },
338 { "googleOption", IDS_SYNC_PASSPHRASE_OPT_GOOGLE }, 331 { "googleOption", IDS_SYNC_PASSPHRASE_OPT_GOOGLE },
339 { "explicitOption", IDS_SYNC_PASSPHRASE_OPT_EXPLICIT }, 332 { "explicitOption", IDS_SYNC_PASSPHRASE_OPT_EXPLICIT },
340 { "sectionGoogleMessage", IDS_SYNC_PASSPHRASE_MSG_GOOGLE }, 333 { "sectionGoogleMessage", IDS_SYNC_PASSPHRASE_MSG_GOOGLE },
341 { "sectionExplicitMessage", IDS_SYNC_PASSPHRASE_MSG_EXPLICIT }, 334 { "sectionExplicitMessage", IDS_SYNC_PASSPHRASE_MSG_EXPLICIT },
342 { "passphraseLabel", IDS_SYNC_PASSPHRASE_LABEL }, 335 { "passphraseLabel", IDS_SYNC_PASSPHRASE_LABEL },
343 { "confirmLabel", IDS_SYNC_CONFIRM_PASSPHRASE_LABEL }, 336 { "confirmLabel", IDS_SYNC_CONFIRM_PASSPHRASE_LABEL },
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 types.find(syncable::THEMES) != types.end()); 570 types.find(syncable::THEMES) != types.end());
578 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncPasswords", 571 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncPasswords",
579 types.find(syncable::PASSWORDS) != types.end()); 572 types.find(syncable::PASSWORDS) != types.end());
580 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncAutofill", 573 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncAutofill",
581 types.find(syncable::AUTOFILL) != types.end()); 574 types.find(syncable::AUTOFILL) != types.end());
582 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncExtensions", 575 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncExtensions",
583 types.find(syncable::EXTENSIONS) != types.end()); 576 types.find(syncable::EXTENSIONS) != types.end());
584 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncTypedUrls", 577 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncTypedUrls",
585 types.find(syncable::TYPED_URLS) != types.end()); 578 types.find(syncable::TYPED_URLS) != types.end());
586 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncSearchEngines", 579 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncSearchEngines",
587 types.find(syncable::SEARCH_ENGINES) != types.end()); 580 types.find(syncable::SEARCH_ENGINES) != types.end());
Raghu Simha 2011/11/09 00:22:53 Delete this line.
SteveT 2011/11/09 16:33:18 Done.
588 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncSessions", 581 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncSessions",
589 types.find(syncable::SESSIONS) != types.end()); 582 types.find(syncable::SESSIONS) != types.end());
590 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncApps", 583 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncApps",
591 types.find(syncable::APPS) != types.end()); 584 types.find(syncable::APPS) != types.end());
592 COMPILE_ASSERT(17 == syncable::MODEL_TYPE_COUNT, 585 COMPILE_ASSERT(17 == syncable::MODEL_TYPE_COUNT,
593 UpdateCustomConfigHistogram); 586 UpdateCustomConfigHistogram);
594 } 587 }
595 UMA_HISTOGRAM_BOOLEAN("Sync.EncryptAllData", configuration.encrypt_all); 588 UMA_HISTOGRAM_BOOLEAN("Sync.EncryptAllData", configuration.encrypt_all);
596 UMA_HISTOGRAM_BOOLEAN("Sync.CustomPassphrase", 589 UMA_HISTOGRAM_BOOLEAN("Sync.CustomPassphrase",
597 configuration.set_gaia_passphrase || 590 configuration.set_gaia_passphrase ||
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 } 733 }
741 734
742 void SyncSetupHandler::ShowLoginErrorMessage(const string16& error_message) { 735 void SyncSetupHandler::ShowLoginErrorMessage(const string16& error_message) {
743 DictionaryValue args; 736 DictionaryValue args;
744 Profile* profile = Profile::FromWebUI(web_ui_); 737 Profile* profile = Profile::FromWebUI(web_ui_);
745 ProfileSyncService* service = profile->GetProfileSyncService(); 738 ProfileSyncService* service = profile->GetProfileSyncService();
746 SyncSetupFlow::GetArgsForGaiaLogin(service, &args); 739 SyncSetupFlow::GetArgsForGaiaLogin(service, &args);
747 args.SetString("error_message", error_message); 740 args.SetString("error_message", error_message);
748 ShowGaiaLogin(args); 741 ShowGaiaLogin(args);
749 } 742 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/personal_options_handler.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698