| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SESSION_CHANGE_PROCESSOR_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SESSION_CHANGE_PROCESSOR_H_ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_SESSION_CHANGE_PROCESSOR_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_SESSION_CHANGE_PROCESSOR_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "chrome/browser/sessions/session_backend.h" | 10 #include "chrome/browser/sessions/session_backend.h" |
| 11 #include "chrome/browser/sessions/session_service.h" | 11 #include "chrome/browser/sessions/session_service.h" |
| 12 #include "chrome/browser/sync/engine/syncapi.h" | 12 #include "chrome/browser/sync/engine/syncapi.h" |
| 13 #include "chrome/browser/sync/glue/change_processor.h" | 13 #include "chrome/browser/sync/glue/change_processor.h" |
| 14 #include "content/common/content_notification_types.h" |
| 14 #include "content/common/notification_observer.h" | 15 #include "content/common/notification_observer.h" |
| 15 #include "content/common/notification_registrar.h" | 16 #include "content/common/notification_registrar.h" |
| 16 #include "content/common/notification_type.h" | |
| 17 | 17 |
| 18 class NotificationDetails; | 18 class NotificationDetails; |
| 19 class NotificationSource; | 19 class NotificationSource; |
| 20 class Profile; | 20 class Profile; |
| 21 | 21 |
| 22 namespace browser_sync { | 22 namespace browser_sync { |
| 23 | 23 |
| 24 class SessionModelAssociator; | 24 class SessionModelAssociator; |
| 25 class UnrecoverableErrorHandler; | 25 class UnrecoverableErrorHandler; |
| 26 | 26 |
| 27 // This class is responsible for taking changes from the | 27 // This class is responsible for taking changes from the |
| 28 // SessionService and applying them to the sync_api 'syncable' | 28 // SessionService and applying them to the sync_api 'syncable' |
| 29 // model, and vice versa. All operations and use of this class are | 29 // model, and vice versa. All operations and use of this class are |
| 30 // from the UI thread. | 30 // from the UI thread. |
| 31 class SessionChangeProcessor : public ChangeProcessor, | 31 class SessionChangeProcessor : public ChangeProcessor, |
| 32 public NotificationObserver { | 32 public NotificationObserver { |
| 33 public: | 33 public: |
| 34 // Does not take ownership of either argument. | 34 // Does not take ownership of either argument. |
| 35 SessionChangeProcessor( | 35 SessionChangeProcessor( |
| 36 UnrecoverableErrorHandler* error_handler, | 36 UnrecoverableErrorHandler* error_handler, |
| 37 SessionModelAssociator* session_model_associator); | 37 SessionModelAssociator* session_model_associator); |
| 38 SessionChangeProcessor( | 38 SessionChangeProcessor( |
| 39 UnrecoverableErrorHandler* error_handler, | 39 UnrecoverableErrorHandler* error_handler, |
| 40 SessionModelAssociator* session_model_associator, | 40 SessionModelAssociator* session_model_associator, |
| 41 bool setup_for_test); | 41 bool setup_for_test); |
| 42 virtual ~SessionChangeProcessor(); | 42 virtual ~SessionChangeProcessor(); |
| 43 | 43 |
| 44 // NotificationObserver implementation. | 44 // NotificationObserver implementation. |
| 45 // BrowserSessionProvider -> sync_api model change application. | 45 // BrowserSessionProvider -> sync_api model change application. |
| 46 virtual void Observe(NotificationType type, | 46 virtual void Observe(int type, |
| 47 const NotificationSource& source, | 47 const NotificationSource& source, |
| 48 const NotificationDetails& details); | 48 const NotificationDetails& details); |
| 49 | 49 |
| 50 // ChangeProcessor implementation. | 50 // ChangeProcessor implementation. |
| 51 // sync_api model -> BrowserSessionProvider change application. | 51 // sync_api model -> BrowserSessionProvider change application. |
| 52 virtual void ApplyChangesFromSyncModel( | 52 virtual void ApplyChangesFromSyncModel( |
| 53 const sync_api::BaseTransaction* trans, | 53 const sync_api::BaseTransaction* trans, |
| 54 const sync_api::SyncManager::ChangeRecord* changes, | 54 const sync_api::SyncManager::ChangeRecord* changes, |
| 55 int change_count); | 55 int change_count); |
| 56 | 56 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 69 | 69 |
| 70 // To bypass some checks/codepaths not applicable in tests. | 70 // To bypass some checks/codepaths not applicable in tests. |
| 71 bool setup_for_test_; | 71 bool setup_for_test_; |
| 72 | 72 |
| 73 DISALLOW_COPY_AND_ASSIGN(SessionChangeProcessor); | 73 DISALLOW_COPY_AND_ASSIGN(SessionChangeProcessor); |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 } // namespace browser_sync | 76 } // namespace browser_sync |
| 77 | 77 |
| 78 #endif // CHROME_BROWSER_SYNC_GLUE_SESSION_CHANGE_PROCESSOR_H_ | 78 #endif // CHROME_BROWSER_SYNC_GLUE_SESSION_CHANGE_PROCESSOR_H_ |
| OLD | NEW |