OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_SYNC_JS_EVENT_DETAILS_H_ | |
6 #define CHROME_BROWSER_SYNC_JS_EVENT_DETAILS_H_ | |
7 #pragma once | |
8 | |
9 // See README.js for design comments. | |
10 | |
11 #include <string> | |
12 | |
13 #include "base/memory/ref_counted.h" | |
14 #include "base/values.h" | |
15 #include "chrome/browser/sync/shared_value.h" | |
16 | |
17 namespace browser_sync { | |
18 | |
19 // A thread-safe wrapper around an immutable DictionaryValue. Used | |
20 // for passing around event details to different threads. | |
21 class JsEventDetails { | |
22 public: | |
23 // Uses an empty dictionary. | |
24 JsEventDetails(); | |
25 | |
26 // Takes over the data in |details|, leaving |details| empty. | |
27 explicit JsEventDetails(DictionaryValue* details); | |
28 | |
29 ~JsEventDetails(); | |
30 | |
31 const DictionaryValue& Get() const; | |
32 | |
33 std::string ToString() const; | |
34 | |
35 // Copy constructor and assignment operator welcome. | |
36 | |
37 private: | |
38 scoped_refptr<const SharedValue<DictionaryValue> > details_; | |
39 }; | |
40 | |
41 } // namespace browser_sync | |
42 | |
43 #endif // CHROME_BROWSER_SYNC_JS_EVENT_DETAILS_H_ | |
OLD | NEW |