| 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/command_line.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 11 matching lines...) Expand all Loading... |
| 22 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
| 23 #include "chrome/common/net/gaia/google_service_auth_error.h" | 23 #include "chrome/common/net/gaia/google_service_auth_error.h" |
| 24 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
| 25 #include "chrome/common/url_constants.h" | 25 #include "chrome/common/url_constants.h" |
| 26 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
| 27 | 27 |
| 28 namespace { | 28 namespace { |
| 29 | 29 |
| 30 // Helper function to disable password sync. | 30 // Helper function to disable password sync. |
| 31 void DisablePasswordSync(ProfileSyncService* service) { | 31 void DisablePasswordSync(ProfileSyncService* service) { |
| 32 syncable::ModelEnumSet types = service->GetPreferredDataTypes(); | 32 syncable::ModelTypeSet types = service->GetPreferredDataTypes(); |
| 33 types.Remove(syncable::PASSWORDS); | 33 types.Remove(syncable::PASSWORDS); |
| 34 service->OnUserChoseDatatypes(false, types); | 34 service->OnUserChoseDatatypes(false, types); |
| 35 } | 35 } |
| 36 | 36 |
| 37 // Returns the next step for the non-fatal error case. | 37 // Returns the next step for the non-fatal error case. |
| 38 SyncSetupWizard::State GetStepForNonFatalError(ProfileSyncService* service) { | 38 SyncSetupWizard::State GetStepForNonFatalError(ProfileSyncService* service) { |
| 39 // TODO(sync): Update this error handling to allow different platforms to | 39 // TODO(sync): Update this error handling to allow different platforms to |
| 40 // display the error appropriately (http://crbug.com/92722) instead of | 40 // display the error appropriately (http://crbug.com/92722) instead of |
| 41 // navigating to a LOGIN state that is not supported on every platform. | 41 // navigating to a LOGIN state that is not supported on every platform. |
| 42 if (service->IsPassphraseRequired()) { | 42 if (service->IsPassphraseRequired()) { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 DictionaryValue* args) { | 116 DictionaryValue* args) { |
| 117 // The SYNC_EVERYTHING case will set this to true. | 117 // The SYNC_EVERYTHING case will set this to true. |
| 118 args->SetBoolean("showSyncEverythingPage", false); | 118 args->SetBoolean("showSyncEverythingPage", false); |
| 119 | 119 |
| 120 args->SetBoolean("syncAllDataTypes", | 120 args->SetBoolean("syncAllDataTypes", |
| 121 service->profile()->GetPrefs()->GetBoolean( | 121 service->profile()->GetPrefs()->GetBoolean( |
| 122 prefs::kSyncKeepEverythingSynced)); | 122 prefs::kSyncKeepEverythingSynced)); |
| 123 | 123 |
| 124 // Bookmarks, Preferences, and Themes are launched for good, there's no | 124 // Bookmarks, Preferences, and Themes are launched for good, there's no |
| 125 // going back now. Check if the other data types are registered though. | 125 // going back now. Check if the other data types are registered though. |
| 126 const syncable::ModelEnumSet registered_types = | 126 const syncable::ModelTypeSet registered_types = |
| 127 service->GetRegisteredDataTypes(); | 127 service->GetRegisteredDataTypes(); |
| 128 const syncable::ModelEnumSet preferred_types = | 128 const syncable::ModelTypeSet preferred_types = |
| 129 service->GetPreferredDataTypes(); | 129 service->GetPreferredDataTypes(); |
| 130 args->SetBoolean("passwordsRegistered", | 130 args->SetBoolean("passwordsRegistered", |
| 131 registered_types.Has(syncable::PASSWORDS)); | 131 registered_types.Has(syncable::PASSWORDS)); |
| 132 args->SetBoolean("autofillRegistered", | 132 args->SetBoolean("autofillRegistered", |
| 133 registered_types.Has(syncable::AUTOFILL)); | 133 registered_types.Has(syncable::AUTOFILL)); |
| 134 args->SetBoolean("extensionsRegistered", | 134 args->SetBoolean("extensionsRegistered", |
| 135 registered_types.Has(syncable::EXTENSIONS)); | 135 registered_types.Has(syncable::EXTENSIONS)); |
| 136 args->SetBoolean("typedUrlsRegistered", | 136 args->SetBoolean("typedUrlsRegistered", |
| 137 registered_types.Has(syncable::TYPED_URLS)); | 137 registered_types.Has(syncable::TYPED_URLS)); |
| 138 args->SetBoolean("appsRegistered", | 138 args->SetBoolean("appsRegistered", |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 case SyncSetupWizard::DONE: | 494 case SyncSetupWizard::DONE: |
| 495 case SyncSetupWizard::ABORT: | 495 case SyncSetupWizard::ABORT: |
| 496 flow_handler_->ShowSetupDone(UTF8ToUTF16( | 496 flow_handler_->ShowSetupDone(UTF8ToUTF16( |
| 497 service_->profile()->GetPrefs()->GetString( | 497 service_->profile()->GetPrefs()->GetString( |
| 498 prefs::kGoogleServicesUsername))); | 498 prefs::kGoogleServicesUsername))); |
| 499 break; | 499 break; |
| 500 default: | 500 default: |
| 501 NOTREACHED() << "Invalid advance state: " << state; | 501 NOTREACHED() << "Invalid advance state: " << state; |
| 502 } | 502 } |
| 503 } | 503 } |
| OLD | NEW |