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

Side by Side Diff: components/doodle/doodle_fetcher.h

Issue 2725143003: [Doodle] Pull time_to_live out of DoodleConfig (Closed)
Patch Set: mastiz review Created 3 years, 9 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 | « no previous file | components/doodle/doodle_fetcher_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_DOODLE_DOODLE_FETCHER_H_ 5 #ifndef COMPONENTS_DOODLE_DOODLE_FETCHER_H_
6 #define COMPONENTS_DOODLE_DOODLE_FETCHER_H_ 6 #define COMPONENTS_DOODLE_DOODLE_FETCHER_H_
7 7
8 #include "base/callback_forward.h" 8 #include "base/callback_forward.h"
9 #include "base/optional.h" 9 #include "base/optional.h"
10 #include "components/doodle/doodle_types.h" 10 #include "components/doodle/doodle_types.h"
11 11
12 namespace base {
13 class TimeDelta;
14 }
15
12 namespace doodle { 16 namespace doodle {
13 17
14 // Interface for fetching the current doodle from the network. 18 // Interface for fetching the current doodle from the network.
15 // It asynchronously calls a callback when fetching the doodle information from 19 // It asynchronously calls a callback when fetching the doodle information from
16 // the remote enpoint finishes. 20 // the remote enpoint finishes.
17 // DoodleFetcherImpl is the default implementation; this interface exists to 21 // DoodleFetcherImpl is the default implementation; this interface exists to
18 // make it easy to use fakes or mocks in tests. 22 // make it easy to use fakes or mocks in tests.
19 class DoodleFetcher { 23 class DoodleFetcher {
20 public: 24 public:
21 // Callback that is invoked when the fetching is done. 25 // Callback that is invoked when the fetching is done.
22 // |doodle_config| will only contain a value if |state| is AVAILABLE. 26 // |time_to_live| will only be meaningful, and |doodle_config| will only
27 // contain a value, if |state| is AVAILABLE.
23 using FinishedCallback = base::OnceCallback<void( 28 using FinishedCallback = base::OnceCallback<void(
24 DoodleState state, 29 DoodleState state,
30 base::TimeDelta time_to_live,
25 const base::Optional<DoodleConfig>& doodle_config)>; 31 const base::Optional<DoodleConfig>& doodle_config)>;
26 32
27 virtual ~DoodleFetcher() = default; 33 virtual ~DoodleFetcher() = default;
28 34
29 // Fetches a doodle asynchronously. The |callback| is called with a 35 // Fetches a doodle asynchronously. The |callback| is called with a
30 // DoodleState indicating whether the request succeded in fetching a doodle. 36 // DoodleState indicating whether the request succeded in fetching a doodle.
31 // If a fetch is already running, the callback will be queued and invoked with 37 // If a fetch is already running, the callback will be queued and invoked with
32 // the result from the next completed request. 38 // the result from the next completed request.
33 virtual void FetchDoodle(FinishedCallback callback) = 0; 39 virtual void FetchDoodle(FinishedCallback callback) = 0;
34 }; 40 };
35 41
36 } // namespace doodle 42 } // namespace doodle
37 43
38 #endif // COMPONENTS_DOODLE_DOODLE_FETCHER_H_ 44 #endif // COMPONENTS_DOODLE_DOODLE_FETCHER_H_
OLDNEW
« no previous file with comments | « no previous file | components/doodle/doodle_fetcher_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698