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

Side by Side Diff: components/ntp_snippets/remote/remote_suggestions_scheduler.h

Issue 2702223004: [Remote suggestions] Move all decisions to fetch to the scheduler (Closed)
Patch Set: Fixing an embarassing bug :) 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_NTP_SNIPPETS_REMOTE_REMOTE_SUGGESTIONS_SCHEDULER_H_ 5 #ifndef COMPONENTS_NTP_SNIPPETS_REMOTE_REMOTE_SUGGESTIONS_SCHEDULER_H_
6 #define COMPONENTS_NTP_SNIPPETS_REMOTE_REMOTE_SUGGESTIONS_SCHEDULER_H_ 6 #define COMPONENTS_NTP_SNIPPETS_REMOTE_REMOTE_SUGGESTIONS_SCHEDULER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 9
10 namespace ntp_snippets { 10 namespace ntp_snippets {
11 11
12 // Interface for informing the scheduler. 12 // Interface for informing the scheduler.
13 class RemoteSuggestionsScheduler { 13 class RemoteSuggestionsScheduler {
14 public: 14 public:
15 // Internal triggers to consider fetching content suggestions.
16
17 // Called whenever the remote suggestions provider becomes active (on startup,
18 // or later on).
19 virtual void OnProviderActivated() = 0;
20
21 // Called whenever the remote suggestions provider becomes inactive (on
22 // startup, or later on).
23 virtual void OnProviderDeactivated() = 0;
24
25 // Called whenever the remote suggestions provider clears all suggestions.
26 virtual void OnSuggestionsCleared() = 0;
27
28 // Called whenever the remote suggestions provider clears all suggestions
29 // because history gets cleared (and we must not show them any more).
30 virtual void OnHistoryCleared() = 0;
31
15 // External triggers to consider fetching content suggestions. 32 // External triggers to consider fetching content suggestions.
16 33
17 // Called whenever chrome is started warm or the user switches to Chrome. 34 // Called whenever chrome is started warm or the user switches to Chrome.
18 virtual void OnBrowserForegrounded() = 0; 35 virtual void OnBrowserForegrounded() = 0;
19 36
20 // Called whenever chrome is cold started. 37 // Called whenever chrome is cold started.
21 // To keep start ups fast, defer any work possible. 38 // To keep start ups fast, defer any work possible.
22 virtual void OnBrowserColdStart() = 0; 39 virtual void OnBrowserColdStart() = 0;
23 40
24 // Called whenever a new NTP is opened. This may be called on cold starts. 41 // Called whenever a new NTP is opened. This may be called on cold starts.
25 // So to keep start ups fast, defer heavy work for cold starts. 42 // So to keep start ups fast, defer heavy work for cold starts.
26 virtual void OnNTPOpened() = 0; 43 virtual void OnNTPOpened() = 0;
27 44
28 // Fetch content suggestions. 45 // Fetch content suggestions.
29 virtual void OnPersistentSchedulerWakeUp() = 0; 46 virtual void OnPersistentSchedulerWakeUp() = 0;
30 47
31 // Force rescheduling of fetching. 48 // Force rescheduling of fetching.
32 virtual void RescheduleFetching() = 0; 49 virtual void RescheduleFetching() = 0;
33 }; 50 };
34 51
35 } // namespace ntp_snippets 52 } // namespace ntp_snippets
36 53
37 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_REMOTE_SUGGESTIONS_SCHEDULER_H_ 54 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_REMOTE_SUGGESTIONS_SCHEDULER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698