| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_SYNC_GLUE_SESSION_CHANGE_PROCESSOR_H_ | 
|  | 6 #define CHROME_BROWSER_SYNC_GLUE_SESSION_CHANGE_PROCESSOR_H_ | 
|  | 7 #pragma once | 
|  | 8 | 
|  | 9 #include <vector> | 
|  | 10 #include "base/basictypes.h" | 
|  | 11 #include "chrome/browser/sessions/session_backend.h" | 
|  | 12 #include "chrome/browser/sessions/session_service.h" | 
|  | 13 #include "chrome/browser/sync/engine/syncapi.h" | 
|  | 14 #include "chrome/browser/sync/glue/change_processor.h" | 
|  | 15 #include "chrome/common/notification_observer.h" | 
|  | 16 #include "chrome/common/notification_type.h" | 
|  | 17 #include "chrome/common/notification_registrar.h" | 
|  | 18 | 
|  | 19 class NotificationDetails; | 
|  | 20 class NotificationSource; | 
|  | 21 class Profile; | 
|  | 22 | 
|  | 23 namespace browser_sync { | 
|  | 24 | 
|  | 25 class SessionModelAssociator; | 
|  | 26 class UnrecoverableErrorHandler; | 
|  | 27 | 
|  | 28 // This class is responsible for taking changes from the | 
|  | 29 // SessionService and applying them to the sync_api 'syncable' | 
|  | 30 // model, and vice versa. All operations and use of this class are | 
|  | 31 // from the UI thread. | 
|  | 32 class SessionChangeProcessor : public ChangeProcessor, | 
|  | 33                                public NotificationObserver { | 
|  | 34  public: | 
|  | 35   // Does not take ownership of either argument. | 
|  | 36   SessionChangeProcessor( | 
|  | 37       UnrecoverableErrorHandler* error_handler, | 
|  | 38       SessionModelAssociator* session_model_associator); | 
|  | 39   virtual ~SessionChangeProcessor(); | 
|  | 40 | 
|  | 41   // NotificationObserver implementation. | 
|  | 42   // BrowserSessionProvider -> sync_api model change application. | 
|  | 43   virtual void Observe(NotificationType type, | 
|  | 44                        const NotificationSource& source, | 
|  | 45                        const NotificationDetails& details); | 
|  | 46 | 
|  | 47   // ChangeProcessor implementation. | 
|  | 48   // sync_api model -> BrowserSessionProvider change application. | 
|  | 49   virtual void ApplyChangesFromSyncModel( | 
|  | 50       const sync_api::BaseTransaction* trans, | 
|  | 51       const sync_api::SyncManager::ChangeRecord* changes, | 
|  | 52       int change_count); | 
|  | 53 | 
|  | 54  protected: | 
|  | 55   // ChangeProcessor implementation. | 
|  | 56   virtual void StartImpl(Profile* profile); | 
|  | 57   virtual void StopImpl(); | 
|  | 58  private: | 
|  | 59   void StartObserving(); | 
|  | 60   void StopObserving(); | 
|  | 61   void UpdateModel(const sync_api::BaseTransaction* trans, | 
|  | 62       const sync_api::SyncManager::ChangeRecord& change, bool associate); | 
|  | 63   SessionModelAssociator* session_model_associator_; | 
|  | 64   NotificationRegistrar notification_registrar_; | 
|  | 65 | 
|  | 66   // Owner of the SessionService.  Non-NULL iff |running()| is true. | 
|  | 67   Profile* profile_; | 
|  | 68 | 
|  | 69   DISALLOW_COPY_AND_ASSIGN(SessionChangeProcessor); | 
|  | 70 }; | 
|  | 71 | 
|  | 72 }  // namespace browser_sync | 
|  | 73 | 
|  | 74 #endif  // CHROME_BROWSER_SYNC_GLUE_SESSION_CHANGE_PROCESSOR_H_ | 
|  | 75 | 
| OLD | NEW | 
|---|