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

Side by Side Diff: third_party/libaddressinput/chromium/chrome_storage_impl.h

Issue 98623005: rAc i18n: implement storage interface for libaddressinput (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add forgotten file Created 7 years 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 2013 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 THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_CHROME_STORAGE_IMPL_H_
6 #define THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_CHROME_STORAGE_IMPL_H_
7
8 #include <libaddressinput/storage.h>
9 #include <libaddressinput/util/scoped_ptr.h>
please use gerrit instead 2013/12/20 02:04:40 As this is not a part of libaddressinput, you can
Evan Stade 2013/12/20 03:21:56 Done.
10
11 #include <list>
12 #include <string>
13
14 #include "base/prefs/pref_store.h"
15 #include "base/scoped_observer.h"
16
17 class WriteablePrefStore;
18
19 namespace i18n {
20 namespace addressinput {
please use gerrit instead 2013/12/20 02:04:40 As this is not a part of libaddressinput, your cla
Evan Stade 2013/12/20 03:21:56 Done.
21
22 // An implementation of the Storage interface which passes through to an
23 // underlying WriteablePrefStore.
24 class ChromeStorageImpl : public Storage,
25 public PrefStore::Observer {
26 public:
27 // |store| must outlive |this|.
28 ChromeStorageImpl(WriteablePrefStore* store);
please use gerrit instead 2013/12/20 02:04:40 explicit
Evan Stade 2013/12/20 03:21:56 Done.
29 virtual ~ChromeStorageImpl();
30
31 // i18n::addressinput::Storage implementation.
32 virtual void Put(const std::string& key, const std::string& data) OVERRIDE;
33 virtual void Get(const std::string& key,
34 scoped_ptr<Storage::Callback> data_ready) const OVERRIDE;
35
36 // PrefStore::Observer implementation.
37 virtual void OnPrefValueChanged(const std::string& key) OVERRIDE;
38 virtual void OnInitializationCompleted(bool succeeded) OVERRIDE;
39
40 private:
41 struct Request {
42 Request(const std::string& key,
43 scoped_ptr<Storage::Callback> callback);
44
45 std::string key;
46 scoped_ptr<Storage::Callback> callback;
47 };
48
49 // Non-const version of Get().
50 void DoGet(const std::string& key, scoped_ptr<Storage::Callback> data_ready);
51
52 WriteablePrefStore* backing_store_; // weak
53
54 // Get requests that haven't yet been serviced.
55 std::list<scoped_ptr<Request> > outstanding_requests_;
56
57 ScopedObserver<WriteablePrefStore, ChromeStorageImpl> scoped_observer_;
58
59 DISALLOW_COPY_AND_ASSIGN(ChromeStorageImpl);
60 };
61
62 } // namespace i18n
63 } // namespace addressinput
64
65 #endif // THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_CHROME_STORAGE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698