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

Side by Side Diff: components/download/internal/store.h

Issue 2870753003: Add a Model to the download component. (Closed)
Patch Set: Renamed test base class Created 3 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
« no previous file with comments | « components/download/internal/noop_store.cc ('k') | components/download/internal/test/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_STORE_H_
6 #define COMPONENTS_DOWNLOAD_INTERNAL_STORE_H_
7
8 #include <memory>
9 #include <string>
10 #include <vector>
11
12 #include "base/callback_forward.h"
13 #include "base/memory/ref_counted.h"
14 #include "base/sequenced_task_runner.h"
15
16 namespace download {
17
18 struct Entry;
19
20 // A backing storage interface responsible for persisting Entry objects.
21 class Store {
22 public:
23 using InitCallback =
24 base::OnceCallback<void(bool success,
25 std::unique_ptr<std::vector<Entry>> entries)>;
26 using StoreCallback = base::OnceCallback<void(bool success)>;
27
28 virtual ~Store() = default;
29
30 // Returns whether or not this Store is initialized and can be interracted
31 // with.
32 virtual bool IsInitialized() = 0;
33
34 // Initializes this Store and asynchronously returns whether or not that
35 // initialization was successful as well as a list of Entry objects from the
36 // Store.
37 virtual void Initialize(InitCallback callback) = 0;
38
39 // Destroyes the store and asynchronously returns whether or not that
40 // destruction was successful.
41 virtual void Destroy(StoreCallback callback) = 0;
42
43 // Adds or updates |entry| in this Store asynchronously and returns whether or
44 // not that was successful.
45 virtual void Update(const Entry& entry, StoreCallback callback) = 0;
46
47 // Removes the Entry associated with |guid| from this Store asynchronously and
48 // returns whether or not that was successful.
49 virtual void Remove(const std::string& guid, StoreCallback callback) = 0;
50 };
51
52 } // namespace download
53
54 #endif // COMPONENTS_DOWNLOAD_INTERNAL_STORE_H_
OLDNEW
« no previous file with comments | « components/download/internal/noop_store.cc ('k') | components/download/internal/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698