| 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_specifics.pb.h" | 14 #include "chrome/browser/sync/protocol/app_specifics.pb.h" |
| 15 #include "chrome/browser/sync/protocol/autofill_specifics.pb.h" | 15 #include "chrome/browser/sync/protocol/autofill_specifics.pb.h" |
| 16 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" | 16 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" |
| 17 #include "chrome/browser/sync/protocol/encryption.pb.h" | 17 #include "chrome/browser/sync/protocol/encryption.pb.h" |
| 18 #include "chrome/browser/sync/protocol/extension_setting_specifics.pb.h" |
| 18 #include "chrome/browser/sync/protocol/extension_specifics.pb.h" | 19 #include "chrome/browser/sync/protocol/extension_specifics.pb.h" |
| 19 #include "chrome/browser/sync/protocol/nigori_specifics.pb.h" | 20 #include "chrome/browser/sync/protocol/nigori_specifics.pb.h" |
| 20 #include "chrome/browser/sync/protocol/password_specifics.pb.h" | 21 #include "chrome/browser/sync/protocol/password_specifics.pb.h" |
| 21 #include "chrome/browser/sync/protocol/preference_specifics.pb.h" | 22 #include "chrome/browser/sync/protocol/preference_specifics.pb.h" |
| 22 #include "chrome/browser/sync/protocol/proto_enum_conversions.h" | 23 #include "chrome/browser/sync/protocol/proto_enum_conversions.h" |
| 23 #include "chrome/browser/sync/protocol/search_engine_specifics.pb.h" | 24 #include "chrome/browser/sync/protocol/search_engine_specifics.pb.h" |
| 24 #include "chrome/browser/sync/protocol/session_specifics.pb.h" | 25 #include "chrome/browser/sync/protocol/session_specifics.pb.h" |
| 25 #include "chrome/browser/sync/protocol/sync.pb.h" | 26 #include "chrome/browser/sync/protocol/sync.pb.h" |
| 26 #include "chrome/browser/sync/protocol/theme_specifics.pb.h" | 27 #include "chrome/browser/sync/protocol/theme_specifics.pb.h" |
| 27 #include "chrome/browser/sync/protocol/typed_url_specifics.pb.h" | 28 #include "chrome/browser/sync/protocol/typed_url_specifics.pb.h" |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 207 |
| 207 DictionaryValue* BookmarkSpecificsToValue( | 208 DictionaryValue* BookmarkSpecificsToValue( |
| 208 const sync_pb::BookmarkSpecifics& proto) { | 209 const sync_pb::BookmarkSpecifics& proto) { |
| 209 DictionaryValue* value = new DictionaryValue(); | 210 DictionaryValue* value = new DictionaryValue(); |
| 210 SET_STR(url); | 211 SET_STR(url); |
| 211 SET_BYTES(favicon); | 212 SET_BYTES(favicon); |
| 212 SET_STR(title); | 213 SET_STR(title); |
| 213 return value; | 214 return value; |
| 214 } | 215 } |
| 215 | 216 |
| 217 DictionaryValue* ExtensionSettingSpecificsToValue( |
| 218 const sync_pb::ExtensionSettingSpecifics& proto) { |
| 219 DictionaryValue* value = new DictionaryValue(); |
| 220 SET_STR(extension_id); |
| 221 SET_STR(key); |
| 222 SET_STR(value); |
| 223 return value; |
| 224 } |
| 225 |
| 216 DictionaryValue* ExtensionSpecificsToValue( | 226 DictionaryValue* ExtensionSpecificsToValue( |
| 217 const sync_pb::ExtensionSpecifics& proto) { | 227 const sync_pb::ExtensionSpecifics& proto) { |
| 218 DictionaryValue* value = new DictionaryValue(); | 228 DictionaryValue* value = new DictionaryValue(); |
| 219 SET_STR(id); | 229 SET_STR(id); |
| 220 SET_STR(version); | 230 SET_STR(version); |
| 221 SET_STR(update_url); | 231 SET_STR(update_url); |
| 222 SET_BOOL(enabled); | 232 SET_BOOL(enabled); |
| 223 SET_BOOL(incognito_enabled); | 233 SET_BOOL(incognito_enabled); |
| 224 SET_STR(name); | 234 SET_STR(name); |
| 225 return value; | 235 return value; |
| 226 } | 236 } |
| 227 | 237 |
| 228 DictionaryValue* NigoriSpecificsToValue( | 238 DictionaryValue* NigoriSpecificsToValue( |
| 229 const sync_pb::NigoriSpecifics& proto) { | 239 const sync_pb::NigoriSpecifics& proto) { |
| 230 DictionaryValue* value = new DictionaryValue(); | 240 DictionaryValue* value = new DictionaryValue(); |
| 231 SET(encrypted, EncryptedDataToValue); | 241 SET(encrypted, EncryptedDataToValue); |
| 232 SET_BOOL(using_explicit_passphrase); | 242 SET_BOOL(using_explicit_passphrase); |
| 233 SET_BOOL(encrypt_bookmarks); | 243 SET_BOOL(encrypt_bookmarks); |
| 234 SET_BOOL(encrypt_preferences); | 244 SET_BOOL(encrypt_preferences); |
| 235 SET_BOOL(encrypt_autofill_profile); | 245 SET_BOOL(encrypt_autofill_profile); |
| 236 SET_BOOL(encrypt_autofill); | 246 SET_BOOL(encrypt_autofill); |
| 237 SET_BOOL(encrypt_themes); | 247 SET_BOOL(encrypt_themes); |
| 238 SET_BOOL(encrypt_typed_urls); | 248 SET_BOOL(encrypt_typed_urls); |
| 239 SET_BOOL(encrypt_extensions); | 249 SET_BOOL(encrypt_extensions); |
| 240 SET_BOOL(encrypt_sessions); | 250 SET_BOOL(encrypt_sessions); |
| 241 SET_BOOL(encrypt_apps); | 251 SET_BOOL(encrypt_apps); |
| 242 SET_BOOL(encrypt_search_engines); | 252 SET_BOOL(encrypt_search_engines); |
| 243 SET_BOOL(sync_tabs); | 253 SET_BOOL(sync_tabs); |
| 244 SET_BOOL(encrypt_everything); | 254 SET_BOOL(encrypt_everything); |
| 255 SET_BOOL(encrypt_extension_settings); |
| 245 return value; | 256 return value; |
| 246 } | 257 } |
| 247 | 258 |
| 248 DictionaryValue* PasswordSpecificsToValue( | 259 DictionaryValue* PasswordSpecificsToValue( |
| 249 const sync_pb::PasswordSpecifics& proto) { | 260 const sync_pb::PasswordSpecifics& proto) { |
| 250 DictionaryValue* value = new DictionaryValue(); | 261 DictionaryValue* value = new DictionaryValue(); |
| 251 SET(encrypted, EncryptedDataToValue); | 262 SET(encrypted, EncryptedDataToValue); |
| 252 return value; | 263 return value; |
| 253 } | 264 } |
| 254 | 265 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 } | 325 } |
| 315 | 326 |
| 316 DictionaryValue* EntitySpecificsToValue( | 327 DictionaryValue* EntitySpecificsToValue( |
| 317 const sync_pb::EntitySpecifics& specifics) { | 328 const sync_pb::EntitySpecifics& specifics) { |
| 318 DictionaryValue* value = new DictionaryValue(); | 329 DictionaryValue* value = new DictionaryValue(); |
| 319 SET_EXTENSION(sync_pb, app, AppSpecificsToValue); | 330 SET_EXTENSION(sync_pb, app, AppSpecificsToValue); |
| 320 SET_EXTENSION(sync_pb, autofill, AutofillSpecificsToValue); | 331 SET_EXTENSION(sync_pb, autofill, AutofillSpecificsToValue); |
| 321 SET_EXTENSION(sync_pb, autofill_profile, AutofillProfileSpecificsToValue); | 332 SET_EXTENSION(sync_pb, autofill_profile, AutofillProfileSpecificsToValue); |
| 322 SET_EXTENSION(sync_pb, bookmark, BookmarkSpecificsToValue); | 333 SET_EXTENSION(sync_pb, bookmark, BookmarkSpecificsToValue); |
| 323 SET_EXTENSION(sync_pb, extension, ExtensionSpecificsToValue); | 334 SET_EXTENSION(sync_pb, extension, ExtensionSpecificsToValue); |
| 335 SET_EXTENSION(sync_pb, extension_setting, ExtensionSettingSpecificsToValue); |
| 324 SET_EXTENSION(sync_pb, nigori, NigoriSpecificsToValue); | 336 SET_EXTENSION(sync_pb, nigori, NigoriSpecificsToValue); |
| 325 SET_EXTENSION(sync_pb, password, PasswordSpecificsToValue); | 337 SET_EXTENSION(sync_pb, password, PasswordSpecificsToValue); |
| 326 SET_EXTENSION(sync_pb, preference, PreferenceSpecificsToValue); | 338 SET_EXTENSION(sync_pb, preference, PreferenceSpecificsToValue); |
| 327 SET_EXTENSION(sync_pb, search_engine, SearchEngineSpecificsToValue); | 339 SET_EXTENSION(sync_pb, search_engine, SearchEngineSpecificsToValue); |
| 328 SET_EXTENSION(sync_pb, session, SessionSpecificsToValue); | 340 SET_EXTENSION(sync_pb, session, SessionSpecificsToValue); |
| 329 SET_EXTENSION(sync_pb, theme, ThemeSpecificsToValue); | 341 SET_EXTENSION(sync_pb, theme, ThemeSpecificsToValue); |
| 330 SET_EXTENSION(sync_pb, typed_url, TypedUrlSpecificsToValue); | 342 SET_EXTENSION(sync_pb, typed_url, TypedUrlSpecificsToValue); |
| 331 return value; | 343 return value; |
| 332 } | 344 } |
| 333 | 345 |
| 334 #undef SET | 346 #undef SET |
| 335 #undef SET_REP | 347 #undef SET_REP |
| 336 | 348 |
| 337 #undef SET_BOOL | 349 #undef SET_BOOL |
| 338 #undef SET_BYTES | 350 #undef SET_BYTES |
| 339 #undef SET_INT32 | 351 #undef SET_INT32 |
| 340 #undef SET_INT64 | 352 #undef SET_INT64 |
| 341 #undef SET_INT64_REP | 353 #undef SET_INT64_REP |
| 342 #undef SET_STR | 354 #undef SET_STR |
| 343 | 355 |
| 344 #undef SET_EXTENSION | 356 #undef SET_EXTENSION |
| 345 | 357 |
| 346 } // namespace browser_sync | 358 } // namespace browser_sync |
| OLD | NEW |