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

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

Issue 7633077: Refactor syncapi.h (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: 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/engine/syncapi.h"
6
7 #include <string>
8
9 #include "base/file_path.h"
10 #include "chrome/browser/sync/syncable/directory_manager.h"
11 #include "chrome/browser/sync/util/cryptographer.h"
12
13 using browser_sync::Cryptographer;
14
15 namespace sync_api {
16
17 static const FilePath::CharType kBookmarkSyncUserSettingsDatabase[] =
tim (not reviewing) 2011/08/15 22:53:55 is this actually used anywhere?
rlarocque 2011/08/16 18:12:46 Apparently not. I'm surprised the compiler didn't
18 FILE_PATH_LITERAL("BookmarkSyncSettings.sqlite3");
19
tim (not reviewing) 2011/08/15 22:53:55 nit - extra newline
rlarocque 2011/08/16 18:12:46 Done.
20
21 // Helper function that converts a PassphraseRequiredReason value to a string.
22 std::string PassphraseRequiredReasonToString(
23 PassphraseRequiredReason reason) {
24 switch (reason) {
25 case REASON_PASSPHRASE_NOT_REQUIRED:
26 return "REASON_PASSPHRASE_NOT_REQUIRED";
27 case REASON_ENCRYPTION:
28 return "REASON_ENCRYPTION";
29 case REASON_DECRYPTION:
30 return "REASON_DECRYPTION";
31 case REASON_SET_PASSPHRASE_FAILED:
32 return "REASON_SET_PASSPHRASE_FAILED";
33 default:
34 NOTREACHED();
35 return "INVALID_REASON";
36 }
37 }
38
39 // Helper function to determine if initial sync had ended for types.
40 bool InitialSyncEndedForTypes(syncable::ModelTypeSet types,
41 sync_api::UserShare* share) {
42 syncable::ScopedDirLookup lookup(share->dir_manager.get(),
43 share->name);
44 if (!lookup.good()) {
45 DCHECK(false) << "ScopedDirLookup failed when checking initial sync";
46 return false;
47 }
48
49 for (syncable::ModelTypeSet::const_iterator i = types.begin();
50 i != types.end(); ++i) {
51 if (!lookup->initial_sync_ended_for_type(*i))
52 return false;
53 }
54 return true;
55 }
56
tim (not reviewing) 2011/08/15 22:53:55 nit - extra newline
rlarocque 2011/08/16 18:12:46 Done.
57
58 syncable::ModelTypeSet GetEncryptedTypes(
59 const sync_api::BaseTransaction* trans) {
60 Cryptographer* cryptographer = trans->GetCryptographer();
61 return cryptographer->GetEncryptedTypes();
62 }
63
64 } // namespace sync_api
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698