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

Side by Side Diff: components/offline_pages/core/prefetch/generate_page_bundle_request.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 unified diff | Download patch
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_OFFLINE_PAGES_CORE_PREFETCH_GENERATE_PAGE_BUNDLE_REQUEST_H_
6 #define COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_GENERATE_PAGE_BUNDLE_REQUEST_H_
7
8 #include <vector>
9
10 #include "base/callback.h"
11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h"
13 #include "components/offline_pages/core/prefetch/prefetch_types.h"
14
15 namespace net {
16 class URLRequestContextGetter;
17 }
18
19 namespace offline_pages {
20
21 class PrefetchRequestFetcher;
22 namespace proto {
23 class Any;
24 class Operation;
25 } // namespace proto
26
27 class GeneratePageBundleRequest {
28 public:
29 using FinishedCallback =
30 base::Callback<void(PrefetchRequestStatus status,
31 const std::vector<RenderPageInfo>& pages)>;
32
33 GeneratePageBundleRequest(
34 const std::string& user_agent,
35 const std::string& gcm_registration_id,
36 int max_bundle_size_bytes,
37 const std::vector<std::string>& page_urls,
38 net::URLRequestContextGetter* request_context_getter,
39 const FinishedCallback& callback);
40 ~GeneratePageBundleRequest();
41
42 private:
43 void OnCompleted(PrefetchRequestStatus status, const std::string& data);
44 void ParseDoneOperationResponse(const proto::Operation& operation);
45 void ParsePendingOperationResponse(const proto::Operation& operation);
46 void ParseAnyData(const proto::Any& any_data);
47 void NotifyParsingFailure();
48
49 FinishedCallback callback_;
50 std::unique_ptr<PrefetchRequestFetcher> fetcher_;
51
52 DISALLOW_COPY_AND_ASSIGN(GeneratePageBundleRequest);
53 };
54
55 } // namespace offline_pages
56
57 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_GENERATE_PAGE_BUNDLE_REQUEST_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698