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 3 // found in the LICENSE file. 4 5 #include "jingle/notifier/listener/push_client.h" 6 7 #include <cstddef> 8 9 #include "base/bind.h" 10 #include "base/single_thread_task_runner.h" 11 #include "jingle/notifier/listener/non_blocking_push_client.h" 12 #include "jingle/notifier/listener/xmpp_push_client.h" 13 14 namespace notifier { 15 16 PushClient::~PushClient() {} 17 18 namespace { 19 20 scoped_ptr<PushClient> CreateXmppPushClient( 21 const NotifierOptions& notifier_options) { 22 return scoped_ptr<PushClient>(new XmppPushClient(notifier_options)); 23 } 24 25 } // namespace 26 27 scoped_ptr<PushClient> PushClient::CreateDefault( 28 const NotifierOptions& notifier_options) { 29 return scoped_ptr<PushClient>(new NonBlockingPushClient( 30 notifier_options.request_context_getter->GetNetworkTaskRunner(), 31 base::Bind(&CreateXmppPushClient, notifier_options))); 32 } 33 34 scoped_ptr<PushClient> PushClient::CreateDefaultOnIOThread( 35 const NotifierOptions& notifier_options) { 36 CHECK(notifier_options.request_context_getter->GetNetworkTaskRunner()-> 37 BelongsToCurrentThread()); 38 return CreateXmppPushClient(notifier_options); 39 } 40 41 } // namespace notifier 42