OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 COMPONENTS_SYNC_JS_SYNC_JS_CONTROLLER_H_ | 5 #ifndef COMPONENTS_SYNC_JS_SYNC_JS_CONTROLLER_H_ |
6 #define COMPONENTS_SYNC_JS_SYNC_JS_CONTROLLER_H_ | 6 #define COMPONENTS_SYNC_JS_SYNC_JS_CONTROLLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
15 #include "components/sync/base/sync_export.h" | |
16 #include "components/sync/base/weak_handle.h" | 15 #include "components/sync/base/weak_handle.h" |
17 #include "components/sync/js/js_controller.h" | 16 #include "components/sync/js/js_controller.h" |
18 #include "components/sync/js/js_event_handler.h" | 17 #include "components/sync/js/js_event_handler.h" |
19 | 18 |
20 namespace syncer { | 19 namespace syncer { |
21 | 20 |
22 class JsBackend; | 21 class JsBackend; |
23 | 22 |
24 // A class that mediates between the sync JsEventHandlers and the sync | 23 // A class that mediates between the sync JsEventHandlers and the sync |
25 // JsBackend. | 24 // JsBackend. |
26 class SYNC_EXPORT SyncJsController | 25 class SyncJsController : public JsController, |
27 : public JsController, | 26 public JsEventHandler, |
28 public JsEventHandler, | 27 public base::SupportsWeakPtr<SyncJsController> { |
29 public base::SupportsWeakPtr<SyncJsController> { | |
30 public: | 28 public: |
31 SyncJsController(); | 29 SyncJsController(); |
32 | 30 |
33 ~SyncJsController() override; | 31 ~SyncJsController() override; |
34 | 32 |
35 // Sets the backend to route all messages to (if initialized). | 33 // Sets the backend to route all messages to (if initialized). |
36 // Sends any queued-up messages if |backend| is initialized. | 34 // Sends any queued-up messages if |backend| is initialized. |
37 void AttachJsBackend(const WeakHandle<JsBackend>& js_backend); | 35 void AttachJsBackend(const WeakHandle<JsBackend>& js_backend); |
38 | 36 |
39 // JsController implementation. | 37 // JsController implementation. |
(...skipping 11 matching lines...) Expand all Loading... |
51 | 49 |
52 WeakHandle<JsBackend> js_backend_; | 50 WeakHandle<JsBackend> js_backend_; |
53 base::ObserverList<JsEventHandler> js_event_handlers_; | 51 base::ObserverList<JsEventHandler> js_event_handlers_; |
54 | 52 |
55 DISALLOW_COPY_AND_ASSIGN(SyncJsController); | 53 DISALLOW_COPY_AND_ASSIGN(SyncJsController); |
56 }; | 54 }; |
57 | 55 |
58 } // namespace syncer | 56 } // namespace syncer |
59 | 57 |
60 #endif // COMPONENTS_SYNC_JS_SYNC_JS_CONTROLLER_H_ | 58 #endif // COMPONENTS_SYNC_JS_SYNC_JS_CONTROLLER_H_ |
OLD | NEW |