| 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 "base/compiler_specific.h" |
| 10 #include "chrome/browser/sessions/session_backend.h" | 11 #include "chrome/browser/sessions/session_backend.h" |
| 11 #include "chrome/browser/sessions/session_service.h" | 12 #include "chrome/browser/sessions/session_service.h" |
| 12 #include "chrome/browser/sync/glue/change_processor.h" | 13 #include "chrome/browser/sync/glue/change_processor.h" |
| 13 #include "chrome/browser/sync/internal_api/sync_manager.h" | |
| 14 #include "content/common/content_notification_types.h" | 14 #include "content/common/content_notification_types.h" |
| 15 #include "content/common/notification_observer.h" | 15 #include "content/common/notification_observer.h" |
| 16 #include "content/common/notification_registrar.h" | 16 #include "content/common/notification_registrar.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 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 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(int type, | 46 virtual void Observe(int type, |
| 47 const NotificationSource& source, | 47 const NotificationSource& source, |
| 48 const NotificationDetails& details); | 48 const NotificationDetails& details) OVERRIDE; |
| 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::ImmutableChangeRecordList& changes) OVERRIDE; |
| 55 int change_count); | |
| 56 | 55 |
| 57 protected: | 56 protected: |
| 58 // ChangeProcessor implementation. | 57 // ChangeProcessor implementation. |
| 59 virtual void StartImpl(Profile* profile); | 58 virtual void StartImpl(Profile* profile) OVERRIDE; |
| 60 virtual void StopImpl(); | 59 virtual void StopImpl() OVERRIDE; |
| 60 |
| 61 private: | 61 private: |
| 62 void StartObserving(); | 62 void StartObserving(); |
| 63 void StopObserving(); | 63 void StopObserving(); |
| 64 SessionModelAssociator* session_model_associator_; | 64 SessionModelAssociator* session_model_associator_; |
| 65 NotificationRegistrar notification_registrar_; | 65 NotificationRegistrar notification_registrar_; |
| 66 | 66 |
| 67 // Owner of the SessionService. Non-NULL iff |running()| is true. | 67 // Owner of the SessionService. Non-NULL iff |running()| is true. |
| 68 Profile* profile_; | 68 Profile* profile_; |
| 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 |