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

Side by Side Diff: chrome/browser/sync/internal_api/syncapi_functions.cc

Issue 7633077: Refactor syncapi.h (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Set of patches to refactor syncapi.h Created 9 years, 4 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/sync/internal_api/syncapi_functions.h"
6
7 #include <string>
8
9 #include "base/file_path.h"
10 #include "chrome/browser/sync/internal_api/base_transaction.h"
11 #include "chrome/browser/sync/internal_api/user_share.h"
12 #include "chrome/browser/sync/syncable/directory_manager.h"
13 #include "chrome/browser/sync/util/cryptographer.h"
14
15 using browser_sync::Cryptographer;
16
17 namespace sync_api {
18
19 // Helper function that converts a PassphraseRequiredReason value to a string.
20 std::string PassphraseRequiredReasonToString(
Nicolas Zea 2011/08/16 19:39:07 I think this should be in sync_manager.h (where pa
rlarocque 2011/08/16 22:19:19 Done.
21 PassphraseRequiredReason reason) {
22 switch (reason) {
23 case REASON_PASSPHRASE_NOT_REQUIRED:
24 return "REASON_PASSPHRASE_NOT_REQUIRED";
25 case REASON_ENCRYPTION:
26 return "REASON_ENCRYPTION";
27 case REASON_DECRYPTION:
28 return "REASON_DECRYPTION";
29 case REASON_SET_PASSPHRASE_FAILED:
30 return "REASON_SET_PASSPHRASE_FAILED";
31 default:
32 NOTREACHED();
33 return "INVALID_REASON";
34 }
35 }
36
37 // Helper function to determine if initial sync had ended for types.
38 bool InitialSyncEndedForTypes(syncable::ModelTypeSet types,
Nicolas Zea 2011/08/16 19:39:07 This one too.
rlarocque 2011/08/16 22:19:19 Done.
39 sync_api::UserShare* share) {
40 syncable::ScopedDirLookup lookup(share->dir_manager.get(),
41 share->name);
42 if (!lookup.good()) {
43 DCHECK(false) << "ScopedDirLookup failed when checking initial sync";
44 return false;
45 }
46
47 for (syncable::ModelTypeSet::const_iterator i = types.begin();
48 i != types.end(); ++i) {
49 if (!lookup->initial_sync_ended_for_type(*i))
50 return false;
51 }
52 return true;
53 }
54
55 syncable::ModelTypeSet GetEncryptedTypes(
Nicolas Zea 2011/08/16 19:39:07 This can be in basetransaction.h
rlarocque 2011/08/16 22:19:19 Done. Now I can delete this file. Woo-hoo!
56 const sync_api::BaseTransaction* trans) {
57 Cryptographer* cryptographer = trans->GetCryptographer();
58 return cryptographer->GetEncryptedTypes();
59 }
60
61 } // namespace sync_api
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698