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

Unified Diff: components/suggestions/suggestions_service.h

Issue 527943002: [Most Visited] Check for Sync state when using SuggestionsService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2125
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/suggestions/BUILD.gn ('k') | components/suggestions/suggestions_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/suggestions/suggestions_service.h
diff --git a/components/suggestions/suggestions_service.h b/components/suggestions/suggestions_service.h
index 3aa03a0185db6ec39a072505c44a7d177048ab05..e495f7f8aac23fd5dc46fd541355be7027e45097 100644
--- a/components/suggestions/suggestions_service.h
+++ b/components/suggestions/suggestions_service.h
@@ -19,6 +19,7 @@
#include "components/keyed_service/core/keyed_service.h"
#include "components/suggestions/image_manager.h"
#include "components/suggestions/proto/suggestions.pb.h"
+#include "components/suggestions/suggestions_utils.h"
#include "net/url_request/url_fetcher_delegate.h"
#include "ui/gfx/image/image_skia.h"
#include "url/gurl.h"
@@ -64,16 +65,20 @@ class SuggestionsService : public KeyedService, public net::URLFetcherDelegate {
// Whether the user is part of a control group.
static bool IsControlGroup();
- // Request suggestions data, which will be passed to |callback|. Initiates a
- // fetch request unless a pending one exists. To prevent multiple requests,
- // we place all |callback|s in a queue and update them simultaneously when
- // fetch request completes. Also posts a task to execute OnRequestTimeout
- // if the request hasn't completed in a given amount of time.
- void FetchSuggestionsData(ResponseCallback callback);
-
- // Similar to FetchSuggestionsData but doesn't post a task to execute
- // OnDelaySinceFetch.
- void FetchSuggestionsDataNoTimeout(ResponseCallback callback);
+ // Request suggestions data, which will be passed to |callback|. |sync_state|
+ // will influence the behavior of this function (see SyncState definition).
+ //
+ // |sync_state| must be specified based on the current state of the system
+ // (see suggestions::GetSyncState). Callers should call this function again if
+ // sync state changes.
+ //
+ // If state allows for a network request, it is initiated unless a pending one
+ // exists. To prevent multiple requests, all |callback|s are placed in a queue
+ // and are updated simultaneously when the fetch completes. Also posts a task
+ // to execute OnRequestTimeout if the request hasn't completed in a given
+ // amount of time.
+ void FetchSuggestionsData(SyncState sync_state,
+ ResponseCallback callback);
// Retrieves stored thumbnail for website |url| asynchronously. Calls
// |callback| with Bitmap pointer if found, and NULL otherwise.
@@ -97,10 +102,15 @@ class SuggestionsService : public KeyedService, public net::URLFetcherDelegate {
void SetDefaultExpiryTimestamp(SuggestionsProfile* suggestions,
int64 timestamp_usec);
private:
+ friend class SuggestionsServiceTest;
FRIEND_TEST_ALL_PREFIXES(SuggestionsServiceTest, BlacklistURLFails);
FRIEND_TEST_ALL_PREFIXES(SuggestionsServiceTest, FetchSuggestionsData);
FRIEND_TEST_ALL_PREFIXES(SuggestionsServiceTest, UpdateBlacklistDelay);
+ // Similar to FetchSuggestionsData but doesn't post a task to execute
+ // OnDelaySinceFetch.
+ void FetchSuggestionsDataNoTimeout(ResponseCallback callback);
+
// Issue a request.
void IssueRequest(const GURL& url);
« no previous file with comments | « components/suggestions/BUILD.gn ('k') | components/suggestions/suggestions_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698