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

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

Issue 3110008: Massive refactoring of extensions sync code (Closed) Base URL: 76.121.192.83:~/projects/chromium/src
Patch Set: Fixed compile error Created 10 years, 4 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
OLDNEW
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_EXTENSION_CHANGE_PROCESSOR_H_ 5 #ifndef CHROME_BROWSER_SYNC_GLUE_EXTENSION_CHANGE_PROCESSOR_H_
6 #define CHROME_BROWSER_SYNC_GLUE_EXTENSION_CHANGE_PROCESSOR_H_ 6 #define CHROME_BROWSER_SYNC_GLUE_EXTENSION_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/sync/engine/syncapi.h" 10 #include "chrome/browser/sync/engine/syncapi.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/extension_sync_traits.h"
12 #include "chrome/common/notification_observer.h" 13 #include "chrome/common/notification_observer.h"
13 #include "chrome/common/notification_type.h" 14 #include "chrome/common/notification_type.h"
14 #include "chrome/common/notification_registrar.h" 15 #include "chrome/common/notification_registrar.h"
15 16
17 class ExtensionsService;
16 class NotificationDetails; 18 class NotificationDetails;
17 class NotificationSource; 19 class NotificationSource;
18 class Profile; 20 class Profile;
19 21
20 namespace browser_sync { 22 namespace browser_sync {
21 23
22 class ExtensionModelAssociator;
23 class UnrecoverableErrorHandler; 24 class UnrecoverableErrorHandler;
24 25
25 // This class is responsible for taking changes from the 26 // This class is responsible for taking changes from the
26 // ExtensionService and applying them to the sync_api 'syncable' 27 // ExtensionService and applying them to the sync_api 'syncable'
27 // model, and vice versa. All operations and use of this class are 28 // model, and vice versa. All operations and use of this class are
28 // from the UI thread. 29 // from the UI thread.
29 class ExtensionChangeProcessor : public ChangeProcessor, 30 class ExtensionChangeProcessor : public ChangeProcessor,
30 public NotificationObserver { 31 public NotificationObserver {
31 public: 32 public:
32 // Does not take ownership of either argument. 33 // Does not take ownership of |error_handler|.
33 // 34 explicit ExtensionChangeProcessor(
34 // TODO(akalin): Create a Delegate interface and take that instead. 35 UnrecoverableErrorHandler* error_handler);
35 // That'll enable us to unit test this class.
36 ExtensionChangeProcessor(
37 UnrecoverableErrorHandler* error_handler,
38 ExtensionModelAssociator* extension_model_associator);
39 virtual ~ExtensionChangeProcessor(); 36 virtual ~ExtensionChangeProcessor();
40 37
41 // NotificationObserver implementation. 38 // NotificationObserver implementation.
42 // BrowserExtensionProvider -> sync_api model change application. 39 // BrowserExtensionProvider -> sync_api model change application.
43 virtual void Observe(NotificationType type, 40 virtual void Observe(NotificationType type,
44 const NotificationSource& source, 41 const NotificationSource& source,
45 const NotificationDetails& details); 42 const NotificationDetails& details);
46 43
47 // ChangeProcessor implementation. 44 // ChangeProcessor implementation.
48 // sync_api model -> BrowserExtensionProvider change application. 45 // sync_api model -> BrowserExtensionProvider change application.
49 virtual void ApplyChangesFromSyncModel( 46 virtual void ApplyChangesFromSyncModel(
50 const sync_api::BaseTransaction* trans, 47 const sync_api::BaseTransaction* trans,
51 const sync_api::SyncManager::ChangeRecord* changes, 48 const sync_api::SyncManager::ChangeRecord* changes,
52 int change_count); 49 int change_count);
53 50
54 protected: 51 protected:
55 // ChangeProcessor implementation. 52 // ChangeProcessor implementation.
56 virtual void StartImpl(Profile* profile); 53 virtual void StartImpl(Profile* profile);
57 virtual void StopImpl(); 54 virtual void StopImpl();
58 55
59 private: 56 private:
60 void StartObserving(); 57 void StartObserving();
61 void StopObserving(); 58 void StopObserving();
62 59
63 ExtensionModelAssociator* extension_model_associator_;
64 NotificationRegistrar notification_registrar_; 60 NotificationRegistrar notification_registrar_;
61 const ExtensionSyncTraits traits_;
65 // Owner of the ExtensionService. Non-NULL iff |running()| is true. 62 // Owner of the ExtensionService. Non-NULL iff |running()| is true.
66 Profile* profile_; 63 Profile* profile_;
67 64
68 DISALLOW_COPY_AND_ASSIGN(ExtensionChangeProcessor); 65 DISALLOW_COPY_AND_ASSIGN(ExtensionChangeProcessor);
69 }; 66 };
70 67
71 } // namespace browser_sync 68 } // namespace browser_sync
72 69
73 #endif // CHROME_BROWSER_SYNC_GLUE_EXTENSION_CHANGE_PROCESSOR_H_ 70 #endif // CHROME_BROWSER_SYNC_GLUE_EXTENSION_CHANGE_PROCESSOR_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extensions_service.cc ('k') | chrome/browser/sync/glue/extension_change_processor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698