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

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

Issue 10696087: [Sync] Move ModelType and related classes to 'syncer' namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sort headers, update copyrights Created 8 years, 5 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 namespace { 45 namespace {
46 46
47 // A structure which contains all the configuration information for sync. 47 // A structure which contains all the configuration information for sync.
48 struct SyncConfigInfo { 48 struct SyncConfigInfo {
49 SyncConfigInfo(); 49 SyncConfigInfo();
50 ~SyncConfigInfo(); 50 ~SyncConfigInfo();
51 51
52 bool encrypt_all; 52 bool encrypt_all;
53 bool sync_everything; 53 bool sync_everything;
54 syncable::ModelTypeSet data_types; 54 syncer::ModelTypeSet data_types;
55 std::string passphrase; 55 std::string passphrase;
56 bool passphrase_is_gaia; 56 bool passphrase_is_gaia;
57 }; 57 };
58 58
59 SyncConfigInfo::SyncConfigInfo() 59 SyncConfigInfo::SyncConfigInfo()
60 : encrypt_all(false), 60 : encrypt_all(false),
61 sync_everything(false), 61 sync_everything(false),
62 passphrase_is_gaia(false) { 62 passphrase_is_gaia(false) {
63 } 63 }
64 64
65 SyncConfigInfo::~SyncConfigInfo() {} 65 SyncConfigInfo::~SyncConfigInfo() {}
66 66
67 const char* kDataTypeNames[] = { 67 const char* kDataTypeNames[] = {
68 "apps", 68 "apps",
69 "autofill", 69 "autofill",
70 "bookmarks", 70 "bookmarks",
71 "extensions", 71 "extensions",
72 "passwords", 72 "passwords",
73 "preferences", 73 "preferences",
74 "sessions", 74 "sessions",
75 "themes", 75 "themes",
76 "typedUrls" 76 "typedUrls"
77 }; 77 };
78 78
79 const syncable::ModelType kDataTypes[] = { 79 const syncer::ModelType kDataTypes[] = {
80 syncable::APPS, 80 syncer::APPS,
81 syncable::AUTOFILL, 81 syncer::AUTOFILL,
82 syncable::BOOKMARKS, 82 syncer::BOOKMARKS,
83 syncable::EXTENSIONS, 83 syncer::EXTENSIONS,
84 syncable::PASSWORDS, 84 syncer::PASSWORDS,
85 syncable::PREFERENCES, 85 syncer::PREFERENCES,
86 syncable::SESSIONS, 86 syncer::SESSIONS,
87 syncable::THEMES, 87 syncer::THEMES,
88 syncable::TYPED_URLS 88 syncer::TYPED_URLS
89 }; 89 };
90 90
91 static const size_t kNumDataTypes = arraysize(kDataTypes); 91 static const size_t kNumDataTypes = arraysize(kDataTypes);
92 COMPILE_ASSERT(arraysize(kDataTypeNames) == arraysize(kDataTypes), 92 COMPILE_ASSERT(arraysize(kDataTypeNames) == arraysize(kDataTypes),
93 kDataTypes_does_not_match_kDataTypeNames); 93 kDataTypes_does_not_match_kDataTypeNames);
94 94
95 static const char kDefaultSigninDomain[] = "gmail.com"; 95 static const char kDefaultSigninDomain[] = "gmail.com";
96 96
97 bool GetAuthData(const std::string& json, 97 bool GetAuthData(const std::string& json,
98 std::string* username, 98 std::string* username,
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 // <data_type>Registered: true if the associated data type is supported 393 // <data_type>Registered: true if the associated data type is supported
394 // <data_type>Synced: true if the user wants to sync that specific data type 394 // <data_type>Synced: true if the user wants to sync that specific data type
395 // encryptionEnabled: true if sync supports encryption 395 // encryptionEnabled: true if sync supports encryption
396 // encryptAllData: true if user wants to encrypt all data (not just 396 // encryptAllData: true if user wants to encrypt all data (not just
397 // passwords) 397 // passwords)
398 // usePassphrase: true if the data is encrypted with a secondary passphrase 398 // usePassphrase: true if the data is encrypted with a secondary passphrase
399 // show_passphrase: true if a passphrase is needed to decrypt the sync data 399 // show_passphrase: true if a passphrase is needed to decrypt the sync data
400 DictionaryValue args; 400 DictionaryValue args;
401 401
402 // Tell the UI layer which data types are registered/enabled by the user. 402 // Tell the UI layer which data types are registered/enabled by the user.
403 const syncable::ModelTypeSet registered_types = 403 const syncer::ModelTypeSet registered_types =
404 service->GetRegisteredDataTypes(); 404 service->GetRegisteredDataTypes();
405 const syncable::ModelTypeSet preferred_types = 405 const syncer::ModelTypeSet preferred_types =
406 service->GetPreferredDataTypes(); 406 service->GetPreferredDataTypes();
407 for (size_t i = 0; i < kNumDataTypes; ++i) { 407 for (size_t i = 0; i < kNumDataTypes; ++i) {
408 const std::string key_name = kDataTypeNames[i]; 408 const std::string key_name = kDataTypeNames[i];
409 args.SetBoolean(key_name + "Registered", 409 args.SetBoolean(key_name + "Registered",
410 registered_types.Has(kDataTypes[i])); 410 registered_types.Has(kDataTypes[i]));
411 args.SetBoolean(key_name + "Synced", preferred_types.Has(kDataTypes[i])); 411 args.SetBoolean(key_name + "Synced", preferred_types.Has(kDataTypes[i]));
412 } 412 }
413 browser_sync::SyncPrefs sync_prefs(GetProfile()->GetPrefs()); 413 browser_sync::SyncPrefs sync_prefs(GetProfile()->GetPrefs());
414 args.SetBoolean("passphraseFailed", passphrase_failed); 414 args.SetBoolean("passphraseFailed", passphrase_failed);
415 args.SetBoolean("showSyncEverythingPage", !show_advanced); 415 args.SetBoolean("showSyncEverythingPage", !show_advanced);
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 if (i != current_profile_index && AreUserNamesEqual( 1036 if (i != current_profile_index && AreUserNamesEqual(
1037 cache.GetUserNameOfProfileAtIndex(i), username_utf16)) { 1037 cache.GetUserNameOfProfileAtIndex(i), username_utf16)) {
1038 *error_message = l10n_util::GetStringUTF16( 1038 *error_message = l10n_util::GetStringUTF16(
1039 IDS_SYNC_USER_NAME_IN_USE_ERROR); 1039 IDS_SYNC_USER_NAME_IN_USE_ERROR);
1040 return false; 1040 return false;
1041 } 1041 }
1042 } 1042 }
1043 1043
1044 return true; 1044 return true;
1045 } 1045 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/sync_promo/sync_promo_handler.cc ('k') | chrome/browser/ui/webui/sync_setup_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698