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

Side by Side Diff: chrome/browser/sync/sync_setup_flow.cc

Issue 7056021: Sync: Add encryption customization radio. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 months 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/sync/sync_setup_flow.h" 5 #include "chrome/browser/sync/sync_setup_flow.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/platform_util.h" 14 #include "chrome/browser/platform_util.h"
15 #include "chrome/browser/prefs/pref_service.h" 15 #include "chrome/browser/prefs/pref_service.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/sync/profile_sync_service.h" 17 #include "chrome/browser/sync/profile_sync_service.h"
18 #include "chrome/browser/sync/syncable/model_type.h"
18 #include "chrome/browser/sync/sync_setup_flow_handler.h" 19 #include "chrome/browser/sync/sync_setup_flow_handler.h"
19 #include "chrome/browser/ui/browser.h" 20 #include "chrome/browser/ui/browser.h"
20 #include "chrome/browser/ui/browser_dialogs.h" 21 #include "chrome/browser/ui/browser_dialogs.h"
21 #include "chrome/browser/ui/browser_list.h" 22 #include "chrome/browser/ui/browser_list.h"
22 #include "chrome/common/net/gaia/google_service_auth_error.h" 23 #include "chrome/common/net/gaia/google_service_auth_error.h"
23 #include "chrome/common/pref_names.h" 24 #include "chrome/common/pref_names.h"
24 #include "chrome/common/url_constants.h" 25 #include "chrome/common/url_constants.h"
25 #include "content/browser/renderer_host/render_view_host.h" 26 #include "content/browser/renderer_host/render_view_host.h"
26 #include "content/browser/tab_contents/tab_contents.h" 27 #include "content/browser/tab_contents/tab_contents.h"
27 #include "grit/generated_resources.h" 28 #include "grit/generated_resources.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncAutofill)); 136 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncAutofill));
136 args->SetBoolean("syncExtensions", 137 args->SetBoolean("syncExtensions",
137 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncExtensions)); 138 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncExtensions));
138 args->SetBoolean("syncSessions", 139 args->SetBoolean("syncSessions",
139 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncSessions)); 140 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncSessions));
140 args->SetBoolean("syncTypedUrls", 141 args->SetBoolean("syncTypedUrls",
141 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncTypedUrls)); 142 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncTypedUrls));
142 args->SetBoolean("syncApps", 143 args->SetBoolean("syncApps",
143 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncApps)); 144 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncApps));
144 145
146 syncable::ModelTypeSet encrypted_types;
147 service->GetEncryptedDataTypes(&encrypted_types);
148 bool encrypt_all = std::equal(
149 encrypted_types.begin(), encrypted_types.end(), registered_types.begin());
Nicolas Zea 2011/05/22 00:10:32 Thinking about this further, I'm hesitant about th
James Hawkins 2011/05/23 21:25:45 Done.
150 args->SetBoolean("encryptAllData", encrypt_all);
151
145 // Load the parameters for the encryption tab. 152 // Load the parameters for the encryption tab.
146 args->SetBoolean("usePassphrase", service->IsUsingSecondaryPassphrase()); 153 args->SetBoolean("usePassphrase", service->IsUsingSecondaryPassphrase());
147 } 154 }
148 155
149 // static 156 // static
150 void SyncSetupFlow::GetArgsForEnterPassphrase( 157 void SyncSetupFlow::GetArgsForEnterPassphrase(
151 bool tried_creating_explicit_passphrase, 158 bool tried_creating_explicit_passphrase,
152 bool tried_setting_explicit_passphrase, 159 bool tried_setting_explicit_passphrase,
153 DictionaryValue* args) { 160 DictionaryValue* args) {
154 args->SetBoolean("passphrase_creation_rejected", 161 args->SetBoolean("passphrase_creation_rejected",
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 const std::string& password, 227 const std::string& password,
221 const std::string& captcha, 228 const std::string& captcha,
222 const std::string& access_code) { 229 const std::string& access_code) {
223 service_->OnUserSubmittedAuth(username, password, captcha, access_code); 230 service_->OnUserSubmittedAuth(username, password, captcha, access_code);
224 } 231 }
225 232
226 void SyncSetupFlow::OnUserConfigured(const SyncConfiguration& configuration) { 233 void SyncSetupFlow::OnUserConfigured(const SyncConfiguration& configuration) {
227 // Go to the "loading..." screen. 234 // Go to the "loading..." screen.
228 Advance(SyncSetupWizard::SETTING_UP); 235 Advance(SyncSetupWizard::SETTING_UP);
229 236
237 if (configuration.encrypt_all) {
238 syncable::ModelTypeSet data_types;
239 service_->GetRegisteredDataTypes(&data_types);
240 service_->EncryptDataTypes(data_types);
241 }
242
230 // If we are activating the passphrase, we need to have one supplied. 243 // If we are activating the passphrase, we need to have one supplied.
231 DCHECK(service_->IsUsingSecondaryPassphrase() || 244 DCHECK(service_->IsUsingSecondaryPassphrase() ||
232 !configuration.use_secondary_passphrase || 245 !configuration.use_secondary_passphrase ||
233 configuration.secondary_passphrase.length() > 0); 246 configuration.secondary_passphrase.length() > 0);
234 247
235 if (configuration.use_secondary_passphrase && 248 if (configuration.use_secondary_passphrase &&
236 !service_->IsUsingSecondaryPassphrase()) { 249 !service_->IsUsingSecondaryPassphrase()) {
237 service_->SetPassphrase(configuration.secondary_passphrase, true, true); 250 service_->SetPassphrase(configuration.secondary_passphrase, true, true);
238 tried_creating_explicit_passphrase_ = true; 251 tried_creating_explicit_passphrase_ = true;
239 } 252 }
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 } 386 }
374 case SyncSetupWizard::DONE: 387 case SyncSetupWizard::DONE:
375 flow_handler_->ShowSetupDone( 388 flow_handler_->ShowSetupDone(
376 UTF16ToWide(service_->GetAuthenticatedUsername())); 389 UTF16ToWide(service_->GetAuthenticatedUsername()));
377 break; 390 break;
378 default: 391 default:
379 NOTREACHED() << "Invalid advance state: " << state; 392 NOTREACHED() << "Invalid advance state: " << state;
380 } 393 }
381 current_state_ = state; 394 current_state_ = state;
382 } 395 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/sync_setup_flow.h ('k') | chrome/browser/ui/webui/options/sync_setup_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698