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

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

Issue 9699057: [Sync] Move 'sync' target to sync/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Tim's comments Created 8 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
« no previous file with comments | « chrome/browser/sync/engine/DEPS ('k') | chrome/browser/sync/engine/all_status.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4 //
5 // The AllStatus object watches various sync engine components and aggregates
6 // the status of all of them into one place.
7
8 #ifndef CHROME_BROWSER_SYNC_ENGINE_ALL_STATUS_H_
9 #define CHROME_BROWSER_SYNC_ENGINE_ALL_STATUS_H_
10 #pragma once
11
12 #include <map>
13
14 #include "base/compiler_specific.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "base/synchronization/lock.h"
17 #include "chrome/browser/sync/engine/syncer_types.h"
18 #include "chrome/browser/sync/internal_api/sync_manager.h"
19 #include "chrome/browser/sync/syncable/model_type.h"
20
21 namespace browser_sync {
22
23 class ScopedStatusLock;
24 struct ServerConnectionEvent;
25
26 // TODO(rlarocque):
27 // Most of this data ends up on the about:sync page. But the page is only
28 // 'pinged' to update itself at the end of a sync cycle. A user could refresh
29 // manually, but unless their timing is excellent it's unlikely that a user will
30 // see any state in mid-sync cycle. We have no plans to change this.
31 //
32 // What we do intend to do is improve the UI so that changes following a sync
33 // cycle are more visible. Without such a change, the status summary for a
34 // healthy syncer will constantly display as "READY" and never provide any
35 // indication of a sync cycle being performed. See crbug.com/108100.
36
37 class AllStatus : public SyncEngineEventListener {
38 friend class ScopedStatusLock;
39 public:
40 AllStatus();
41 virtual ~AllStatus();
42
43 void HandleServerConnectionEvent(const ServerConnectionEvent& event);
44
45 virtual void OnSyncEngineEvent(const SyncEngineEvent& event) OVERRIDE;
46
47 sync_api::SyncManager::Status status() const;
48
49 void SetNotificationsEnabled(bool notifications_enabled);
50
51 void IncrementNotifiableCommits();
52
53 void IncrementNotificationsReceived();
54
55 void SetEncryptedTypes(syncable::ModelTypeSet types);
56 void SetCryptographerReady(bool ready);
57 void SetCryptoHasPendingKeys(bool has_pending_keys);
58
59 void SetUniqueId(const std::string& guid);
60
61 protected:
62 // Examines syncer to calculate syncing and the unsynced count,
63 // and returns a Status with new values.
64 sync_api::SyncManager::Status CalcSyncing(const SyncEngineEvent& event) const;
65 sync_api::SyncManager::Status CreateBlankStatus() const;
66
67 // Examines status to see what has changed, updates old_status in place.
68 void CalcStatusChanges();
69
70 sync_api::SyncManager::Status status_;
71
72 mutable base::Lock mutex_; // Protects all data members.
73 DISALLOW_COPY_AND_ASSIGN(AllStatus);
74 };
75
76 class ScopedStatusLock {
77 public:
78 explicit ScopedStatusLock(AllStatus* allstatus);
79 ~ScopedStatusLock();
80 protected:
81 AllStatus* allstatus_;
82 };
83
84 } // namespace browser_sync
85
86 #endif // CHROME_BROWSER_SYNC_ENGINE_ALL_STATUS_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/DEPS ('k') | chrome/browser/sync/engine/all_status.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698