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

Side by Side Diff: chrome/browser/invalidation/invalidator_storage.h

Issue 288353003: Componentize invalidator storage + preferences (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
(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 // Wraps PrefService in an InvalidationStateTracker to allow SyncNotifiers
6 // to use PrefService as persistence for invalidation state. It is not thread
7 // safe, and lives on the UI thread.
8
9 #ifndef CHROME_BROWSER_INVALIDATION_INVALIDATOR_STORAGE_H_
10 #define CHROME_BROWSER_INVALIDATION_INVALIDATOR_STORAGE_H_
11
12 #include "base/basictypes.h"
13 #include "base/gtest_prod_util.h"
14 #include "base/threading/thread_checker.h"
15 #include "sync/notifier/invalidation_state_tracker.h"
16 #include "sync/notifier/unacked_invalidation_set.h"
17
18 class PrefService;
19
20 namespace base {
21 class DictionaryValue;
22 class ListValue;
23 }
24
25 namespace user_prefs {
26 class PrefRegistrySyncable;
27 }
28
29 namespace invalidation {
30
31 class InvalidatorStorage : public syncer::InvalidationStateTracker {
32 public:
33 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
34
35 // |pref_service| may not be NULL. Does not own |pref_service|.
36 explicit InvalidatorStorage(PrefService* pref_service);
37 virtual ~InvalidatorStorage();
38
39 // InvalidationStateTracker implementation.
40 virtual void ClearAndSetNewClientId(const std::string& client_id) OVERRIDE;
41 virtual std::string GetInvalidatorClientId() const OVERRIDE;
42 virtual void SetBootstrapData(const std::string& data) OVERRIDE;
43 virtual std::string GetBootstrapData() const OVERRIDE;
44 virtual void SetSavedInvalidations(
45 const syncer::UnackedInvalidationsMap& map) OVERRIDE;
46 virtual syncer::UnackedInvalidationsMap GetSavedInvalidations()
47 const OVERRIDE;
48 virtual void Clear() OVERRIDE;
49
50 private:
51 FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest, SerializeEmptyMap);
52 FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest,
53 DeserializeFromListOutOfRange);
54 FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest,
55 DeserializeFromListInvalidFormat);
56 FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest,
57 DeserializeFromListWithDuplicates);
58 FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest,
59 DeserializeFromEmptyList);
60 FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest, DeserializeFromListBasic);
61 FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest,
62 DeserializeFromListMissingOptionalValues);
63 FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest, DeserializeMapOutOfRange);
64 FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest, DeserializeMapInvalidFormat);
65 FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest,
66 DeserializeMapEmptyDictionary);
67 FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest, DeserializeMapBasic);
68 FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest, MigrateLegacyPreferences);
69
70 base::ThreadChecker thread_checker_;
71
72 PrefService* const pref_service_;
73
74 DISALLOW_COPY_AND_ASSIGN(InvalidatorStorage);
75 };
76
77 } // namespace invalidation
78
79 #endif // CHROME_BROWSER_INVALIDATION_INVALIDATOR_STORAGE_H_
OLDNEW
« no previous file with comments | « chrome/browser/invalidation/invalidation_service_factory.cc ('k') | chrome/browser/invalidation/invalidator_storage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698