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

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

Powered by Google App Engine
This is Rietveld 408576698