| 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/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
| 17 #include "chrome/browser/sync/engine/syncer_types.h" | 17 #include "chrome/browser/sync/engine/syncer_types.h" |
| 18 #include "chrome/browser/sync/internal_api/sync_manager.h" | 18 #include "chrome/browser/sync/internal_api/sync_manager.h" |
| 19 #include "chrome/browser/sync/syncable/model_type.h" | 19 #include "chrome/browser/sync/syncable/model_type.h" |
| 20 | 20 |
| 21 namespace browser_sync { | 21 namespace browser_sync { |
| 22 | 22 |
| 23 class ScopedStatusLock; | 23 class ScopedStatusLock; |
| 24 struct AuthWatcherEvent; | |
| 25 struct ServerConnectionEvent; | 24 struct ServerConnectionEvent; |
| 26 | 25 |
| 27 // TODO(rlarocque): | 26 // TODO(rlarocque): |
| 28 // Most of this data ends up on the about:sync page. But the page is only | 27 // Most of this data ends up on the about:sync page. But the page is only |
| 29 // 'pinged' to update itself at the end of a sync cycle. A user could refresh | 28 // 'pinged' to update itself at the end of a sync cycle. A user could refresh |
| 30 // manually, but unless their timing is excellent it's unlikely that a user will | 29 // manually, but unless their timing is excellent it's unlikely that a user will |
| 31 // see any state in mid-sync cycle. We have no plans to change this. | 30 // see any state in mid-sync cycle. We have no plans to change this. |
| 32 // | 31 // |
| 33 // What we do intend to do is improve the UI so that changes following a sync | 32 // What we do intend to do is improve the UI so that changes following a sync |
| 34 // cycle are more visible. Without such a change, the status summary for a | 33 // cycle are more visible. Without such a change, the status summary for a |
| 35 // healthy syncer will constantly display as "READY" and never provide any | 34 // healthy syncer will constantly display as "READY" and never provide any |
| 36 // indication of a sync cycle being performed. See crbug.com/108100. | 35 // indication of a sync cycle being performed. See crbug.com/108100. |
| 37 | 36 |
| 38 class AllStatus : public SyncEngineEventListener { | 37 class AllStatus : public SyncEngineEventListener { |
| 39 friend class ScopedStatusLock; | 38 friend class ScopedStatusLock; |
| 40 public: | 39 public: |
| 41 AllStatus(); | 40 AllStatus(); |
| 42 virtual ~AllStatus(); | 41 virtual ~AllStatus(); |
| 43 | 42 |
| 44 void HandleServerConnectionEvent(const ServerConnectionEvent& event); | 43 void HandleServerConnectionEvent(const ServerConnectionEvent& event); |
| 45 | 44 |
| 46 void HandleAuthWatcherEvent(const AuthWatcherEvent& event); | |
| 47 | |
| 48 virtual void OnSyncEngineEvent(const SyncEngineEvent& event) OVERRIDE; | 45 virtual void OnSyncEngineEvent(const SyncEngineEvent& event) OVERRIDE; |
| 49 | 46 |
| 50 sync_api::SyncManager::Status status() const; | 47 sync_api::SyncManager::Status status() const; |
| 51 | 48 |
| 52 void SetNotificationsEnabled(bool notifications_enabled); | 49 void SetNotificationsEnabled(bool notifications_enabled); |
| 53 | 50 |
| 54 void IncrementNotifiableCommits(); | 51 void IncrementNotifiableCommits(); |
| 55 | 52 |
| 56 void IncrementNotificationsReceived(); | 53 void IncrementNotificationsReceived(); |
| 57 | 54 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 80 public: | 77 public: |
| 81 explicit ScopedStatusLock(AllStatus* allstatus); | 78 explicit ScopedStatusLock(AllStatus* allstatus); |
| 82 ~ScopedStatusLock(); | 79 ~ScopedStatusLock(); |
| 83 protected: | 80 protected: |
| 84 AllStatus* allstatus_; | 81 AllStatus* allstatus_; |
| 85 }; | 82 }; |
| 86 | 83 |
| 87 } // namespace browser_sync | 84 } // namespace browser_sync |
| 88 | 85 |
| 89 #endif // CHROME_BROWSER_SYNC_ENGINE_ALL_STATUS_H_ | 86 #endif // CHROME_BROWSER_SYNC_ENGINE_ALL_STATUS_H_ |
| OLD | NEW |