[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame^] | 1 | // Copyright 2013 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 | #include "google_apis/gcm/gcm_client.h" |
| 6 | |
| 7 | #include "base/lazy_instance.h" |
| 8 | #include "google_apis/gcm/gcm_client_impl.h" |
| 9 | |
| 10 | namespace gcm { |
| 11 | |
| 12 | namespace { |
| 13 | |
| 14 | static base::LazyInstance<GCMClientImpl>::Leaky g_gcm_client = |
| 15 | LAZY_INSTANCE_INITIALIZER; |
| 16 | static GCMClient* g_gcm_client_override = NULL; |
| 17 | |
| 18 | } // namespace |
| 19 | |
| 20 | GCMClient::OutgoingMessage::OutgoingMessage() |
| 21 | : time_to_live(0) { |
| 22 | } |
| 23 | |
| 24 | GCMClient::OutgoingMessage::~OutgoingMessage() { |
| 25 | } |
| 26 | |
| 27 | GCMClient::IncomingMessage::IncomingMessage() { |
| 28 | } |
| 29 | |
| 30 | GCMClient::IncomingMessage::~IncomingMessage() { |
| 31 | } |
| 32 | |
| 33 | // static |
| 34 | GCMClient* GCMClient::Get() { |
| 35 | if (g_gcm_client_override) |
| 36 | return g_gcm_client_override; |
| 37 | return g_gcm_client.Pointer(); |
| 38 | } |
| 39 | |
| 40 | // static |
| 41 | void GCMClient::SetForTesting(GCMClient* client) { |
| 42 | g_gcm_client_override = client; |
| 43 | } |
| 44 | |
| 45 | } // namespace gcm |