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

Side by Side Diff: chrome/browser/sync/notifier/sync_notifier_impl.h

Issue 6683015: Refactor sync notifier out of sync api (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix lint Created 9 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 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 // Talk Mediator based implementation of the sync notifier interface.
6 // Initializes the talk mediator and registers itself as the delegate.
7
8 #ifndef CHROME_BROWSER_SYNC_NOTIFIER_SYNC_NOTIFIER_IMPL_H_
9 #define CHROME_BROWSER_SYNC_NOTIFIER_SYNC_NOTIFIER_IMPL_H_
10
11 #include <string>
12
13 #include "base/observer_list.h"
14 #include "chrome/browser/sync/notifier/state_writer.h"
15 #include "chrome/browser/sync/notifier/sync_notifier.h"
16 #include "chrome/browser/sync/syncable/model_type.h"
17 #include "jingle/notifier/base/notifier_options.h"
18 #include "jingle/notifier/listener/talk_mediator.h"
19 #include "jingle/notifier/listener/talk_mediator_impl.h"
20
21 namespace sync_notifier {
22 class ServerNotifierThread;
23
24 class SyncNotifierImpl
25 : public SyncNotifier,
26 public sync_notifier::StateWriter,
27 public notifier::TalkMediator::Delegate {
28 public:
29 explicit SyncNotifierImpl(const notifier::NotifierOptions& notifier_options);
30
31 virtual ~SyncNotifierImpl();
32
33 // TalkMediator::Delegate implementation.
34 virtual void OnNotificationStateChange(bool notifications_enabled);
35
36 virtual void OnIncomingNotification(
37 const IncomingNotificationData& notification_data);
38
39 virtual void OnOutgoingNotification() {}
40
41 // sync_notifier::StateWriter implementation.
42 virtual void WriteState(const std::string& state);
43
44 // SyncNotifier implementation
45 virtual void UpdateCredentials(
46 const std::string& email, const std::string& token);
47
48 virtual void SetState(const std::string& state);
49
50 virtual void AddObserver(SyncNotifierObserver* observer);
51 virtual void RemoveObserver(SyncNotifierObserver* observer);
52
53 virtual void UpdateEnabledTypes(const syncable::ModelTypeSet& types);
54 virtual void SendNotification();
55 private:
56 // Login to the talk mediator with the given credentials.
57 void TalkMediatorLogin(
58 const std::string& email, const std::string& token);
59
60 // Notification (xmpp) handler.
61 scoped_ptr<notifier::TalkMediator> talk_mediator_;
62 syncable::ModelTypeSet enabled_types_;
63 std::string state_;
64
65 notifier::NotifierOptions notifier_options_;
66 ServerNotifierThread* server_notifier_thread_;
67 ObserverList<SyncNotifierObserver> observer_list_;
68 };
69 }
70 #endif // CHROME_BROWSER_SYNC_NOTIFIER_SYNC_NOTIFIER_IMPL_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/notifier/sync_notifier_factory.cc ('k') | chrome/browser/sync/notifier/sync_notifier_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698