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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/engine/syncapi_functions.cc
diff --git a/chrome/browser/sync/engine/syncapi_functions.cc b/chrome/browser/sync/engine/syncapi_functions.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7e823a948f09d470b3d32127a9e2d091e473bb75
--- /dev/null
+++ b/chrome/browser/sync/engine/syncapi_functions.cc
@@ -0,0 +1,64 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/sync/engine/syncapi.h"
+
+#include <string>
+
+#include "base/file_path.h"
+#include "chrome/browser/sync/syncable/directory_manager.h"
+#include "chrome/browser/sync/util/cryptographer.h"
+
+using browser_sync::Cryptographer;
+
+namespace sync_api {
+
+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
+ FILE_PATH_LITERAL("BookmarkSyncSettings.sqlite3");
+
tim (not reviewing) 2011/08/15 22:53:55 nit - extra newline
rlarocque 2011/08/16 18:12:46 Done.
+
+// Helper function that converts a PassphraseRequiredReason value to a string.
+std::string PassphraseRequiredReasonToString(
+ PassphraseRequiredReason reason) {
+ switch (reason) {
+ case REASON_PASSPHRASE_NOT_REQUIRED:
+ return "REASON_PASSPHRASE_NOT_REQUIRED";
+ case REASON_ENCRYPTION:
+ return "REASON_ENCRYPTION";
+ case REASON_DECRYPTION:
+ return "REASON_DECRYPTION";
+ case REASON_SET_PASSPHRASE_FAILED:
+ return "REASON_SET_PASSPHRASE_FAILED";
+ default:
+ NOTREACHED();
+ return "INVALID_REASON";
+ }
+}
+
+// Helper function to determine if initial sync had ended for types.
+bool InitialSyncEndedForTypes(syncable::ModelTypeSet types,
+ sync_api::UserShare* share) {
+ syncable::ScopedDirLookup lookup(share->dir_manager.get(),
+ share->name);
+ if (!lookup.good()) {
+ DCHECK(false) << "ScopedDirLookup failed when checking initial sync";
+ return false;
+ }
+
+ for (syncable::ModelTypeSet::const_iterator i = types.begin();
+ i != types.end(); ++i) {
+ if (!lookup->initial_sync_ended_for_type(*i))
+ return false;
+ }
+ return true;
+}
+
tim (not reviewing) 2011/08/15 22:53:55 nit - extra newline
rlarocque 2011/08/16 18:12:46 Done.
+
+syncable::ModelTypeSet GetEncryptedTypes(
+ const sync_api::BaseTransaction* trans) {
+ Cryptographer* cryptographer = trans->GetCryptographer();
+ return cryptographer->GetEncryptedTypes();
+}
+
+} // namespace sync_api

Powered by Google App Engine
This is Rietveld 408576698