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

Side by Side Diff: chrome/browser/sync/glue/session_change_processor.h

Issue 10698014: [Sync] Rename csync namespace to syncer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/compiler_specific.h"
11 #include "chrome/browser/sync/glue/change_processor.h" 11 #include "chrome/browser/sync/glue/change_processor.h"
12 #include "chrome/browser/sync/glue/data_type_error_handler.h" 12 #include "chrome/browser/sync/glue/data_type_error_handler.h"
13 #include "content/public/browser/notification_observer.h" 13 #include "content/public/browser/notification_observer.h"
14 #include "content/public/browser/notification_registrar.h" 14 #include "content/public/browser/notification_registrar.h"
15 #include "content/public/browser/notification_types.h" 15 #include "content/public/browser/notification_types.h"
16 16
17 class Profile; 17 class Profile;
18 18
19 namespace browser_sync { 19 namespace browser_sync {
20 20
21 class SessionModelAssociator; 21 class SessionModelAssociator;
22 class DataTypeErrorHandler; 22 class DataTypeErrorHandler;
23 23
24 // This class is responsible for taking changes from the 24 // This class is responsible for taking changes from the
25 // SessionService and applying them to the csync 'syncable' 25 // SessionService and applying them to the sync API 'syncable'
26 // model, and vice versa. All operations and use of this class are 26 // model, and vice versa. All operations and use of this class are
27 // from the UI thread. 27 // from the UI thread.
28 class SessionChangeProcessor : public ChangeProcessor, 28 class SessionChangeProcessor : public ChangeProcessor,
29 public content::NotificationObserver { 29 public content::NotificationObserver {
30 public: 30 public:
31 // Does not take ownership of either argument. 31 // Does not take ownership of either argument.
32 SessionChangeProcessor( 32 SessionChangeProcessor(
33 DataTypeErrorHandler* error_handler, 33 DataTypeErrorHandler* error_handler,
34 SessionModelAssociator* session_model_associator); 34 SessionModelAssociator* session_model_associator);
35 // For testing only. 35 // For testing only.
36 SessionChangeProcessor( 36 SessionChangeProcessor(
37 DataTypeErrorHandler* error_handler, 37 DataTypeErrorHandler* error_handler,
38 SessionModelAssociator* session_model_associator, 38 SessionModelAssociator* session_model_associator,
39 bool setup_for_test); 39 bool setup_for_test);
40 virtual ~SessionChangeProcessor(); 40 virtual ~SessionChangeProcessor();
41 41
42 // content::NotificationObserver implementation. 42 // content::NotificationObserver implementation.
43 // BrowserSessionProvider -> csync model change application. 43 // BrowserSessionProvider -> sync API model change application.
44 virtual void Observe(int type, 44 virtual void Observe(int type,
45 const content::NotificationSource& source, 45 const content::NotificationSource& source,
46 const content::NotificationDetails& details) OVERRIDE; 46 const content::NotificationDetails& details) OVERRIDE;
47 47
48 // ChangeProcessor implementation. 48 // ChangeProcessor implementation.
49 // csync model -> BrowserSessionProvider change application. 49 // sync API model -> BrowserSessionProvider change application.
50 virtual void ApplyChangesFromSyncModel( 50 virtual void ApplyChangesFromSyncModel(
51 const csync::BaseTransaction* trans, 51 const syncer::BaseTransaction* trans,
52 const csync::ImmutableChangeRecordList& changes) OVERRIDE; 52 const syncer::ImmutableChangeRecordList& changes) OVERRIDE;
53 53
54 protected: 54 protected:
55 // ChangeProcessor implementation. 55 // ChangeProcessor implementation.
56 virtual void StartImpl(Profile* profile) OVERRIDE; 56 virtual void StartImpl(Profile* profile) OVERRIDE;
57 virtual void StopImpl() OVERRIDE; 57 virtual void StopImpl() OVERRIDE;
58 58
59 private: 59 private:
60 friend class ScopedStopObserving<SessionChangeProcessor>; 60 friend class ScopedStopObserving<SessionChangeProcessor>;
61 61
62 void StartObserving(); 62 void StartObserving();
63 void StopObserving(); 63 void StopObserving();
64 64
65 SessionModelAssociator* session_model_associator_; 65 SessionModelAssociator* session_model_associator_;
66 content::NotificationRegistrar notification_registrar_; 66 content::NotificationRegistrar notification_registrar_;
67 67
68 // Profile being synced. Non-null if |running()| is true. 68 // Profile being synced. Non-null if |running()| is true.
69 Profile* profile_; 69 Profile* profile_;
70 70
71 // To bypass some checks/codepaths not applicable in tests. 71 // To bypass some checks/codepaths not applicable in tests.
72 bool setup_for_test_; 72 bool setup_for_test_;
73 73
74 DISALLOW_COPY_AND_ASSIGN(SessionChangeProcessor); 74 DISALLOW_COPY_AND_ASSIGN(SessionChangeProcessor);
75 }; 75 };
76 76
77 } // namespace browser_sync 77 } // namespace browser_sync
78 78
79 #endif // CHROME_BROWSER_SYNC_GLUE_SESSION_CHANGE_PROCESSOR_H_ 79 #endif // CHROME_BROWSER_SYNC_GLUE_SESSION_CHANGE_PROCESSOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698