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

Side by Side Diff: chrome/browser/search/suggestions/suggestions_store.h

Issue 410673002: [Suggestions] Moving suggestions code to a new component (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix deps Created 6 years, 5 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 2014 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 #ifndef CHROME_BROWSER_SEARCH_SUGGESTIONS_SUGGESTIONS_STORE_H_
6 #define CHROME_BROWSER_SEARCH_SUGGESTIONS_SUGGESTIONS_STORE_H_
7
8 #include "base/macros.h"
9 #include "chrome/browser/search/suggestions/proto/suggestions.pb.h"
10
11 class PrefService;
12
13 namespace user_prefs {
14 class PrefRegistrySyncable;
15 } // namespace user_prefs
16
17 namespace suggestions {
18
19 // A helper class for reading and writing the suggestions to the profile's
20 // preference file.
21 class SuggestionsStore {
22 public:
23 explicit SuggestionsStore(PrefService* profile_prefs);
24 virtual ~SuggestionsStore();
25
26 // Loads the suggestion data from the profile's preferences into
27 // |suggestions|. If there is a problem with loading, the pref value is
28 // cleared, false is returned and |suggestions| is cleared. If successful,
29 // |suggestions| will contain the loaded data and true is returned.
30 virtual bool LoadSuggestions(SuggestionsProfile* suggestions);
31
32 // Stores the provided |suggestions| to the profile's preferences, using
33 // a base64 encoding of its protobuf serialization.
34 virtual bool StoreSuggestions(const SuggestionsProfile& suggestions);
35
36 // Clears any suggestion data from the profile's preferences.
37 virtual void ClearSuggestions();
38
39 // Register SuggestionsStore related prefs in the Profile prefs.
40 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
41
42 protected:
43 // Test seam. For simplicity of mock creation.
44 SuggestionsStore() {}
45
46 private:
47 // The pref service used to persist the suggestions data.
48 PrefService* pref_service_;
49
50 DISALLOW_COPY_AND_ASSIGN(SuggestionsStore);
51 };
52
53 } // namespace suggestions
54
55 #endif // CHROME_BROWSER_SEARCH_SUGGESTIONS_SUGGESTIONS_STORE_H_
OLDNEW
« no previous file with comments | « chrome/browser/search/suggestions/suggestions_source.cc ('k') | chrome/browser/search/suggestions/suggestions_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698