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_specifics.pb.h" | 18 #include "chrome/browser/sync/protocol/extension_specifics.pb.h" |
19 #include "chrome/browser/sync/protocol/nigori_specifics.pb.h" | 19 #include "chrome/browser/sync/protocol/nigori_specifics.pb.h" |
20 #include "chrome/browser/sync/protocol/password_specifics.pb.h" | 20 #include "chrome/browser/sync/protocol/password_specifics.pb.h" |
21 #include "chrome/browser/sync/protocol/preference_specifics.pb.h" | 21 #include "chrome/browser/sync/protocol/preference_specifics.pb.h" |
22 #include "chrome/browser/sync/protocol/proto_enum_conversions.h" | 22 #include "chrome/browser/sync/protocol/proto_enum_conversions.h" |
| 23 #include "chrome/browser/sync/protocol/search_engine_specifics.pb.h" |
23 #include "chrome/browser/sync/protocol/session_specifics.pb.h" | 24 #include "chrome/browser/sync/protocol/session_specifics.pb.h" |
24 #include "chrome/browser/sync/protocol/sync.pb.h" | 25 #include "chrome/browser/sync/protocol/sync.pb.h" |
25 #include "chrome/browser/sync/protocol/theme_specifics.pb.h" | 26 #include "chrome/browser/sync/protocol/theme_specifics.pb.h" |
26 #include "chrome/browser/sync/protocol/typed_url_specifics.pb.h" | 27 #include "chrome/browser/sync/protocol/typed_url_specifics.pb.h" |
27 | 28 |
28 namespace browser_sync { | 29 namespace browser_sync { |
29 | 30 |
30 namespace { | 31 namespace { |
31 | 32 |
32 // Basic Type -> Value functions. | 33 // Basic Type -> Value functions. |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 } | 255 } |
255 | 256 |
256 DictionaryValue* PreferenceSpecificsToValue( | 257 DictionaryValue* PreferenceSpecificsToValue( |
257 const sync_pb::PreferenceSpecifics& proto) { | 258 const sync_pb::PreferenceSpecifics& proto) { |
258 DictionaryValue* value = new DictionaryValue(); | 259 DictionaryValue* value = new DictionaryValue(); |
259 SET_STR(name); | 260 SET_STR(name); |
260 SET_STR(value); | 261 SET_STR(value); |
261 return value; | 262 return value; |
262 } | 263 } |
263 | 264 |
| 265 DictionaryValue* SearchEngineSpecificsToValue( |
| 266 const sync_pb::SearchEngineSpecifics& proto) { |
| 267 DictionaryValue* value = new DictionaryValue(); |
| 268 SET_STR(short_name); |
| 269 SET_STR(keyword); |
| 270 SET_STR(favicon_url); |
| 271 SET_STR(url); |
| 272 SET_BOOL(safe_for_autoreplace); |
| 273 SET_STR(originating_url); |
| 274 SET_INT64(date_created); |
| 275 SET_STR(input_encodings); |
| 276 SET_BOOL(show_in_default_list); |
| 277 SET_STR(suggestions_url); |
| 278 SET_INT32(prepopulate_id); |
| 279 SET_BOOL(autogenerate_keyword); |
| 280 SET_INT32(logo_id); |
| 281 SET_BOOL(created_by_policy); |
| 282 SET_STR(instant_url); |
| 283 SET_INT64(id); |
| 284 return value; |
| 285 } |
| 286 |
264 DictionaryValue* SessionSpecificsToValue( | 287 DictionaryValue* SessionSpecificsToValue( |
265 const sync_pb::SessionSpecifics& proto) { | 288 const sync_pb::SessionSpecifics& proto) { |
266 DictionaryValue* value = new DictionaryValue(); | 289 DictionaryValue* value = new DictionaryValue(); |
267 SET_STR(session_tag); | 290 SET_STR(session_tag); |
268 SET(header, SessionHeaderToValue); | 291 SET(header, SessionHeaderToValue); |
269 SET(tab, SessionTabToValue); | 292 SET(tab, SessionTabToValue); |
270 return value; | 293 return value; |
271 } | 294 } |
272 | 295 |
273 DictionaryValue* ThemeSpecificsToValue( | 296 DictionaryValue* ThemeSpecificsToValue( |
(...skipping 22 matching lines...) Expand all Loading... |
296 const sync_pb::EntitySpecifics& specifics) { | 319 const sync_pb::EntitySpecifics& specifics) { |
297 DictionaryValue* value = new DictionaryValue(); | 320 DictionaryValue* value = new DictionaryValue(); |
298 SET_EXTENSION(sync_pb, app, AppSpecificsToValue); | 321 SET_EXTENSION(sync_pb, app, AppSpecificsToValue); |
299 SET_EXTENSION(sync_pb, autofill, AutofillSpecificsToValue); | 322 SET_EXTENSION(sync_pb, autofill, AutofillSpecificsToValue); |
300 SET_EXTENSION(sync_pb, autofill_profile, AutofillProfileSpecificsToValue); | 323 SET_EXTENSION(sync_pb, autofill_profile, AutofillProfileSpecificsToValue); |
301 SET_EXTENSION(sync_pb, bookmark, BookmarkSpecificsToValue); | 324 SET_EXTENSION(sync_pb, bookmark, BookmarkSpecificsToValue); |
302 SET_EXTENSION(sync_pb, extension, ExtensionSpecificsToValue); | 325 SET_EXTENSION(sync_pb, extension, ExtensionSpecificsToValue); |
303 SET_EXTENSION(sync_pb, nigori, NigoriSpecificsToValue); | 326 SET_EXTENSION(sync_pb, nigori, NigoriSpecificsToValue); |
304 SET_EXTENSION(sync_pb, password, PasswordSpecificsToValue); | 327 SET_EXTENSION(sync_pb, password, PasswordSpecificsToValue); |
305 SET_EXTENSION(sync_pb, preference, PreferenceSpecificsToValue); | 328 SET_EXTENSION(sync_pb, preference, PreferenceSpecificsToValue); |
| 329 SET_EXTENSION(sync_pb, search_engine, SearchEngineSpecificsToValue); |
306 SET_EXTENSION(sync_pb, session, SessionSpecificsToValue); | 330 SET_EXTENSION(sync_pb, session, SessionSpecificsToValue); |
307 SET_EXTENSION(sync_pb, theme, ThemeSpecificsToValue); | 331 SET_EXTENSION(sync_pb, theme, ThemeSpecificsToValue); |
308 SET_EXTENSION(sync_pb, typed_url, TypedUrlSpecificsToValue); | 332 SET_EXTENSION(sync_pb, typed_url, TypedUrlSpecificsToValue); |
309 return value; | 333 return value; |
310 } | 334 } |
311 | 335 |
312 #undef SET | 336 #undef SET |
313 #undef SET_REP | 337 #undef SET_REP |
314 | 338 |
315 #undef SET_BOOL | 339 #undef SET_BOOL |
316 #undef SET_BYTES | 340 #undef SET_BYTES |
317 #undef SET_INT32 | 341 #undef SET_INT32 |
318 #undef SET_INT64 | 342 #undef SET_INT64 |
319 #undef SET_INT64_REP | 343 #undef SET_INT64_REP |
320 #undef SET_STR | 344 #undef SET_STR |
321 | 345 |
322 #undef SET_EXTENSION | 346 #undef SET_EXTENSION |
323 | 347 |
324 } // namespace browser_sync | 348 } // namespace browser_sync |
OLD | NEW |