Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(824)

Unified Diff: jingle/notifier/listener/talk_mediator_impl.h

Issue 10398051: [Sync] Replace TalkMediator*/MediatorThread* with PushClient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments, fix test Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « jingle/notifier/listener/talk_mediator.h ('k') | jingle/notifier/listener/talk_mediator_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: jingle/notifier/listener/talk_mediator_impl.h
diff --git a/jingle/notifier/listener/talk_mediator_impl.h b/jingle/notifier/listener/talk_mediator_impl.h
deleted file mode 100644
index d49e05469ef61c6e7f7a07be55b63ed16f2aaed5..0000000000000000000000000000000000000000
--- a/jingle/notifier/listener/talk_mediator_impl.h
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// This class is the interface between talk code and the client code proper
-// It will manage all aspects of the connection and call back into the client
-// when it needs attention (for instance if updates are available for syncing).
-
-#ifndef JINGLE_NOTIFIER_LISTENER_TALK_MEDIATOR_IMPL_H_
-#define JINGLE_NOTIFIER_LISTENER_TALK_MEDIATOR_IMPL_H_
-
-#include <string>
-#include <vector>
-
-#include "base/compiler_specific.h"
-#include "base/gtest_prod_util.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/threading/non_thread_safe.h"
-#include "jingle/notifier/base/notifier_options.h"
-#include "jingle/notifier/listener/mediator_thread.h"
-#include "jingle/notifier/listener/talk_mediator.h"
-#include "talk/xmpp/xmppclientsettings.h"
-
-class MessageLoop;
-
-namespace notifier {
-
-class TalkMediatorImpl
- : public TalkMediator, public MediatorThread::Observer {
- public:
- // Takes ownership of |mediator_thread|. It is guaranteed that
- // |mediator_thread| is destroyed only when this object is destroyed.
- // This means that you can store a pointer to mediator_thread separately
- // and use it until this object is destroyed.
- TalkMediatorImpl(
- MediatorThread* mediator_thread,
- const NotifierOptions& notifier_options);
- virtual ~TalkMediatorImpl();
-
- // TalkMediator implementation.
-
- // Should be called on the same thread as the constructor.
- virtual void SetDelegate(TalkMediator::Delegate* delegate) OVERRIDE;
-
- // All the methods below should be called on the same thread. It may or may
- // not be same as the thread on which the object was constructed.
-
- // |email| must be a valid email address (e.g., foo@bar.com).
- virtual void SetAuthToken(const std::string& email,
- const std::string& token,
- const std::string& token_service) OVERRIDE;
- virtual bool Login() OVERRIDE;
- // Users must call Logout once Login is called.
- virtual bool Logout() OVERRIDE;
-
- virtual void SendNotification(const Notification& data) OVERRIDE;
-
- virtual void AddSubscription(const Subscription& subscription) OVERRIDE;
-
- // MediatorThread::Delegate implementation.
-
- virtual void OnConnectionStateChange(bool logged_in) OVERRIDE;
-
- virtual void OnSubscriptionStateChange(bool subscribed) OVERRIDE;
-
- virtual void OnIncomingNotification(
- const Notification& notification) OVERRIDE;
-
- virtual void OnOutgoingNotification() OVERRIDE;
-
- private:
- struct TalkMediatorState {
- TalkMediatorState()
- : started(0), initialized(0), logging_in(0), logged_in(0) {
- }
-
- unsigned int started : 1; // Background thread has started.
- unsigned int initialized : 1; // Initialized with login information.
- unsigned int logging_in : 1; // Logging in to the mediator's
- // authenticator.
- unsigned int logged_in : 1; // Logged in the mediator's authenticator.
- };
-
- // Delegate, which we don't own. May be NULL.
- TalkMediator::Delegate* delegate_;
-
- // Internal state.
- TalkMediatorState state_;
-
- // Cached and verfied from the SetAuthToken method.
- buzz::XmppClientSettings xmpp_settings_;
-
- // The worker thread through which talk events are posted and received.
- scoped_ptr<MediatorThread> mediator_thread_;
-
- const NotifierOptions notifier_options_;
-
- SubscriptionList subscriptions_;
-
- MessageLoop* parent_message_loop_;
-
- FRIEND_TEST_ALL_PREFIXES(TalkMediatorImplTest, SetAuthToken);
- FRIEND_TEST_ALL_PREFIXES(TalkMediatorImplTest, SendNotification);
- FRIEND_TEST_ALL_PREFIXES(TalkMediatorImplTest, MediatorThreadCallbacks);
-
- DISALLOW_COPY_AND_ASSIGN(TalkMediatorImpl);
-};
-
-} // namespace notifier
-
-#endif // JINGLE_NOTIFIER_LISTENER_TALK_MEDIATOR_IMPL_H_
« no previous file with comments | « jingle/notifier/listener/talk_mediator.h ('k') | jingle/notifier/listener/talk_mediator_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698