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

Unified Diff: chrome/browser/sync/glue/password_change_processor.h

Issue 1851004: Adding sync support for Passwords (Closed)
Patch Set: Ready for checkin Created 10 years, 7 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/glue/password_change_processor.h
diff --git a/chrome/browser/sync/glue/password_change_processor.h b/chrome/browser/sync/glue/password_change_processor.h
new file mode 100644
index 0000000000000000000000000000000000000000..6ca3dbb571673ba31fb19a2bfbcf2d111993ac7a
--- /dev/null
+++ b/chrome/browser/sync/glue/password_change_processor.h
@@ -0,0 +1,79 @@
+// Copyright (c) 2010 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.
+
+#ifndef CHROME_BROWSER_SYNC_GLUE_PASSWORD_CHANGE_PROCESSOR_H_
+#define CHROME_BROWSER_SYNC_GLUE_PASSWORD_CHANGE_PROCESSOR_H_
+
+#include "chrome/browser/sync/glue/change_processor.h"
+
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/sync/glue/sync_backend_host.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+#include "chrome/common/notification_type.h"
+
+class PasswordStore;
+class MessageLoop;
+class NotificationService;
+
+namespace browser_sync {
+
+class PasswordModelAssociator;
+class UnrecoverableErrorHandler;
+
+// This class is responsible for taking changes from the password backend and
+// applying them to the sync_api 'syncable' model, and vice versa. All
+// operations and use of this class are from the DB thread on Windows and Linux,
+// or the password thread on Mac.
+class PasswordChangeProcessor : public ChangeProcessor,
+ public NotificationObserver {
+ public:
+ PasswordChangeProcessor(PasswordModelAssociator* model_associator,
+ PasswordStore* password_store,
+ UnrecoverableErrorHandler* error_handler);
+ virtual ~PasswordChangeProcessor();
+
+ // NotificationObserver implementation.
+ // Passwords -> sync_api model change application.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // sync_api model -> WebDataService change application.
+ virtual void ApplyChangesFromSyncModel(
+ const sync_api::BaseTransaction* trans,
+ const sync_api::SyncManager::ChangeRecord* changes,
+ int change_count);
+
+ protected:
+ virtual void StartImpl(Profile* profile);
+ virtual void StopImpl();
+
+ private:
+ void StartObserving();
+ void StopObserving();
+
+ // The two models should be associated according to this ModelAssociator.
+ PasswordModelAssociator* model_associator_;
+
+ // The model we are processing changes from. This is owned by the
+ // WebDataService which is kept alive by our data type controller
+ // holding a reference.
+ PasswordStore* password_store_;
+
+ NotificationRegistrar notification_registrar_;
+
+ bool observing_;
+
+ MessageLoop* expected_loop_;
+
+ DISALLOW_COPY_AND_ASSIGN(PasswordChangeProcessor);
+};
+
+} // namespace browser_sync
+
+#endif // CHROME_BROWSER_SYNC_GLUE_PASSWORD_CHANGE_PROCESSOR_H_
« no previous file with comments | « chrome/browser/sync/glue/data_type_manager_impl.cc ('k') | chrome/browser/sync/glue/password_change_processor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698