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 "sync/notifier/sync_system_resources.h" | 5 #include "sync/notifier/sync_system_resources.h" |
6 | 6 |
7 #include <cstdlib> | 7 #include <cstdlib> |
8 #include <cstring> | 8 #include <cstring> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
17 #include "google/cacheinvalidation/client_gateway.pb.h" | 17 #include "google/cacheinvalidation/client_gateway.pb.h" |
18 #include "google/cacheinvalidation/deps/callback.h" | 18 #include "google/cacheinvalidation/deps/callback.h" |
19 #include "google/cacheinvalidation/include/types.h" | 19 #include "google/cacheinvalidation/include/types.h" |
| 20 #include "jingle/notifier/listener/push_client.h" |
| 21 #include "sync/notifier/gcm_network_channel.h" |
20 #include "sync/notifier/invalidation_util.h" | 22 #include "sync/notifier/invalidation_util.h" |
| 23 #include "sync/notifier/push_client_channel.h" |
21 | 24 |
22 namespace syncer { | 25 namespace syncer { |
23 | 26 |
24 SyncLogger::SyncLogger() {} | 27 SyncLogger::SyncLogger() {} |
25 SyncLogger::~SyncLogger() {} | 28 SyncLogger::~SyncLogger() {} |
26 | 29 |
27 void SyncLogger::Log(LogLevel level, const char* file, int line, | 30 void SyncLogger::Log(LogLevel level, const char* file, int line, |
28 const char* format, ...) { | 31 const char* format, ...) { |
29 logging::LogSeverity log_severity = -2; // VLOG(2) | 32 logging::LogSeverity log_severity = -2; // VLOG(2) |
30 bool emit_log = false; | 33 bool emit_log = false; |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 } | 164 } |
162 | 165 |
163 void SyncNetworkChannel::AddObserver(Observer* observer) { | 166 void SyncNetworkChannel::AddObserver(Observer* observer) { |
164 observers_.AddObserver(observer); | 167 observers_.AddObserver(observer); |
165 } | 168 } |
166 | 169 |
167 void SyncNetworkChannel::RemoveObserver(Observer* observer) { | 170 void SyncNetworkChannel::RemoveObserver(Observer* observer) { |
168 observers_.RemoveObserver(observer); | 171 observers_.RemoveObserver(observer); |
169 } | 172 } |
170 | 173 |
| 174 scoped_ptr<SyncNetworkChannel> SyncNetworkChannel::CreatePushClientChannel( |
| 175 const notifier::NotifierOptions& notifier_options) { |
| 176 scoped_ptr<notifier::PushClient> push_client( |
| 177 notifier::PushClient::CreateDefaultOnIOThread(notifier_options)); |
| 178 return scoped_ptr<SyncNetworkChannel>( |
| 179 new PushClientChannel(push_client.Pass())); |
| 180 } |
| 181 |
| 182 scoped_ptr<SyncNetworkChannel> SyncNetworkChannel::CreateGCMNetworkChannel() { |
| 183 return scoped_ptr<SyncNetworkChannel>(new GCMNetworkChannel()); |
| 184 } |
| 185 |
171 const std::string& SyncNetworkChannel::GetServiceContextForTest() const { | 186 const std::string& SyncNetworkChannel::GetServiceContextForTest() const { |
172 return service_context_; | 187 return service_context_; |
173 } | 188 } |
174 | 189 |
175 int64 SyncNetworkChannel::GetSchedulingHashForTest() const { | 190 int64 SyncNetworkChannel::GetSchedulingHashForTest() const { |
176 return scheduling_hash_; | 191 return scheduling_hash_; |
177 } | 192 } |
178 | 193 |
179 std::string SyncNetworkChannel::EncodeMessageForTest( | 194 std::string SyncNetworkChannel::EncodeMessageForTest( |
180 const std::string& message, const std::string& service_context, | 195 const std::string& message, const std::string& service_context, |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 | 389 |
375 SyncInvalidationScheduler* SyncSystemResources::internal_scheduler() { | 390 SyncInvalidationScheduler* SyncSystemResources::internal_scheduler() { |
376 return internal_scheduler_.get(); | 391 return internal_scheduler_.get(); |
377 } | 392 } |
378 | 393 |
379 SyncInvalidationScheduler* SyncSystemResources::listener_scheduler() { | 394 SyncInvalidationScheduler* SyncSystemResources::listener_scheduler() { |
380 return listener_scheduler_.get(); | 395 return listener_scheduler_.get(); |
381 } | 396 } |
382 | 397 |
383 } // namespace syncer | 398 } // namespace syncer |
OLD | NEW |