| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_DOWNLOAD_INTERNAL_NOOP_STORE_H_ | 5 #ifndef COMPONENTS_DOWNLOAD_INTERNAL_TEST_NOOP_STORE_H_ |
| 6 #define COMPONENTS_DOWNLOAD_INTERNAL_NOOP_STORE_H_ | 6 #define COMPONENTS_DOWNLOAD_INTERNAL_TEST_NOOP_STORE_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "components/download/internal/store.h" | 10 #include "components/download/internal/store.h" |
| 11 | 11 |
| 12 namespace download { | 12 namespace download { |
| 13 | 13 |
| 14 struct Entry; | 14 struct Entry; |
| 15 | 15 |
| 16 // A Store implementation that doesn't do anything but honors the interface | 16 // A Store implementation that doesn't do anything but honors the interface |
| 17 // requirements. | 17 // requirements. |
| 18 // TODO(dtrainor, shaktisahu): Remove this if it's no longer necessary after the | 18 // TODO(dtrainor, shaktisahu): Remove this if it's no longer necessary after the |
| 19 // real Store implementation is added. | 19 // real Store implementation is added. |
| 20 class NoopStore : public Store { | 20 class NoopStore : public Store { |
| 21 public: | 21 public: |
| 22 NoopStore(); | 22 NoopStore(); |
| 23 ~NoopStore() override; | 23 ~NoopStore() override; |
| 24 | 24 |
| 25 // Store implementation. | 25 // Store implementation. |
| 26 bool IsInitialized() override; | 26 bool IsInitialized() override; |
| 27 void Initialize(InitCallback callback) override; | 27 void Initialize(const InitCallback& callback) override; |
| 28 void Destroy(StoreCallback callback) override; | 28 void Destroy(const StoreCallback& callback) override; |
| 29 void Update(const Entry& entry, StoreCallback callback) override; | 29 void Update(const Entry& entry, const StoreCallback& callback) override; |
| 30 void Remove(const std::string& guid, StoreCallback callback) override; | 30 void Remove(const std::string& guid, const StoreCallback& callback) override; |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 void OnInitFinished(InitCallback callback); | 33 void OnInitFinished(const InitCallback& callback); |
| 34 | 34 |
| 35 // Whether or not this Store is 'initialized.' Just gets set to |true| once | 35 // Whether or not this Store is 'initialized.' Just gets set to |true| once |
| 36 // Initialize() is called. | 36 // Initialize() is called. |
| 37 bool initialized_; | 37 bool initialized_; |
| 38 | 38 |
| 39 base::WeakPtrFactory<NoopStore> weak_ptr_factory_; | 39 base::WeakPtrFactory<NoopStore> weak_ptr_factory_; |
| 40 | 40 |
| 41 DISALLOW_COPY_AND_ASSIGN(NoopStore); | 41 DISALLOW_COPY_AND_ASSIGN(NoopStore); |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 } // namespace download | 44 } // namespace download |
| 45 | 45 |
| 46 #endif // COMPONENTS_DOWNLOAD_INTERNAL_NOOP_STORE_H_ | 46 #endif // COMPONENTS_DOWNLOAD_INTERNAL_TEST_NOOP_STORE_H_ |
| OLD | NEW |