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

Side by Side Diff: components/offline_pages/background/save_page_request.h

Issue 2113383002: More detailed implementation of the RequestPicker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix time check and MeetsConditions check Created 4 years, 5 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_OFFLINE_PAGES_BACKGROUND_SAVE_PAGE_REQUEST_H_ 5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_SAVE_PAGE_REQUEST_H_
6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_SAVE_PAGE_REQUEST_H_ 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_SAVE_PAGE_REQUEST_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 12 matching lines...) Expand all
23 // when it gets a chance to. 23 // when it gets a chance to.
24 STARTED, // The request is currently being processed. 24 STARTED, // The request is currently being processed.
25 FAILED, // Page request failed many times and will no longer be 25 FAILED, // Page request failed many times and will no longer be
26 // retried. 26 // retried.
27 EXPIRED, // Save page request expired without being fulfilled. 27 EXPIRED, // Save page request expired without being fulfilled.
28 }; 28 };
29 29
30 SavePageRequest(int64_t request_id, 30 SavePageRequest(int64_t request_id,
31 const GURL& url, 31 const GURL& url,
32 const ClientId& client_id, 32 const ClientId& client_id,
33 const base::Time& creation_time);
34 SavePageRequest(int64_t request_id,
35 const GURL& url,
36 const ClientId& client_id,
37 const base::Time& creation_time, 33 const base::Time& creation_time,
38 const base::Time& activation_time); 34 const bool was_user_reqeusted);
dougarnett 2016/07/18 21:45:45 spelling
35 SavePageRequest(int64_t request_id,
36 const GURL& url,
37 const ClientId& client_id,
38 const base::Time& creation_time,
39 const base::Time& activation_time,
40 const bool was_user_reqeusted);
39 SavePageRequest(const SavePageRequest& other); 41 SavePageRequest(const SavePageRequest& other);
40 ~SavePageRequest(); 42 ~SavePageRequest();
41 43
42 // Status of this request. 44 // Status of this request.
43 Status GetStatus(const base::Time& now) const; 45 Status GetStatus(const base::Time& now) const;
44 46
45 // Updates the |last_attempt_time_| and increments |attempt_count_|. 47 // Updates the |last_attempt_time_| and increments |attempt_count_|.
46 void MarkAttemptStarted(const base::Time& start_time); 48 void MarkAttemptStarted(const base::Time& start_time);
47 49
48 // Marks attempt as completed and clears |last_attempt_time_|. 50 // Marks attempt as completed and clears |last_attempt_time_|.
(...skipping 12 matching lines...) Expand all
61 int64_t attempt_count() const { return attempt_count_; } 63 int64_t attempt_count() const { return attempt_count_; }
62 void set_attempt_count(int64_t attempt_count) { 64 void set_attempt_count(int64_t attempt_count) {
63 attempt_count_ = attempt_count; 65 attempt_count_ = attempt_count;
64 } 66 }
65 67
66 const base::Time& last_attempt_time() const { return last_attempt_time_; } 68 const base::Time& last_attempt_time() const { return last_attempt_time_; }
67 void set_last_attempt_time(const base::Time& last_attempt_time) { 69 void set_last_attempt_time(const base::Time& last_attempt_time) {
68 last_attempt_time_ = last_attempt_time; 70 last_attempt_time_ = last_attempt_time;
69 } 71 }
70 72
73 bool user_requested() const { return user_requested_; }
74
75 void set_user_reqeusted(bool user_requested) {
dougarnett 2016/07/18 21:45:45 spelling
Pete Williamson 2016/07/18 22:52:09 Done.
76 user_requested_ = user_requested;
77 }
78
71 private: 79 private:
72 // ID of this request. 80 // ID of this request.
73 int64_t request_id_; 81 int64_t request_id_;
74 82
75 // Online URL of a page to be offlined. 83 // Online URL of a page to be offlined.
76 GURL url_; 84 GURL url_;
77 85
78 // Client ID related to the request. Contains namespace and ID assigned by the 86 // Client ID related to the request. Contains namespace and ID assigned by the
79 // requester. 87 // requester.
80 ClientId client_id_; 88 ClientId client_id_;
81 89
82 // Time when this request was created. (Alternative 2). 90 // Time when this request was created. (Alternative 2).
83 base::Time creation_time_; 91 base::Time creation_time_;
84 92
85 // Time when this request will become active. 93 // Time when this request will become active.
86 base::Time activation_time_; 94 base::Time activation_time_;
87 95
88 // Number of attempts made to get the page. 96 // Number of attempts made to get the page.
89 int attempt_count_; 97 int attempt_count_;
90 98
91 // Timestamp of the last request starting. 99 // Timestamp of the last request starting.
92 base::Time last_attempt_time_; 100 base::Time last_attempt_time_;
101
102 // Whether the user specifically requested this page (as opposed to a client
103 // like AGSA or Now.)
104 bool user_requested_;
93 }; 105 };
94 106
95 } // namespace offline_pages 107 } // namespace offline_pages
96 108
97 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_SAVE_PAGE_REQUEST_H_ 109 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_SAVE_PAGE_REQUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698