OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include <cstddef> | 5 #include <cstddef> |
6 #include <cstdio> | 6 #include <cstdio> |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 : public base::SupportsWeakPtr<NullInvalidationStateTracker>, | 69 : public base::SupportsWeakPtr<NullInvalidationStateTracker>, |
70 public InvalidationStateTracker { | 70 public InvalidationStateTracker { |
71 public: | 71 public: |
72 NullInvalidationStateTracker() {} | 72 NullInvalidationStateTracker() {} |
73 virtual ~NullInvalidationStateTracker() {} | 73 virtual ~NullInvalidationStateTracker() {} |
74 | 74 |
75 virtual InvalidationStateMap GetAllInvalidationStates() const OVERRIDE { | 75 virtual InvalidationStateMap GetAllInvalidationStates() const OVERRIDE { |
76 return InvalidationStateMap(); | 76 return InvalidationStateMap(); |
77 } | 77 } |
78 | 78 |
79 virtual void SetMaxVersion( | 79 virtual void SetMaxVersionAndPayload( |
80 const invalidation::ObjectId& id, | 80 const invalidation::ObjectId& id, |
81 int64 max_invalidation_version) OVERRIDE { | 81 int64 max_invalidation_version, |
| 82 const std::string& payload) OVERRIDE { |
82 VLOG(1) << "Setting max invalidation version for " | 83 VLOG(1) << "Setting max invalidation version for " |
83 << ObjectIdToString(id) << " to " << max_invalidation_version; | 84 << ObjectIdToString(id) << " to " << max_invalidation_version |
| 85 << " with payload " << payload; |
84 } | 86 } |
85 | 87 |
86 virtual void Forget(const ObjectIdSet& ids) OVERRIDE { | 88 virtual void Forget(const ObjectIdSet& ids) OVERRIDE { |
87 for (ObjectIdSet::const_iterator it = ids.begin(); it != ids.end(); ++it) { | 89 for (ObjectIdSet::const_iterator it = ids.begin(); it != ids.end(); ++it) { |
88 VLOG(1) << "Forgetting invalidation state for " << ObjectIdToString(*it); | 90 VLOG(1) << "Forgetting invalidation state for " << ObjectIdToString(*it); |
89 } | 91 } |
90 } | 92 } |
91 | 93 |
92 virtual std::string GetBootstrapData() const OVERRIDE { | 94 virtual std::string GetBootstrapData() const OVERRIDE { |
93 return std::string(); | 95 return std::string(); |
94 } | 96 } |
95 | 97 |
96 virtual void SetBootstrapData(const std::string& data) OVERRIDE { | 98 virtual void SetBootstrapData(const std::string& data) OVERRIDE { |
97 std::string base64_data; | 99 std::string base64_data; |
98 CHECK(base::Base64Encode(data, &base64_data)); | 100 CHECK(base::Base64Encode(data, &base64_data)); |
99 VLOG(1) << "Setting bootstrap data to: " << base64_data; | 101 VLOG(1) << "Setting bootstrap data to: " << base64_data; |
100 } | 102 } |
| 103 |
| 104 virtual void GenerateAckHandles( |
| 105 const ObjectIdSet& ids, |
| 106 const scoped_refptr<base::TaskRunner>& task_runner, |
| 107 base::Callback<void(const AckHandleMap&)> callback) OVERRIDE { |
| 108 AckHandleMap ack_handles; |
| 109 for (ObjectIdSet::const_iterator it = ids.begin(); it != ids.end(); ++it) { |
| 110 ack_handles.insert(std::make_pair(*it, AckHandle::InvalidAckHandle())); |
| 111 } |
| 112 task_runner->PostTask(FROM_HERE, base::Bind(callback, ack_handles)); |
| 113 } |
| 114 |
| 115 virtual void Acknowledge(const invalidation::ObjectId& id, |
| 116 const AckHandle& ack_handle) OVERRIDE { |
| 117 VLOG(1) << "Received ack for " << ObjectIdToString(id); |
| 118 } |
101 }; | 119 }; |
102 | 120 |
103 // Needed to use a real host resolver. | 121 // Needed to use a real host resolver. |
104 class MyTestURLRequestContext : public net::TestURLRequestContext { | 122 class MyTestURLRequestContext : public net::TestURLRequestContext { |
105 public: | 123 public: |
106 MyTestURLRequestContext() : TestURLRequestContext(true) { | 124 MyTestURLRequestContext() : TestURLRequestContext(true) { |
107 context_storage_.set_host_resolver( | 125 context_storage_.set_host_resolver( |
108 net::HostResolver::CreateDefaultResolver(NULL)); | 126 net::HostResolver::CreateDefaultResolver(NULL)); |
109 context_storage_.set_transport_security_state( | 127 context_storage_.set_transport_security_state( |
110 new net::TransportSecurityState()); | 128 new net::TransportSecurityState()); |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 io_thread.Stop(); | 408 io_thread.Stop(); |
391 return 0; | 409 return 0; |
392 } | 410 } |
393 | 411 |
394 } // namespace | 412 } // namespace |
395 } // namespace syncer | 413 } // namespace syncer |
396 | 414 |
397 int main(int argc, char* argv[]) { | 415 int main(int argc, char* argv[]) { |
398 return syncer::SyncClientMain(argc, argv); | 416 return syncer::SyncClientMain(argc, argv); |
399 } | 417 } |
OLD | NEW |