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

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

Issue 8479026: Make it so that turning off sync for extensions in the preferences UI also (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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 bool sync_autofill; 110 bool sync_autofill;
111 if (!result->GetBoolean("syncAutofill", &sync_autofill)) 111 if (!result->GetBoolean("syncAutofill", &sync_autofill))
112 return false; 112 return false;
113 if (sync_autofill) 113 if (sync_autofill)
114 config->data_types.insert(syncable::AUTOFILL); 114 config->data_types.insert(syncable::AUTOFILL);
115 115
116 bool sync_extensions; 116 bool sync_extensions;
117 if (!result->GetBoolean("syncExtensions", &sync_extensions)) 117 if (!result->GetBoolean("syncExtensions", &sync_extensions))
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 config->data_types.insert(syncable::EXTENSION_SETTINGS);
122 }
121 123
122 bool sync_typed_urls; 124 bool sync_typed_urls;
123 if (!result->GetBoolean("syncTypedUrls", &sync_typed_urls)) 125 if (!result->GetBoolean("syncTypedUrls", &sync_typed_urls))
124 return false; 126 return false;
125 if (sync_typed_urls) 127 if (sync_typed_urls)
126 config->data_types.insert(syncable::TYPED_URLS); 128 config->data_types.insert(syncable::TYPED_URLS);
127 129
128 bool sync_search_engines; 130 bool sync_search_engines;
129 if (!result->GetBoolean("syncSearchEngines", &sync_search_engines)) 131 if (!result->GetBoolean("syncSearchEngines", &sync_search_engines))
130 return false; 132 return false;
131 if (sync_search_engines) 133 if (sync_search_engines)
132 config->data_types.insert(syncable::SEARCH_ENGINES); 134 config->data_types.insert(syncable::SEARCH_ENGINES);
133 135
134 bool sync_sessions; 136 bool sync_sessions;
135 if (!result->GetBoolean("syncSessions", &sync_sessions)) 137 if (!result->GetBoolean("syncSessions", &sync_sessions))
136 return false; 138 return false;
137 if (sync_sessions) 139 if (sync_sessions)
138 config->data_types.insert(syncable::SESSIONS); 140 config->data_types.insert(syncable::SESSIONS);
139 141
140 bool sync_apps; 142 bool sync_apps;
141 if (!result->GetBoolean("syncApps", &sync_apps)) 143 if (!result->GetBoolean("syncApps", &sync_apps))
142 return false; 144 return false;
143 if (sync_apps) 145 if (sync_apps) {
144 config->data_types.insert(syncable::APPS); 146 config->data_types.insert(syncable::APPS);
147 config->data_types.insert(syncable::APP_SETTINGS);
148 }
145 149
146 // Encryption settings. 150 // Encryption settings.
147 if (!result->GetBoolean("encryptAllData", &config->encrypt_all)) 151 if (!result->GetBoolean("encryptAllData", &config->encrypt_all))
148 return false; 152 return false;
149 153
150 // Passphrase settings. 154 // Passphrase settings.
151 bool have_passphrase; 155 bool have_passphrase;
152 if (!result->GetBoolean("usePassphrase", &have_passphrase)) 156 if (!result->GetBoolean("usePassphrase", &have_passphrase))
153 return false; 157 return false;
154 158
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 ((types.find(syncable::PREFERENCES) != types.end()) != 205 ((types.find(syncable::PREFERENCES) != types.end()) !=
202 pref_service->GetBoolean(prefs::kSyncPreferences)) || 206 pref_service->GetBoolean(prefs::kSyncPreferences)) ||
203 ((types.find(syncable::THEMES) != types.end()) != 207 ((types.find(syncable::THEMES) != types.end()) !=
204 pref_service->GetBoolean(prefs::kSyncThemes)) || 208 pref_service->GetBoolean(prefs::kSyncThemes)) ||
205 ((types.find(syncable::PASSWORDS) != types.end()) != 209 ((types.find(syncable::PASSWORDS) != types.end()) !=
206 pref_service->GetBoolean(prefs::kSyncPasswords)) || 210 pref_service->GetBoolean(prefs::kSyncPasswords)) ||
207 ((types.find(syncable::AUTOFILL) != types.end()) != 211 ((types.find(syncable::AUTOFILL) != types.end()) !=
208 pref_service->GetBoolean(prefs::kSyncAutofill)) || 212 pref_service->GetBoolean(prefs::kSyncAutofill)) ||
209 ((types.find(syncable::EXTENSIONS) != types.end()) != 213 ((types.find(syncable::EXTENSIONS) != types.end()) !=
210 pref_service->GetBoolean(prefs::kSyncExtensions)) || 214 pref_service->GetBoolean(prefs::kSyncExtensions)) ||
215 ((types.find(syncable::EXTENSION_SETTINGS) != types.end()) !=
216 pref_service->GetBoolean(prefs::kSyncExtensionSettings)) ||
211 ((types.find(syncable::TYPED_URLS) != types.end()) != 217 ((types.find(syncable::TYPED_URLS) != types.end()) !=
212 pref_service->GetBoolean(prefs::kSyncTypedUrls)) || 218 pref_service->GetBoolean(prefs::kSyncTypedUrls)) ||
213 ((types.find(syncable::SEARCH_ENGINES) != types.end()) != 219 ((types.find(syncable::SEARCH_ENGINES) != types.end()) !=
214 pref_service->GetBoolean(prefs::kSyncSearchEngines)) || 220 pref_service->GetBoolean(prefs::kSyncSearchEngines)) ||
215 ((types.find(syncable::SESSIONS) != types.end()) != 221 ((types.find(syncable::SESSIONS) != types.end()) !=
216 pref_service->GetBoolean(prefs::kSyncSessions)) || 222 pref_service->GetBoolean(prefs::kSyncSessions)) ||
217 ((types.find(syncable::APPS) != types.end()) != 223 ((types.find(syncable::APPS) != types.end()) !=
218 pref_service->GetBoolean(prefs::kSyncApps))) 224 pref_service->GetBoolean(prefs::kSyncApps)) ||
225 ((types.find(syncable::APP_SETTINGS) != types.end()) !=
226 pref_service->GetBoolean(prefs::kSyncAppSettings)))
219 return true; 227 return true;
220 228
221 return false; 229 return false;
222 } 230 }
223 231
224 bool GetPassphrase(const std::string& json, std::string* passphrase) { 232 bool GetPassphrase(const std::string& json, std::string* passphrase) {
225 scoped_ptr<Value> parsed_value(base::JSONReader::Read(json, false)); 233 scoped_ptr<Value> parsed_value(base::JSONReader::Read(json, false));
226 if (!parsed_value.get() || !parsed_value->IsType(Value::TYPE_DICTIONARY)) 234 if (!parsed_value.get() || !parsed_value->IsType(Value::TYPE_DICTIONARY))
227 return false; 235 return false;
228 236
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncPreferences", 593 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncPreferences",
586 types.find(syncable::PREFERENCES) != types.end()); 594 types.find(syncable::PREFERENCES) != types.end());
587 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncThemes", 595 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncThemes",
588 types.find(syncable::THEMES) != types.end()); 596 types.find(syncable::THEMES) != types.end());
589 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncPasswords", 597 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncPasswords",
590 types.find(syncable::PASSWORDS) != types.end()); 598 types.find(syncable::PASSWORDS) != types.end());
591 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncAutofill", 599 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncAutofill",
592 types.find(syncable::AUTOFILL) != types.end()); 600 types.find(syncable::AUTOFILL) != types.end());
593 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncExtensions", 601 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncExtensions",
594 types.find(syncable::EXTENSIONS) != types.end()); 602 types.find(syncable::EXTENSIONS) != types.end());
603 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncExtensionSettings",
604 types.find(syncable::EXTENSION_SETTINGS) != types.end());
595 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncTypedUrls", 605 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncTypedUrls",
596 types.find(syncable::TYPED_URLS) != types.end()); 606 types.find(syncable::TYPED_URLS) != types.end());
597 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncSearchEngines", 607 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncSearchEngines",
598 types.find(syncable::SEARCH_ENGINES) != types.end()); 608 types.find(syncable::SEARCH_ENGINES) != types.end());
599 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncSessions", 609 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncSessions",
600 types.find(syncable::SESSIONS) != types.end()); 610 types.find(syncable::SESSIONS) != types.end());
601 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncApps", 611 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncApps",
602 types.find(syncable::APPS) != types.end()); 612 types.find(syncable::APPS) != types.end());
613 UMA_HISTOGRAM_BOOLEAN("Sync.CustomSyncAppSettings",
614 types.find(syncable::APP_SETTINGS) != types.end());
603 COMPILE_ASSERT(17 == syncable::MODEL_TYPE_COUNT, 615 COMPILE_ASSERT(17 == syncable::MODEL_TYPE_COUNT,
604 UpdateCustomConfigHistogram); 616 UpdateCustomConfigHistogram);
605 } 617 }
606 UMA_HISTOGRAM_BOOLEAN("Sync.EncryptAllData", configuration.encrypt_all); 618 UMA_HISTOGRAM_BOOLEAN("Sync.EncryptAllData", configuration.encrypt_all);
607 UMA_HISTOGRAM_BOOLEAN("Sync.CustomPassphrase", 619 UMA_HISTOGRAM_BOOLEAN("Sync.CustomPassphrase",
608 configuration.set_gaia_passphrase || 620 configuration.set_gaia_passphrase ||
609 configuration.set_secondary_passphrase); 621 configuration.set_secondary_passphrase);
610 } 622 }
611 } 623 }
612 624
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 } 755 }
744 756
745 void SyncSetupHandler::ShowLoginErrorMessage(const string16& error_message) { 757 void SyncSetupHandler::ShowLoginErrorMessage(const string16& error_message) {
746 DictionaryValue args; 758 DictionaryValue args;
747 Profile* profile = Profile::FromWebUI(web_ui_); 759 Profile* profile = Profile::FromWebUI(web_ui_);
748 ProfileSyncService* service = profile->GetProfileSyncService(); 760 ProfileSyncService* service = profile->GetProfileSyncService();
749 SyncSetupFlow::GetArgsForGaiaLogin(service, &args); 761 SyncSetupFlow::GetArgsForGaiaLogin(service, &args);
750 args.SetString("error_message", error_message); 762 args.SetString("error_message", error_message);
751 ShowGaiaLogin(args); 763 ShowGaiaLogin(args);
752 } 764 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698