| 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 // Keep this file in sync with the .proto files in this directory. | 5 // Keep this file in sync with the .proto files in this directory. |
| 6 | 6 |
| 7 #include "chrome/browser/sync/protocol/proto_value_conversions.h" | 7 #include "chrome/browser/sync/protocol/proto_value_conversions.h" |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chrome/browser/sync/protocol/app_notification_specifics.pb.h" | 14 #include "chrome/browser/sync/protocol/app_notification_specifics.pb.h" |
| 15 #include "chrome/browser/sync/protocol/app_setting_specifics.pb.h" |
| 15 #include "chrome/browser/sync/protocol/app_specifics.pb.h" | 16 #include "chrome/browser/sync/protocol/app_specifics.pb.h" |
| 16 #include "chrome/browser/sync/protocol/autofill_specifics.pb.h" | 17 #include "chrome/browser/sync/protocol/autofill_specifics.pb.h" |
| 17 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" | 18 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" |
| 18 #include "chrome/browser/sync/protocol/encryption.pb.h" | 19 #include "chrome/browser/sync/protocol/encryption.pb.h" |
| 19 #include "chrome/browser/sync/protocol/extension_setting_specifics.pb.h" | 20 #include "chrome/browser/sync/protocol/extension_setting_specifics.pb.h" |
| 20 #include "chrome/browser/sync/protocol/extension_specifics.pb.h" | 21 #include "chrome/browser/sync/protocol/extension_specifics.pb.h" |
| 21 #include "chrome/browser/sync/protocol/nigori_specifics.pb.h" | 22 #include "chrome/browser/sync/protocol/nigori_specifics.pb.h" |
| 22 #include "chrome/browser/sync/protocol/password_specifics.pb.h" | 23 #include "chrome/browser/sync/protocol/password_specifics.pb.h" |
| 23 #include "chrome/browser/sync/protocol/preference_specifics.pb.h" | 24 #include "chrome/browser/sync/protocol/preference_specifics.pb.h" |
| 24 #include "chrome/browser/sync/protocol/proto_enum_conversions.h" | 25 #include "chrome/browser/sync/protocol/proto_enum_conversions.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 SET_STR(guid); | 172 SET_STR(guid); |
| 172 SET_STR(app_id); | 173 SET_STR(app_id); |
| 173 SET_INT64(creation_timestamp_ms); | 174 SET_INT64(creation_timestamp_ms); |
| 174 SET_STR(title); | 175 SET_STR(title); |
| 175 SET_STR(body_text); | 176 SET_STR(body_text); |
| 176 SET_STR(link_url); | 177 SET_STR(link_url); |
| 177 SET_STR(link_text); | 178 SET_STR(link_text); |
| 178 return value; | 179 return value; |
| 179 } | 180 } |
| 180 | 181 |
| 182 DictionaryValue* AppSettingSpecificsToValue( |
| 183 const sync_pb::AppSettingSpecifics& proto) { |
| 184 DictionaryValue* value = new DictionaryValue(); |
| 185 SET(extension_setting, ExtensionSettingSpecificsToValue); |
| 186 return value; |
| 187 } |
| 188 |
| 181 DictionaryValue* AppSpecificsToValue( | 189 DictionaryValue* AppSpecificsToValue( |
| 182 const sync_pb::AppSpecifics& proto) { | 190 const sync_pb::AppSpecifics& proto) { |
| 183 DictionaryValue* value = new DictionaryValue(); | 191 DictionaryValue* value = new DictionaryValue(); |
| 184 SET(extension, ExtensionSpecificsToValue); | 192 SET(extension, ExtensionSpecificsToValue); |
| 185 return value; | 193 return value; |
| 186 } | 194 } |
| 187 | 195 |
| 188 DictionaryValue* AutofillSpecificsToValue( | 196 DictionaryValue* AutofillSpecificsToValue( |
| 189 const sync_pb::AutofillSpecifics& proto) { | 197 const sync_pb::AutofillSpecifics& proto) { |
| 190 DictionaryValue* value = new DictionaryValue(); | 198 DictionaryValue* value = new DictionaryValue(); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 const sync_pb::NigoriSpecifics& proto) { | 261 const sync_pb::NigoriSpecifics& proto) { |
| 254 DictionaryValue* value = new DictionaryValue(); | 262 DictionaryValue* value = new DictionaryValue(); |
| 255 SET(encrypted, EncryptedDataToValue); | 263 SET(encrypted, EncryptedDataToValue); |
| 256 SET_BOOL(using_explicit_passphrase); | 264 SET_BOOL(using_explicit_passphrase); |
| 257 SET_BOOL(encrypt_bookmarks); | 265 SET_BOOL(encrypt_bookmarks); |
| 258 SET_BOOL(encrypt_preferences); | 266 SET_BOOL(encrypt_preferences); |
| 259 SET_BOOL(encrypt_autofill_profile); | 267 SET_BOOL(encrypt_autofill_profile); |
| 260 SET_BOOL(encrypt_autofill); | 268 SET_BOOL(encrypt_autofill); |
| 261 SET_BOOL(encrypt_themes); | 269 SET_BOOL(encrypt_themes); |
| 262 SET_BOOL(encrypt_typed_urls); | 270 SET_BOOL(encrypt_typed_urls); |
| 271 SET_BOOL(encrypt_extension_settings); |
| 263 SET_BOOL(encrypt_extensions); | 272 SET_BOOL(encrypt_extensions); |
| 264 SET_BOOL(encrypt_sessions); | 273 SET_BOOL(encrypt_sessions); |
| 274 SET_BOOL(encrypt_app_settings); |
| 265 SET_BOOL(encrypt_apps); | 275 SET_BOOL(encrypt_apps); |
| 266 SET_BOOL(encrypt_search_engines); | 276 SET_BOOL(encrypt_search_engines); |
| 267 SET_BOOL(sync_tabs); | 277 SET_BOOL(sync_tabs); |
| 268 SET_BOOL(encrypt_everything); | 278 SET_BOOL(encrypt_everything); |
| 269 SET_BOOL(encrypt_extension_settings); | |
| 270 return value; | 279 return value; |
| 271 } | 280 } |
| 272 | 281 |
| 273 DictionaryValue* PasswordSpecificsToValue( | 282 DictionaryValue* PasswordSpecificsToValue( |
| 274 const sync_pb::PasswordSpecifics& proto) { | 283 const sync_pb::PasswordSpecifics& proto) { |
| 275 DictionaryValue* value = new DictionaryValue(); | 284 DictionaryValue* value = new DictionaryValue(); |
| 276 SET(encrypted, EncryptedDataToValue); | 285 SET(encrypted, EncryptedDataToValue); |
| 277 return value; | 286 return value; |
| 278 } | 287 } |
| 279 | 288 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 SET_STR(title); | 342 SET_STR(title); |
| 334 SET_BOOL(hidden); | 343 SET_BOOL(hidden); |
| 335 SET_INT64_REP(visits); | 344 SET_INT64_REP(visits); |
| 336 SET_INT32_REP(visit_transitions); | 345 SET_INT32_REP(visit_transitions); |
| 337 return value; | 346 return value; |
| 338 } | 347 } |
| 339 | 348 |
| 340 DictionaryValue* EntitySpecificsToValue( | 349 DictionaryValue* EntitySpecificsToValue( |
| 341 const sync_pb::EntitySpecifics& specifics) { | 350 const sync_pb::EntitySpecifics& specifics) { |
| 342 DictionaryValue* value = new DictionaryValue(); | 351 DictionaryValue* value = new DictionaryValue(); |
| 352 SET_EXTENSION(sync_pb, app, AppSpecificsToValue); |
| 343 SET_EXTENSION(sync_pb, app_notification, AppNotificationSpecificsToValue); | 353 SET_EXTENSION(sync_pb, app_notification, AppNotificationSpecificsToValue); |
| 344 SET_EXTENSION(sync_pb, app, AppSpecificsToValue); | 354 SET_EXTENSION(sync_pb, app_setting, AppSettingSpecificsToValue); |
| 345 SET_EXTENSION(sync_pb, autofill, AutofillSpecificsToValue); | 355 SET_EXTENSION(sync_pb, autofill, AutofillSpecificsToValue); |
| 346 SET_EXTENSION(sync_pb, autofill_profile, AutofillProfileSpecificsToValue); | 356 SET_EXTENSION(sync_pb, autofill_profile, AutofillProfileSpecificsToValue); |
| 347 SET_EXTENSION(sync_pb, bookmark, BookmarkSpecificsToValue); | 357 SET_EXTENSION(sync_pb, bookmark, BookmarkSpecificsToValue); |
| 348 SET_EXTENSION(sync_pb, extension, ExtensionSpecificsToValue); | 358 SET_EXTENSION(sync_pb, extension, ExtensionSpecificsToValue); |
| 349 SET_EXTENSION(sync_pb, extension_setting, ExtensionSettingSpecificsToValue); | 359 SET_EXTENSION(sync_pb, extension_setting, ExtensionSettingSpecificsToValue); |
| 350 SET_EXTENSION(sync_pb, nigori, NigoriSpecificsToValue); | 360 SET_EXTENSION(sync_pb, nigori, NigoriSpecificsToValue); |
| 351 SET_EXTENSION(sync_pb, password, PasswordSpecificsToValue); | 361 SET_EXTENSION(sync_pb, password, PasswordSpecificsToValue); |
| 352 SET_EXTENSION(sync_pb, preference, PreferenceSpecificsToValue); | 362 SET_EXTENSION(sync_pb, preference, PreferenceSpecificsToValue); |
| 353 SET_EXTENSION(sync_pb, search_engine, SearchEngineSpecificsToValue); | 363 SET_EXTENSION(sync_pb, search_engine, SearchEngineSpecificsToValue); |
| 354 SET_EXTENSION(sync_pb, session, SessionSpecificsToValue); | 364 SET_EXTENSION(sync_pb, session, SessionSpecificsToValue); |
| 355 SET_EXTENSION(sync_pb, theme, ThemeSpecificsToValue); | 365 SET_EXTENSION(sync_pb, theme, ThemeSpecificsToValue); |
| 356 SET_EXTENSION(sync_pb, typed_url, TypedUrlSpecificsToValue); | 366 SET_EXTENSION(sync_pb, typed_url, TypedUrlSpecificsToValue); |
| 357 return value; | 367 return value; |
| 358 } | 368 } |
| 359 | 369 |
| 360 #undef SET | 370 #undef SET |
| 361 #undef SET_REP | 371 #undef SET_REP |
| 362 | 372 |
| 363 #undef SET_BOOL | 373 #undef SET_BOOL |
| 364 #undef SET_BYTES | 374 #undef SET_BYTES |
| 365 #undef SET_INT32 | 375 #undef SET_INT32 |
| 366 #undef SET_INT64 | 376 #undef SET_INT64 |
| 367 #undef SET_INT64_REP | 377 #undef SET_INT64_REP |
| 368 #undef SET_STR | 378 #undef SET_STR |
| 369 | 379 |
| 370 #undef SET_EXTENSION | 380 #undef SET_EXTENSION |
| 371 | 381 |
| 372 } // namespace browser_sync | 382 } // namespace browser_sync |
| OLD | NEW |