| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 SET_STR(guid); | 180 SET_STR(guid); |
| 180 SET_STR(app_id); | 181 SET_STR(app_id); |
| 181 SET_INT64(creation_timestamp_ms); | 182 SET_INT64(creation_timestamp_ms); |
| 182 SET_STR(title); | 183 SET_STR(title); |
| 183 SET_STR(body_text); | 184 SET_STR(body_text); |
| 184 SET_STR(link_url); | 185 SET_STR(link_url); |
| 185 SET_STR(link_text); | 186 SET_STR(link_text); |
| 186 return value; | 187 return value; |
| 187 } | 188 } |
| 188 | 189 |
| 190 DictionaryValue* AppSettingSpecificsToValue( |
| 191 const sync_pb::AppSettingSpecifics& proto) { |
| 192 DictionaryValue* value = new DictionaryValue(); |
| 193 SET(extension_setting, ExtensionSettingSpecificsToValue); |
| 194 return value; |
| 195 } |
| 196 |
| 189 DictionaryValue* AppSpecificsToValue( | 197 DictionaryValue* AppSpecificsToValue( |
| 190 const sync_pb::AppSpecifics& proto) { | 198 const sync_pb::AppSpecifics& proto) { |
| 191 DictionaryValue* value = new DictionaryValue(); | 199 DictionaryValue* value = new DictionaryValue(); |
| 192 SET(extension, ExtensionSpecificsToValue); | 200 SET(extension, ExtensionSpecificsToValue); |
| 193 SET(notification_settings, AppSettingsToValue); | 201 SET(notification_settings, AppSettingsToValue); |
| 194 return value; | 202 return value; |
| 195 } | 203 } |
| 196 | 204 |
| 197 DictionaryValue* AutofillSpecificsToValue( | 205 DictionaryValue* AutofillSpecificsToValue( |
| 198 const sync_pb::AutofillSpecifics& proto) { | 206 const sync_pb::AutofillSpecifics& proto) { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 const sync_pb::NigoriSpecifics& proto) { | 270 const sync_pb::NigoriSpecifics& proto) { |
| 263 DictionaryValue* value = new DictionaryValue(); | 271 DictionaryValue* value = new DictionaryValue(); |
| 264 SET(encrypted, EncryptedDataToValue); | 272 SET(encrypted, EncryptedDataToValue); |
| 265 SET_BOOL(using_explicit_passphrase); | 273 SET_BOOL(using_explicit_passphrase); |
| 266 SET_BOOL(encrypt_bookmarks); | 274 SET_BOOL(encrypt_bookmarks); |
| 267 SET_BOOL(encrypt_preferences); | 275 SET_BOOL(encrypt_preferences); |
| 268 SET_BOOL(encrypt_autofill_profile); | 276 SET_BOOL(encrypt_autofill_profile); |
| 269 SET_BOOL(encrypt_autofill); | 277 SET_BOOL(encrypt_autofill); |
| 270 SET_BOOL(encrypt_themes); | 278 SET_BOOL(encrypt_themes); |
| 271 SET_BOOL(encrypt_typed_urls); | 279 SET_BOOL(encrypt_typed_urls); |
| 280 SET_BOOL(encrypt_extension_settings); |
| 272 SET_BOOL(encrypt_extensions); | 281 SET_BOOL(encrypt_extensions); |
| 273 SET_BOOL(encrypt_sessions); | 282 SET_BOOL(encrypt_sessions); |
| 283 SET_BOOL(encrypt_app_settings); |
| 274 SET_BOOL(encrypt_apps); | 284 SET_BOOL(encrypt_apps); |
| 275 SET_BOOL(encrypt_search_engines); | 285 SET_BOOL(encrypt_search_engines); |
| 276 SET_BOOL(sync_tabs); | 286 SET_BOOL(sync_tabs); |
| 277 SET_BOOL(encrypt_everything); | 287 SET_BOOL(encrypt_everything); |
| 278 SET_BOOL(encrypt_extension_settings); | |
| 279 return value; | 288 return value; |
| 280 } | 289 } |
| 281 | 290 |
| 282 DictionaryValue* PasswordSpecificsToValue( | 291 DictionaryValue* PasswordSpecificsToValue( |
| 283 const sync_pb::PasswordSpecifics& proto) { | 292 const sync_pb::PasswordSpecifics& proto) { |
| 284 DictionaryValue* value = new DictionaryValue(); | 293 DictionaryValue* value = new DictionaryValue(); |
| 285 SET(encrypted, EncryptedDataToValue); | 294 SET(encrypted, EncryptedDataToValue); |
| 286 return value; | 295 return value; |
| 287 } | 296 } |
| 288 | 297 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 SET_STR(title); | 351 SET_STR(title); |
| 343 SET_BOOL(hidden); | 352 SET_BOOL(hidden); |
| 344 SET_INT64_REP(visits); | 353 SET_INT64_REP(visits); |
| 345 SET_INT32_REP(visit_transitions); | 354 SET_INT32_REP(visit_transitions); |
| 346 return value; | 355 return value; |
| 347 } | 356 } |
| 348 | 357 |
| 349 DictionaryValue* EntitySpecificsToValue( | 358 DictionaryValue* EntitySpecificsToValue( |
| 350 const sync_pb::EntitySpecifics& specifics) { | 359 const sync_pb::EntitySpecifics& specifics) { |
| 351 DictionaryValue* value = new DictionaryValue(); | 360 DictionaryValue* value = new DictionaryValue(); |
| 361 SET_EXTENSION(sync_pb, app, AppSpecificsToValue); |
| 352 SET_EXTENSION(sync_pb, app_notification, AppNotificationSpecificsToValue); | 362 SET_EXTENSION(sync_pb, app_notification, AppNotificationSpecificsToValue); |
| 353 SET_EXTENSION(sync_pb, app, AppSpecificsToValue); | 363 SET_EXTENSION(sync_pb, app_setting, AppSettingSpecificsToValue); |
| 354 SET_EXTENSION(sync_pb, autofill, AutofillSpecificsToValue); | 364 SET_EXTENSION(sync_pb, autofill, AutofillSpecificsToValue); |
| 355 SET_EXTENSION(sync_pb, autofill_profile, AutofillProfileSpecificsToValue); | 365 SET_EXTENSION(sync_pb, autofill_profile, AutofillProfileSpecificsToValue); |
| 356 SET_EXTENSION(sync_pb, bookmark, BookmarkSpecificsToValue); | 366 SET_EXTENSION(sync_pb, bookmark, BookmarkSpecificsToValue); |
| 357 SET_EXTENSION(sync_pb, extension, ExtensionSpecificsToValue); | 367 SET_EXTENSION(sync_pb, extension, ExtensionSpecificsToValue); |
| 358 SET_EXTENSION(sync_pb, extension_setting, ExtensionSettingSpecificsToValue); | 368 SET_EXTENSION(sync_pb, extension_setting, ExtensionSettingSpecificsToValue); |
| 359 SET_EXTENSION(sync_pb, nigori, NigoriSpecificsToValue); | 369 SET_EXTENSION(sync_pb, nigori, NigoriSpecificsToValue); |
| 360 SET_EXTENSION(sync_pb, password, PasswordSpecificsToValue); | 370 SET_EXTENSION(sync_pb, password, PasswordSpecificsToValue); |
| 361 SET_EXTENSION(sync_pb, preference, PreferenceSpecificsToValue); | 371 SET_EXTENSION(sync_pb, preference, PreferenceSpecificsToValue); |
| 362 SET_EXTENSION(sync_pb, search_engine, SearchEngineSpecificsToValue); | 372 SET_EXTENSION(sync_pb, search_engine, SearchEngineSpecificsToValue); |
| 363 SET_EXTENSION(sync_pb, session, SessionSpecificsToValue); | 373 SET_EXTENSION(sync_pb, session, SessionSpecificsToValue); |
| 364 SET_EXTENSION(sync_pb, theme, ThemeSpecificsToValue); | 374 SET_EXTENSION(sync_pb, theme, ThemeSpecificsToValue); |
| 365 SET_EXTENSION(sync_pb, typed_url, TypedUrlSpecificsToValue); | 375 SET_EXTENSION(sync_pb, typed_url, TypedUrlSpecificsToValue); |
| 366 return value; | 376 return value; |
| 367 } | 377 } |
| 368 | 378 |
| 369 #undef SET | 379 #undef SET |
| 370 #undef SET_REP | 380 #undef SET_REP |
| 371 | 381 |
| 372 #undef SET_BOOL | 382 #undef SET_BOOL |
| 373 #undef SET_BYTES | 383 #undef SET_BYTES |
| 374 #undef SET_INT32 | 384 #undef SET_INT32 |
| 375 #undef SET_INT64 | 385 #undef SET_INT64 |
| 376 #undef SET_INT64_REP | 386 #undef SET_INT64_REP |
| 377 #undef SET_STR | 387 #undef SET_STR |
| 378 | 388 |
| 379 #undef SET_EXTENSION | 389 #undef SET_EXTENSION |
| 380 | 390 |
| 381 } // namespace browser_sync | 391 } // namespace browser_sync |
| OLD | NEW |