OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 |
11 | 11 |
12 #include <map> | 12 #include <map> |
13 | 13 |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
16 #include "chrome/browser/sync/engine/syncapi.h" | 16 #include "chrome/browser/sync/engine/syncapi.h" |
17 #include "chrome/browser/sync/engine/syncer_types.h" | 17 #include "chrome/browser/sync/engine/syncer_types.h" |
| 18 #include "chrome/browser/sync/syncable/model_type.h" |
18 | 19 |
19 namespace browser_sync { | 20 namespace browser_sync { |
20 | 21 |
21 class ScopedStatusLock; | 22 class ScopedStatusLock; |
22 class ServerConnectionManager; | 23 class ServerConnectionManager; |
23 class Syncer; | 24 class Syncer; |
24 class SyncerThread; | 25 class SyncerThread; |
25 struct AuthWatcherEvent; | 26 struct AuthWatcherEvent; |
26 struct ServerConnectionEvent; | 27 struct ServerConnectionEvent; |
27 | 28 |
(...skipping 11 matching lines...) Expand all Loading... |
39 virtual void OnSyncEngineEvent(const SyncEngineEvent& event); | 40 virtual void OnSyncEngineEvent(const SyncEngineEvent& event); |
40 | 41 |
41 sync_api::SyncManager::Status status() const; | 42 sync_api::SyncManager::Status status() const; |
42 | 43 |
43 void SetNotificationsEnabled(bool notifications_enabled); | 44 void SetNotificationsEnabled(bool notifications_enabled); |
44 | 45 |
45 void IncrementNotifiableCommits(); | 46 void IncrementNotifiableCommits(); |
46 | 47 |
47 void IncrementNotificationsReceived(); | 48 void IncrementNotificationsReceived(); |
48 | 49 |
| 50 void SetEncryptedTypes(const syncable::ModelTypeSet& types); |
| 51 void SetCryptographerReady(bool ready); |
| 52 void SetCryptoHasPendingKeys(bool has_pending_keys); |
| 53 |
49 protected: | 54 protected: |
50 // Examines syncer to calculate syncing and the unsynced count, | 55 // Examines syncer to calculate syncing and the unsynced count, |
51 // and returns a Status with new values. | 56 // and returns a Status with new values. |
52 sync_api::SyncManager::Status CalcSyncing(const SyncEngineEvent& event) const; | 57 sync_api::SyncManager::Status CalcSyncing(const SyncEngineEvent& event) const; |
53 sync_api::SyncManager::Status CreateBlankStatus() const; | 58 sync_api::SyncManager::Status CreateBlankStatus() const; |
54 | 59 |
55 // Examines status to see what has changed, updates old_status in place. | 60 // Examines status to see what has changed, updates old_status in place. |
56 void CalcStatusChanges(); | 61 void CalcStatusChanges(); |
57 | 62 |
58 sync_api::SyncManager::Status status_; | 63 sync_api::SyncManager::Status status_; |
59 | 64 |
60 mutable base::Lock mutex_; // Protects all data members. | 65 mutable base::Lock mutex_; // Protects all data members. |
61 DISALLOW_COPY_AND_ASSIGN(AllStatus); | 66 DISALLOW_COPY_AND_ASSIGN(AllStatus); |
62 }; | 67 }; |
63 | 68 |
64 class ScopedStatusLock { | 69 class ScopedStatusLock { |
65 public: | 70 public: |
66 explicit ScopedStatusLock(AllStatus* allstatus); | 71 explicit ScopedStatusLock(AllStatus* allstatus); |
67 ~ScopedStatusLock(); | 72 ~ScopedStatusLock(); |
68 protected: | 73 protected: |
69 AllStatus* allstatus_; | 74 AllStatus* allstatus_; |
70 }; | 75 }; |
71 | 76 |
72 } // namespace browser_sync | 77 } // namespace browser_sync |
73 | 78 |
74 #endif // CHROME_BROWSER_SYNC_ENGINE_ALL_STATUS_H_ | 79 #endif // CHROME_BROWSER_SYNC_ENGINE_ALL_STATUS_H_ |
OLD | NEW |