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

Side by Side Diff: sync/js/js_controller.h

Issue 11515009: [sync] Componentize sync: Part 2: Add SYNC_EXPORTs to files in src/sync/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR Feedback Created 8 years 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
« no previous file with comments | « sync/js/js_arg_list.h ('k') | sync/js/js_event_details.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 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 SYNC_JS_JS_CONTROLLER_H_ 5 #ifndef SYNC_JS_JS_CONTROLLER_H_
6 #define SYNC_JS_JS_CONTROLLER_H_ 6 #define SYNC_JS_JS_CONTROLLER_H_
7 7
8 // See README.js for design comments. 8 // See README.js for design comments.
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "sync/base/sync_export.h"
13
12 namespace syncer { 14 namespace syncer {
13 15
14 class JsArgList; 16 class JsArgList;
15 class JsEventHandler; 17 class JsEventHandler;
16 class JsReplyHandler; 18 class JsReplyHandler;
17 template <typename T> class WeakHandle; 19 template <typename T> class WeakHandle;
18 20
19 // An interface for objects that JsEventHandlers directly interact 21 // An interface for objects that JsEventHandlers directly interact
20 // with. JsEventHandlers can add themselves to receive events and 22 // with. JsEventHandlers can add themselves to receive events and
21 // also send messages which will eventually reach the backend. 23 // also send messages which will eventually reach the backend.
22 class JsController { 24 class SYNC_EXPORT JsController {
23 public: 25 public:
24 // Adds an event handler which will start receiving JS events (not 26 // Adds an event handler which will start receiving JS events (not
25 // immediately, so this can be called in the handler's constructor). 27 // immediately, so this can be called in the handler's constructor).
26 // Multiple event handlers are supported, but each event handler 28 // Multiple event handlers are supported, but each event handler
27 // must be added at most once. 29 // must be added at most once.
28 // 30 //
29 // Ideally, we'd take WeakPtrs, but we need the raw pointer values 31 // Ideally, we'd take WeakPtrs, but we need the raw pointer values
30 // to be able to look them up for removal. 32 // to be able to look them up for removal.
31 virtual void AddJsEventHandler(JsEventHandler* event_handler) = 0; 33 virtual void AddJsEventHandler(JsEventHandler* event_handler) = 0;
32 34
33 // Removes the given event handler if it has been added. It will 35 // Removes the given event handler if it has been added. It will
34 // immediately stop receiving any JS events. 36 // immediately stop receiving any JS events.
35 virtual void RemoveJsEventHandler(JsEventHandler* event_handler) = 0; 37 virtual void RemoveJsEventHandler(JsEventHandler* event_handler) = 0;
36 38
37 // Processes a JS message. The reply (if any) will be sent to 39 // Processes a JS message. The reply (if any) will be sent to
38 // |reply_handler| if it is initialized. 40 // |reply_handler| if it is initialized.
39 virtual void ProcessJsMessage( 41 virtual void ProcessJsMessage(
40 const std::string& name, const JsArgList& args, 42 const std::string& name, const JsArgList& args,
41 const WeakHandle<JsReplyHandler>& reply_handler) = 0; 43 const WeakHandle<JsReplyHandler>& reply_handler) = 0;
42 44
43 protected: 45 protected:
44 virtual ~JsController() {} 46 virtual ~JsController() {}
45 }; 47 };
46 48
47 } // namespace syncer 49 } // namespace syncer
48 50
49 #endif // SYNC_JS_JS_CONTROLLER_H_ 51 #endif // SYNC_JS_JS_CONTROLLER_H_
OLDNEW
« no previous file with comments | « sync/js/js_arg_list.h ('k') | sync/js/js_event_details.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698