| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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_ENGINE_EVENTS_PROTOCOL_EVENT_H_ | 5 #ifndef COMPONENTS_SYNC_ENGINE_EVENTS_PROTOCOL_EVENT_H_ |
| 6 #define COMPONENTS_SYNC_ENGINE_EVENTS_PROTOCOL_EVENT_H_ | 6 #define COMPONENTS_SYNC_ENGINE_EVENTS_PROTOCOL_EVENT_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "components/sync/base/sync_export.h" | |
| 14 | 13 |
| 15 namespace syncer { | 14 namespace syncer { |
| 16 | 15 |
| 17 // SyncNetworkEvents represent a single client <-> server sync protocol event | 16 // SyncNetworkEvents represent a single client <-> server sync protocol event |
| 18 // that recently took place. Sync protocol events occur when the client decides | 17 // that recently took place. Sync protocol events occur when the client decides |
| 19 // to send a sync protocol request (such as GetUpdates or Commit) to the server, | 18 // to send a sync protocol request (such as GetUpdates or Commit) to the server, |
| 20 // and when the server responds. Note that the requests and responses themselves | 19 // and when the server responds. Note that the requests and responses themselves |
| 21 // are modelled by {GetUpdates, Commit}x{Request,Response} objects. | 20 // are modelled by {GetUpdates, Commit}x{Request,Response} objects. |
| 22 // | 21 // |
| 23 // These objects are intended to be used for displaying information on | 22 // These objects are intended to be used for displaying information on |
| 24 // about:sync. They should be considered to be immutable and opaque. No | 23 // about:sync. They should be considered to be immutable and opaque. No |
| 25 // program behavior should depend on their contents. | 24 // program behavior should depend on their contents. |
| 26 // | 25 // |
| 27 // Each type of request can maintain its own set of additional metadata and have | 26 // Each type of request can maintain its own set of additional metadata and have |
| 28 // its own custom serialization routines. For example, the "configure" | 27 // its own custom serialization routines. For example, the "configure" |
| 29 // GetUpdates request will include information about its "origin" in its debug | 28 // GetUpdates request will include information about its "origin" in its debug |
| 30 // info. | 29 // info. |
| 31 class SYNC_EXPORT ProtocolEvent { | 30 class ProtocolEvent { |
| 32 public: | 31 public: |
| 33 ProtocolEvent(); | 32 ProtocolEvent(); |
| 34 virtual ~ProtocolEvent(); | 33 virtual ~ProtocolEvent(); |
| 35 | 34 |
| 36 // Returns the time when the request was sent or received. | 35 // Returns the time when the request was sent or received. |
| 37 virtual base::Time GetTimestamp() const = 0; | 36 virtual base::Time GetTimestamp() const = 0; |
| 38 | 37 |
| 39 // Returns a string representing they type of the request. Should be short. | 38 // Returns a string representing they type of the request. Should be short. |
| 40 virtual std::string GetType() const = 0; | 39 virtual std::string GetType() const = 0; |
| 41 | 40 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 52 | 51 |
| 53 // A static function that assembles the data exposed through the | 52 // A static function that assembles the data exposed through the |
| 54 // ProtocolEvent's interface into a single DictionaryValue. | 53 // ProtocolEvent's interface into a single DictionaryValue. |
| 55 static std::unique_ptr<base::DictionaryValue> ToValue( | 54 static std::unique_ptr<base::DictionaryValue> ToValue( |
| 56 const ProtocolEvent& event); | 55 const ProtocolEvent& event); |
| 57 }; | 56 }; |
| 58 | 57 |
| 59 } // namespace syncer | 58 } // namespace syncer |
| 60 | 59 |
| 61 #endif // COMPONENTS_SYNC_ENGINE_EVENTS_PROTOCOL_EVENT_H_ | 60 #endif // COMPONENTS_SYNC_ENGINE_EVENTS_PROTOCOL_EVENT_H_ |
| OLD | NEW |