| 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_JS_EVENT_DETAILS_H_ | 5 #ifndef COMPONENTS_SYNC_JS_JS_EVENT_DETAILS_H_ |
| 6 #define COMPONENTS_SYNC_JS_JS_EVENT_DETAILS_H_ | 6 #define COMPONENTS_SYNC_JS_JS_EVENT_DETAILS_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 "base/values.h" | 12 #include "base/values.h" |
| 13 #include "components/sync/base/immutable.h" | 13 #include "components/sync/base/immutable.h" |
| 14 #include "components/sync/base/sync_export.h" | |
| 15 | 14 |
| 16 namespace syncer { | 15 namespace syncer { |
| 17 | 16 |
| 18 // A thin wrapper around Immutable<DictionaryValue>. Used for passing | 17 // A thin wrapper around Immutable<DictionaryValue>. Used for passing |
| 19 // around event details to different threads. | 18 // around event details to different threads. |
| 20 class SYNC_EXPORT JsEventDetails { | 19 class JsEventDetails { |
| 21 public: | 20 public: |
| 22 // Uses an empty dictionary. | 21 // Uses an empty dictionary. |
| 23 JsEventDetails(); | 22 JsEventDetails(); |
| 24 | 23 |
| 25 // Takes over the data in |details|, leaving |details| empty. | 24 // Takes over the data in |details|, leaving |details| empty. |
| 26 explicit JsEventDetails(base::DictionaryValue* details); | 25 explicit JsEventDetails(base::DictionaryValue* details); |
| 27 | 26 |
| 28 JsEventDetails(const JsEventDetails& other); | 27 JsEventDetails(const JsEventDetails& other); |
| 29 | 28 |
| 30 ~JsEventDetails(); | 29 ~JsEventDetails(); |
| 31 | 30 |
| 32 const base::DictionaryValue& Get() const; | 31 const base::DictionaryValue& Get() const; |
| 33 | 32 |
| 34 std::string ToString() const; | 33 std::string ToString() const; |
| 35 | 34 |
| 36 // Copy constructor and assignment operator welcome. | 35 // Copy constructor and assignment operator welcome. |
| 37 | 36 |
| 38 private: | 37 private: |
| 39 typedef Immutable<base::DictionaryValue, | 38 typedef Immutable<base::DictionaryValue, |
| 40 HasSwapMemFnByPtr<base::DictionaryValue>> | 39 HasSwapMemFnByPtr<base::DictionaryValue>> |
| 41 ImmutableDictionaryValue; | 40 ImmutableDictionaryValue; |
| 42 | 41 |
| 43 ImmutableDictionaryValue details_; | 42 ImmutableDictionaryValue details_; |
| 44 }; | 43 }; |
| 45 | 44 |
| 46 } // namespace syncer | 45 } // namespace syncer |
| 47 | 46 |
| 48 #endif // COMPONENTS_SYNC_JS_JS_EVENT_DETAILS_H_ | 47 #endif // COMPONENTS_SYNC_JS_JS_EVENT_DETAILS_H_ |
| OLD | NEW |