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

Side by Side Diff: chrome/browser/sync/engine/syncapi_internal.cc

Issue 9460047: sync: remove use of protobuf extensions in protocol to reduce static init overhead. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fred's review Created 8 years, 9 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) 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 #include "chrome/browser/sync/engine/syncapi_internal.h" 5 #include "chrome/browser/sync/engine/syncapi_internal.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "chrome/browser/sync/util/cryptographer.h" 8 #include "chrome/browser/sync/util/cryptographer.h"
9 #include "chrome/browser/sync/protocol/password_specifics.pb.h" 9 #include "chrome/browser/sync/protocol/password_specifics.pb.h"
10 #include "chrome/browser/sync/protocol/sync.pb.h"
10 11
11 using browser_sync::Cryptographer; 12 using browser_sync::Cryptographer;
12 13
13 namespace sync_api { 14 namespace sync_api {
14 15
15 sync_pb::PasswordSpecificsData* DecryptPasswordSpecifics( 16 sync_pb::PasswordSpecificsData* DecryptPasswordSpecifics(
16 const sync_pb::EntitySpecifics& specifics, Cryptographer* crypto) { 17 const sync_pb::EntitySpecifics& specifics, Cryptographer* crypto) {
17 if (!specifics.HasExtension(sync_pb::password)) 18 if (!specifics.has_password())
18 return NULL; 19 return NULL;
19 const sync_pb::PasswordSpecifics& password_specifics = 20 const sync_pb::PasswordSpecifics& password_specifics = specifics.password();
20 specifics.GetExtension(sync_pb::password);
21 if (!password_specifics.has_encrypted()) 21 if (!password_specifics.has_encrypted())
22 return NULL; 22 return NULL;
23 const sync_pb::EncryptedData& encrypted = password_specifics.encrypted(); 23 const sync_pb::EncryptedData& encrypted = password_specifics.encrypted();
24 scoped_ptr<sync_pb::PasswordSpecificsData> data( 24 scoped_ptr<sync_pb::PasswordSpecificsData> data(
25 new sync_pb::PasswordSpecificsData); 25 new sync_pb::PasswordSpecificsData);
26 if (!crypto->Decrypt(encrypted, data.get())) 26 if (!crypto->Decrypt(encrypted, data.get()))
27 return NULL; 27 return NULL;
28 return data.release(); 28 return data.release();
29 } 29 }
30 30
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 } else { 78 } else {
79 right_plaintext = right.SerializeAsString(); 79 right_plaintext = right.SerializeAsString();
80 } 80 }
81 if (left_plaintext == right_plaintext) { 81 if (left_plaintext == right_plaintext) {
82 return true; 82 return true;
83 } 83 }
84 return false; 84 return false;
85 } 85 }
86 86
87 } // namespace sync_api 87 } // namespace sync_api
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/store_timestamps_command.cc ('k') | chrome/browser/sync/engine/syncer_proto_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698