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

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

Issue 3133022: sync: take two for: "Added classes to enable session sync... (Closed)
Patch Set: Created 10 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/glue/session_change_processor.h
diff --git a/chrome/browser/sync/glue/session_change_processor.h b/chrome/browser/sync/glue/session_change_processor.h
new file mode 100644
index 0000000000000000000000000000000000000000..549c6df7b4853a4731786d5c41570c6ca2a8ee32
--- /dev/null
+++ b/chrome/browser/sync/glue/session_change_processor.h
@@ -0,0 +1,75 @@
+// 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_SESSION_CHANGE_PROCESSOR_H_
+#define CHROME_BROWSER_SYNC_GLUE_SESSION_CHANGE_PROCESSOR_H_
+#pragma once
+
+#include <vector>
+#include "base/basictypes.h"
+#include "chrome/browser/sessions/session_backend.h"
+#include "chrome/browser/sessions/session_service.h"
+#include "chrome/browser/sync/engine/syncapi.h"
+#include "chrome/browser/sync/glue/change_processor.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_type.h"
+#include "chrome/common/notification_registrar.h"
+
+class NotificationDetails;
+class NotificationSource;
+class Profile;
+
+namespace browser_sync {
+
+class SessionModelAssociator;
+class UnrecoverableErrorHandler;
+
+// This class is responsible for taking changes from the
+// SessionService and applying them to the sync_api 'syncable'
+// model, and vice versa. All operations and use of this class are
+// from the UI thread.
+class SessionChangeProcessor : public ChangeProcessor,
+ public NotificationObserver {
+ public:
+ // Does not take ownership of either argument.
+ SessionChangeProcessor(
+ UnrecoverableErrorHandler* error_handler,
+ SessionModelAssociator* session_model_associator);
+ virtual ~SessionChangeProcessor();
+
+ // NotificationObserver implementation.
+ // BrowserSessionProvider -> sync_api model change application.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // ChangeProcessor implementation.
+ // sync_api model -> BrowserSessionProvider change application.
+ virtual void ApplyChangesFromSyncModel(
+ const sync_api::BaseTransaction* trans,
+ const sync_api::SyncManager::ChangeRecord* changes,
+ int change_count);
+
+ protected:
+ // ChangeProcessor implementation.
+ virtual void StartImpl(Profile* profile);
+ virtual void StopImpl();
+ private:
+ void StartObserving();
+ void StopObserving();
+ void UpdateModel(const sync_api::BaseTransaction* trans,
+ const sync_api::SyncManager::ChangeRecord& change, bool associate);
+ SessionModelAssociator* session_model_associator_;
+ NotificationRegistrar notification_registrar_;
+
+ // Owner of the SessionService. Non-NULL iff |running()| is true.
+ Profile* profile_;
+
+ DISALLOW_COPY_AND_ASSIGN(SessionChangeProcessor);
+};
+
+} // namespace browser_sync
+
+#endif // CHROME_BROWSER_SYNC_GLUE_SESSION_CHANGE_PROCESSOR_H_
+
« no previous file with comments | « chrome/browser/sync/glue/data_type_manager_impl.cc ('k') | chrome/browser/sync/glue/session_change_processor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698