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

Unified Diff: chrome/browser/sync/notifier/listener/talk_mediator.h

Issue 194065: Initial commit of sync engine code to browser/sync.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fixes to gtest include path, reverted syncapi. Created 11 years, 3 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
Index: chrome/browser/sync/notifier/listener/talk_mediator.h
===================================================================
--- chrome/browser/sync/notifier/listener/talk_mediator.h (revision 0)
+++ chrome/browser/sync/notifier/listener/talk_mediator.h (revision 0)
@@ -0,0 +1,71 @@
+// Copyright (c) 2009 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.
+
+// Interface to the code which handles talk logic. Used to initialize SSL
+// before the underlying talk login occurs
+// Example usage:
+//
+// TalkMediator mediator();
+// mediator.SetCredentials("email", "pass", false);
+// mediator.WatchAuthWatcher(auth_watcher_);
+// AuthWatcher eventually sends AUTH_SUCCEEDED which triggers:
+// mediator.Login();
+// ...
+// mediator.Logout();
+
+#ifndef CHROME_BROWSER_SYNC_NOTIFIER_LISTENER_TALK_MEDIATOR_H_
+#define CHROME_BROWSER_SYNC_NOTIFIER_LISTENER_TALK_MEDIATOR_H_
+
+#include <string>
+
+namespace browser_sync {
+class AuthWatcher;
+class SyncerThread;
+
+struct TalkMediatorEvent {
+ enum WhatHappened {
+ LOGIN_SUCCEEDED,
+ LOGOUT_SUCCEEDED,
+ SUBSCRIPTIONS_ON,
+ SUBSCRIPTIONS_OFF,
+ NOTIFICATION_RECEIVED,
+ NOTIFICATION_SENT,
+ TALKMEDIATOR_DESTROYED,
+ };
+
+ // Required by EventChannel
+ typedef TalkMediatorEvent EventType;
+
+ static inline bool IsChannelShutdownEvent(const TalkMediatorEvent& event) {
+ return event.what_happened == TALKMEDIATOR_DESTROYED;
+ }
+
+ WhatHappened what_happened;
+};
+
+typedef EventChannel<TalkMediatorEvent, PThreadMutex> TalkMediatorChannel;
+
+class TalkMediator {
+ public:
+ TalkMediator() {}
+ virtual ~TalkMediator() {}
+
+ // The following methods are for authorizaiton of the xmpp client.
+ virtual void WatchAuthWatcher(browser_sync::AuthWatcher* auth_watcher) = 0;
+ virtual bool SetAuthToken(const std::string& email,
+ const std::string& token) = 0;
+ virtual bool Login() = 0;
+ virtual bool Logout() = 0;
+
+ // Method for the owner of this object to notify peers that an update
+ // has occurred.
+ virtual bool SendNotification() = 0;
+
+ // Channel by which talk mediator events are signaled.
+ virtual TalkMediatorChannel* channel() const = 0;
+};
+
+} // namespace browser_sync
+
+#endif // CHROME_BROWSER_SYNC_NOTIFIER_LISTENER_TALK_MEDIATOR_H_
Property changes on: chrome\browser\sync\notifier\listener\talk_mediator.h
___________________________________________________________________
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698