| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 SYNC_INTERNAL_API_ALL_STATUS_H_ | 8 #ifndef SYNC_INTERNAL_API_ALL_STATUS_H_ |
| 9 #define SYNC_INTERNAL_API_ALL_STATUS_H_ | 9 #define SYNC_INTERNAL_API_ALL_STATUS_H_ |
| 10 | 10 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
| 16 #include "sync/engine/sync_engine_event.h" | 16 #include "sync/engine/sync_engine_event.h" |
| 17 #include "sync/engine/syncer_types.h" | 17 #include "sync/engine/syncer_types.h" |
| 18 #include "sync/internal_api/public/base/model_type.h" | 18 #include "sync/internal_api/public/base/model_type.h" |
| 19 #include "sync/internal_api/public/engine/sync_status.h" | 19 #include "sync/internal_api/public/engine/sync_status.h" |
| 20 #include "sync/engine/nudge_source.h" |
| 20 | 21 |
| 21 namespace syncer { | 22 namespace syncer { |
| 22 | 23 |
| 23 class ScopedStatusLock; | 24 class ScopedStatusLock; |
| 24 struct ServerConnectionEvent; | 25 struct ServerConnectionEvent; |
| 25 | 26 |
| 26 // This class collects data and uses it to update its internal state. It can | 27 // This class collects data and uses it to update its internal state. It can |
| 27 // return a snapshot of this state as a SyncerStatus object. | 28 // return a snapshot of this state as a SyncerStatus object. |
| 28 // | 29 // |
| 29 // Most of this data ends up on the about:sync page. But the page is only | 30 // Most of this data ends up on the about:sync page. But the page is only |
| (...skipping 22 matching lines...) Expand all Loading... |
| 52 | 53 |
| 53 void SetEncryptedTypes(ModelTypeSet types); | 54 void SetEncryptedTypes(ModelTypeSet types); |
| 54 void SetCryptographerReady(bool ready); | 55 void SetCryptographerReady(bool ready); |
| 55 void SetCryptoHasPendingKeys(bool has_pending_keys); | 56 void SetCryptoHasPendingKeys(bool has_pending_keys); |
| 56 void SetPassphraseType(PassphraseType type); | 57 void SetPassphraseType(PassphraseType type); |
| 57 void SetHasKeystoreKey(bool has_keystore_key); | 58 void SetHasKeystoreKey(bool has_keystore_key); |
| 58 void SetKeystoreMigrationTime(const base::Time& migration_time); | 59 void SetKeystoreMigrationTime(const base::Time& migration_time); |
| 59 | 60 |
| 60 void SetUniqueId(const std::string& guid); | 61 void SetUniqueId(const std::string& guid); |
| 61 | 62 |
| 63 void IncrementNudgeCounter(NudgeSource source); |
| 64 |
| 62 protected: | 65 protected: |
| 63 // Examines syncer to calculate syncing and the unsynced count, | 66 // Examines syncer to calculate syncing and the unsynced count, |
| 64 // and returns a Status with new values. | 67 // and returns a Status with new values. |
| 65 SyncStatus CalcSyncing(const SyncEngineEvent& event) const; | 68 SyncStatus CalcSyncing(const SyncEngineEvent& event) const; |
| 66 SyncStatus CreateBlankStatus() const; | 69 SyncStatus CreateBlankStatus() const; |
| 67 | 70 |
| 68 SyncStatus status_; | 71 SyncStatus status_; |
| 69 | 72 |
| 70 mutable base::Lock mutex_; // Protects all data members. | 73 mutable base::Lock mutex_; // Protects all data members. |
| 71 DISALLOW_COPY_AND_ASSIGN(AllStatus); | 74 DISALLOW_COPY_AND_ASSIGN(AllStatus); |
| 72 }; | 75 }; |
| 73 | 76 |
| 74 class ScopedStatusLock { | 77 class ScopedStatusLock { |
| 75 public: | 78 public: |
| 76 explicit ScopedStatusLock(AllStatus* allstatus); | 79 explicit ScopedStatusLock(AllStatus* allstatus); |
| 77 ~ScopedStatusLock(); | 80 ~ScopedStatusLock(); |
| 78 protected: | 81 protected: |
| 79 AllStatus* allstatus_; | 82 AllStatus* allstatus_; |
| 80 }; | 83 }; |
| 81 | 84 |
| 82 } // namespace syncer | 85 } // namespace syncer |
| 83 | 86 |
| 84 #endif // SYNC_INTERNAL_API_ALL_STATUS_H_ | 87 #endif // SYNC_INTERNAL_API_ALL_STATUS_H_ |
| OLD | NEW |