OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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" |
(...skipping 17 matching lines...) Expand all Loading... |
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( |
| 39 UnrecoverableErrorHandler* error_handler, |
| 40 SessionModelAssociator* session_model_associator, |
| 41 bool setup_for_test); |
38 virtual ~SessionChangeProcessor(); | 42 virtual ~SessionChangeProcessor(); |
39 | 43 |
40 // NotificationObserver implementation. | 44 // NotificationObserver implementation. |
41 // BrowserSessionProvider -> sync_api model change application. | 45 // BrowserSessionProvider -> sync_api model change application. |
42 virtual void Observe(NotificationType type, | 46 virtual void Observe(NotificationType type, |
43 const NotificationSource& source, | 47 const NotificationSource& source, |
44 const NotificationDetails& details); | 48 const NotificationDetails& details); |
45 | 49 |
46 // ChangeProcessor implementation. | 50 // ChangeProcessor implementation. |
47 // sync_api model -> BrowserSessionProvider change application. | 51 // sync_api model -> BrowserSessionProvider change application. |
48 virtual void ApplyChangesFromSyncModel( | 52 virtual void ApplyChangesFromSyncModel( |
49 const sync_api::BaseTransaction* trans, | 53 const sync_api::BaseTransaction* trans, |
50 const sync_api::SyncManager::ChangeRecord* changes, | 54 const sync_api::SyncManager::ChangeRecord* changes, |
51 int change_count); | 55 int change_count); |
52 | 56 |
53 protected: | 57 protected: |
54 // ChangeProcessor implementation. | 58 // ChangeProcessor implementation. |
55 virtual void StartImpl(Profile* profile); | 59 virtual void StartImpl(Profile* profile); |
56 virtual void StopImpl(); | 60 virtual void StopImpl(); |
57 private: | 61 private: |
58 void StartObserving(); | 62 void StartObserving(); |
59 void StopObserving(); | 63 void StopObserving(); |
60 SessionModelAssociator* session_model_associator_; | 64 SessionModelAssociator* session_model_associator_; |
61 NotificationRegistrar notification_registrar_; | 65 NotificationRegistrar notification_registrar_; |
62 | 66 |
63 // Owner of the SessionService. Non-NULL iff |running()| is true. | 67 // Owner of the SessionService. Non-NULL iff |running()| is true. |
64 Profile* profile_; | 68 Profile* profile_; |
65 | 69 |
| 70 // To bypass some checks/codepaths not applicable in tests. |
| 71 bool setup_for_test_; |
| 72 |
66 DISALLOW_COPY_AND_ASSIGN(SessionChangeProcessor); | 73 DISALLOW_COPY_AND_ASSIGN(SessionChangeProcessor); |
67 }; | 74 }; |
68 | 75 |
69 } // namespace browser_sync | 76 } // namespace browser_sync |
70 | 77 |
71 #endif // CHROME_BROWSER_SYNC_GLUE_SESSION_CHANGE_PROCESSOR_H_ | 78 #endif // CHROME_BROWSER_SYNC_GLUE_SESSION_CHANGE_PROCESSOR_H_ |
OLD | NEW |