| 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/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/command_line.h" |
| 8 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 9 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| 10 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 11 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 12 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 13 #include "base/values.h" | 14 #include "base/values.h" |
| 14 #include "chrome/browser/platform_util.h" | 15 #include "chrome/browser/platform_util.h" |
| 15 #include "chrome/browser/prefs/pref_service.h" | 16 #include "chrome/browser/prefs/pref_service.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/sync/profile_sync_service.h" | 18 #include "chrome/browser/sync/profile_sync_service.h" |
| 18 #include "chrome/browser/sync/syncable/model_type.h" | 19 #include "chrome/browser/sync/syncable/model_type.h" |
| 19 #include "chrome/browser/sync/sync_setup_flow_handler.h" | 20 #include "chrome/browser/sync/sync_setup_flow_handler.h" |
| 20 #include "chrome/browser/ui/browser.h" | 21 #include "chrome/browser/ui/browser.h" |
| 21 #include "chrome/browser/ui/browser_dialogs.h" | 22 #include "chrome/browser/ui/browser_dialogs.h" |
| 22 #include "chrome/browser/ui/browser_list.h" | 23 #include "chrome/browser/ui/browser_list.h" |
| 24 #include "chrome/common/chrome_switches.h" |
| 23 #include "chrome/common/net/gaia/google_service_auth_error.h" | 25 #include "chrome/common/net/gaia/google_service_auth_error.h" |
| 24 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
| 25 #include "chrome/common/url_constants.h" | 27 #include "chrome/common/url_constants.h" |
| 26 #include "content/browser/renderer_host/render_view_host.h" | 28 #include "content/browser/renderer_host/render_view_host.h" |
| 27 #include "content/browser/tab_contents/tab_contents.h" | 29 #include "content/browser/tab_contents/tab_contents.h" |
| 28 #include "grit/generated_resources.h" | 30 #include "grit/generated_resources.h" |
| 29 #include "grit/locale_settings.h" | 31 #include "grit/locale_settings.h" |
| 30 #include "ui/base/l10n/l10n_font_util.h" | 32 #include "ui/base/l10n/l10n_font_util.h" |
| 31 #include "ui/gfx/font.h" | 33 #include "ui/gfx/font.h" |
| 32 | 34 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 args->SetBoolean("syncAutofill", | 137 args->SetBoolean("syncAutofill", |
| 136 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncAutofill)); | 138 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncAutofill)); |
| 137 args->SetBoolean("syncExtensions", | 139 args->SetBoolean("syncExtensions", |
| 138 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncExtensions)); | 140 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncExtensions)); |
| 139 args->SetBoolean("syncSessions", | 141 args->SetBoolean("syncSessions", |
| 140 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncSessions)); | 142 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncSessions)); |
| 141 args->SetBoolean("syncTypedUrls", | 143 args->SetBoolean("syncTypedUrls", |
| 142 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncTypedUrls)); | 144 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncTypedUrls)); |
| 143 args->SetBoolean("syncApps", | 145 args->SetBoolean("syncApps", |
| 144 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncApps)); | 146 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncApps)); |
| 147 args->SetBoolean("encryptionEnabled", |
| 148 CommandLine::ForCurrentProcess()->HasSwitch( |
| 149 switches::kEnableSyncEncryption)); |
| 145 | 150 |
| 146 syncable::ModelTypeSet encrypted_types; | 151 syncable::ModelTypeSet encrypted_types; |
| 147 service->GetEncryptedDataTypes(&encrypted_types); | 152 service->GetEncryptedDataTypes(&encrypted_types); |
| 148 bool encrypt_all = std::equal( | 153 bool encrypt_all = std::equal( |
| 149 encrypted_types.begin(), encrypted_types.end(), registered_types.begin()); | 154 encrypted_types.begin(), encrypted_types.end(), registered_types.begin()); |
| 150 args->SetBoolean("encryptAllData", encrypt_all); | 155 args->SetBoolean("encryptAllData", encrypt_all); |
| 151 | 156 |
| 152 // Load the parameters for the encryption tab. | 157 // Load the parameters for the encryption tab. |
| 153 args->SetBoolean("usePassphrase", service->IsUsingSecondaryPassphrase()); | 158 args->SetBoolean("usePassphrase", service->IsUsingSecondaryPassphrase()); |
| 154 } | 159 } |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 } | 391 } |
| 387 case SyncSetupWizard::DONE: | 392 case SyncSetupWizard::DONE: |
| 388 flow_handler_->ShowSetupDone( | 393 flow_handler_->ShowSetupDone( |
| 389 UTF16ToWide(service_->GetAuthenticatedUsername())); | 394 UTF16ToWide(service_->GetAuthenticatedUsername())); |
| 390 break; | 395 break; |
| 391 default: | 396 default: |
| 392 NOTREACHED() << "Invalid advance state: " << state; | 397 NOTREACHED() << "Invalid advance state: " << state; |
| 393 } | 398 } |
| 394 current_state_ = state; | 399 current_state_ = state; |
| 395 } | 400 } |
| OLD | NEW |