Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 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 COMPONENTS_DOWNLOAD_INTERNAL_NOOP_STORE_H_ | |
| 6 #define COMPONENTS_DOWNLOAD_INTERNAL_NOOP_STORE_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/memory/weak_ptr.h" | |
| 10 #include "components/download/internal/store.h" | |
| 11 | |
| 12 namespace download { | |
| 13 | |
| 14 struct Entry; | |
| 15 | |
| 16 // A Store implementation that doesn't do anything but honors the interface | |
| 17 // requirements. | |
|
Peter Beverloo
2017/05/10 12:44:45
Once an actual ProtoDB store is in place, will thi
David Trainor- moved to gerrit
2017/05/15 15:59:52
I was going to leave it for tests. Will add a TOD
| |
| 18 class NoopStore : public Store { | |
| 19 public: | |
| 20 NoopStore(); | |
| 21 ~NoopStore() override; | |
| 22 | |
| 23 // Store implementation. | |
| 24 bool IsInitialized() override; | |
| 25 void Initialize(const InitCallback& callback) override; | |
| 26 void Destroy(const StoreCallback& callback) override; | |
| 27 void Update(const Entry& entry, const StoreCallback& callback) override; | |
| 28 void Remove(const std::string& guid, const StoreCallback& callback) override; | |
| 29 | |
| 30 private: | |
| 31 void OnInitFinished(const InitCallback& callback); | |
| 32 | |
| 33 // Whether or not this Store is 'initialized.' Just gets set to |true| once | |
| 34 // Initialize() is called. | |
| 35 bool initialized_; | |
| 36 | |
| 37 base::WeakPtrFactory<NoopStore> weak_ptr_factory_; | |
| 38 | |
| 39 DISALLOW_COPY_AND_ASSIGN(NoopStore); | |
| 40 }; | |
| 41 | |
| 42 } // namespace download | |
| 43 | |
| 44 #endif // COMPONENTS_DOWNLOAD_INTERNAL_NOOP_STORE_H_ | |
| OLD | NEW |