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

Side by Side Diff: chrome/browser/sync/engine/all_status.h

Issue 3305003: New authorization framework for sync. ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // The AllStatus object watches various sync engine components and aggregates 5 // The AllStatus object watches various sync engine components and aggregates
6 // the status of all of them into one place. 6 // the status of all of them into one place.
7 7
8 #ifndef CHROME_BROWSER_SYNC_ENGINE_ALL_STATUS_H_ 8 #ifndef CHROME_BROWSER_SYNC_ENGINE_ALL_STATUS_H_
9 #define CHROME_BROWSER_SYNC_ENGINE_ALL_STATUS_H_ 9 #define CHROME_BROWSER_SYNC_ENGINE_ALL_STATUS_H_
10 #pragma once 10 #pragma once
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // The next two values will be equal if all updates have been received. 82 // The next two values will be equal if all updates have been received.
83 // total updates available. 83 // total updates available.
84 int64 updates_available; 84 int64 updates_available;
85 // total updates received. 85 // total updates received.
86 int64 updates_received; 86 int64 updates_received;
87 }; 87 };
88 88
89 AllStatus(); 89 AllStatus();
90 ~AllStatus(); 90 ~AllStatus();
91 91
92 void WatchConnectionManager(ServerConnectionManager* conn_mgr);
93 void HandleServerConnectionEvent(const ServerConnectionEvent& event); 92 void HandleServerConnectionEvent(const ServerConnectionEvent& event);
94 93
95 void HandleAuthWatcherEvent(const AuthWatcherEvent& event); 94 void HandleAuthWatcherEvent(const AuthWatcherEvent& event);
96 95
97 void WatchSyncerThread(SyncerThread* syncer_thread); 96 void WatchSyncerThread(SyncerThread* syncer_thread);
98 void HandleChannelEvent(const SyncerEvent& event); 97 void HandleChannelEvent(const SyncerEvent& event);
99 98
100 // Returns a string description of the SyncStatus (currently just the ascii 99 // Returns a string description of the SyncStatus (currently just the ascii
101 // version of the enum). Will LOG(FATAL) if the status us out of range. 100 // version of the enum). Will LOG(FATAL) if the status us out of range.
102 static const char* GetSyncStatusString(SyncStatus status); 101 static const char* GetSyncStatusString(SyncStatus status);
103 102
104 Channel* channel() const { return channel_; } 103 Channel* channel() const { return channel_; }
105 104
106 Status status() const; 105 Status status() const;
107 106
108 void SetNotificationsEnabled(bool notifications_enabled); 107 void SetNotificationsEnabled(bool notifications_enabled);
109 108
110 void IncrementNotificationsSent(); 109 void IncrementNotificationsSent();
111 110
112 void IncrementNotificationsReceived(); 111 void IncrementNotificationsReceived();
113 112
114 protected: 113 protected:
115 typedef std::map<Syncer*, EventListenerHookup*> Syncers; 114 typedef std::map<Syncer*, EventListenerHookup*> Syncers;
116 115
117 // Examines syncer to calculate syncing and the unsynced count, 116 // Examines syncer to calculate syncing and the unsynced count,
118 // and returns a Status with new values. 117 // and returns a Status with new values.
119 Status CalcSyncing() const;
120 Status CalcSyncing(const SyncerEvent& event) const; 118 Status CalcSyncing(const SyncerEvent& event) const;
121 Status CreateBlankStatus() const; 119 Status CreateBlankStatus() const;
122 120
123 // Examines status to see what has changed, updates old_status in place. 121 // Examines status to see what has changed, updates old_status in place.
124 int CalcStatusChanges(Status* old_status); 122 int CalcStatusChanges(Status* old_status);
125 123
126 Status status_; 124 Status status_;
127 Channel* const channel_; 125 Channel* const channel_;
128 scoped_ptr<EventListenerHookup> conn_mgr_hookup_;
129 scoped_ptr<ChannelHookup<SyncerEvent> > syncer_thread_hookup_; 126 scoped_ptr<ChannelHookup<SyncerEvent> > syncer_thread_hookup_;
130 scoped_ptr<EventListenerHookup> diskfull_hookup_; 127 scoped_ptr<EventListenerHookup> diskfull_hookup_;
131 scoped_ptr<EventListenerHookup> talk_mediator_hookup_; 128 scoped_ptr<EventListenerHookup> talk_mediator_hookup_;
132 129
133 mutable Lock mutex_; // Protects all data members. 130 mutable Lock mutex_; // Protects all data members.
134 DISALLOW_COPY_AND_ASSIGN(AllStatus); 131 DISALLOW_COPY_AND_ASSIGN(AllStatus);
135 }; 132 };
136 133
137 struct AllStatusEvent { 134 struct AllStatusEvent {
138 enum { // A bit mask of which members have changed. 135 enum { // A bit mask of which members have changed.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 void NotifyOverQuota(); 175 void NotifyOverQuota();
179 protected: 176 protected:
180 AllStatusEvent event_; 177 AllStatusEvent event_;
181 AllStatus* const allstatus_; 178 AllStatus* const allstatus_;
182 StatusNotifyPlan plan_; 179 StatusNotifyPlan plan_;
183 }; 180 };
184 181
185 } // namespace browser_sync 182 } // namespace browser_sync
186 183
187 #endif // CHROME_BROWSER_SYNC_ENGINE_ALL_STATUS_H_ 184 #endif // CHROME_BROWSER_SYNC_ENGINE_ALL_STATUS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698