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

Unified Diff: components/offline_pages/core/prefetch/prefetch_request_fetcher.h

Issue 2873383004: [Offline Prefetch] Send GeneratePageBundleRequest to the server (Closed)
Patch Set: Address more feedback 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 side-by-side diff with in-line comments
Download patch
Index: components/offline_pages/core/prefetch/prefetch_request_fetcher.h
diff --git a/components/offline_pages/core/prefetch/prefetch_request_fetcher.h b/components/offline_pages/core/prefetch/prefetch_request_fetcher.h
index 72a10b67aacc8d464b270ce5a911281ebda1dcc7..09c543ab0bbfd0352ad4bda17e6792013e2043f6 100644
--- a/components/offline_pages/core/prefetch/prefetch_request_fetcher.h
+++ b/components/offline_pages/core/prefetch/prefetch_request_fetcher.h
@@ -8,6 +8,7 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
+#include "components/offline_pages/core/prefetch/prefetch_types.h"
#include "net/url_request/url_fetcher_delegate.h"
class GURL;
@@ -15,41 +16,25 @@ namespace net {
class URLRequestContextGetter;
}
-namespace offline_prefetch {
+namespace offline_pages {
class PrefetchRequestFetcher : public net::URLFetcherDelegate {
public:
- enum class Status {
- // Request completed successfully.
- SUCCESS,
- // Request failed due to to local network problem, unrelated to server load
- // levels. The caller will simply reschedule the retry in the next available
- // WiFi window after 15 minutes have passed.
- SHOULD_RETRY_WITHOUT_BACKOFF,
- // Request failed probably related to transient server problems. The caller
- // will reschedule the retry with backoff included.
- SHOULD_RETRY_WITH_BACKOFF,
- // Request failed with error indicating that the server no longer knows how
- // to service a request. The caller will prevent network requests for the
- // period of 1 day.
- SHOULD_SUSPEND
- };
-
- using FinishedCallback =
- base::Callback<void(Status status, const std::string& data)>;
-
- PrefetchRequestFetcher(
- const GURL& url,
- const std::string& message,
- scoped_refptr<net::URLRequestContextGetter> request_context_getter,
- const FinishedCallback& callback);
+ using FinishedCallback = base::Callback<void(PrefetchRequestStatus status,
+ const std::string& data)>;
+
+ PrefetchRequestFetcher(const GURL& url,
+ const std::string& message,
+ net::URLRequestContextGetter* request_context_getter,
+ const FinishedCallback& callback);
~PrefetchRequestFetcher() override;
// URLFetcherDelegate implementation.
void OnURLFetchComplete(const net::URLFetcher* source) override;
private:
- Status ParseResponse(const net::URLFetcher* source, std::string* data);
+ PrefetchRequestStatus ParseResponse(const net::URLFetcher* source,
+ std::string* data);
scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
std::unique_ptr<net::URLFetcher> url_fetcher_;
@@ -58,6 +43,6 @@ class PrefetchRequestFetcher : public net::URLFetcherDelegate {
DISALLOW_COPY_AND_ASSIGN(PrefetchRequestFetcher);
};
-} // namespace offline_prefetch
+} // namespace offline_pages
#endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_REQUEST_FETCHER_H_

Powered by Google App Engine
This is Rietveld 408576698