OLD | NEW |
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 #include "components/offline_pages/core/background/save_page_request.h" | 5 #include "components/offline_pages/core/background/save_page_request.h" |
6 | 6 |
7 namespace offline_pages { | 7 namespace offline_pages { |
8 | 8 |
9 SavePageRequest::SavePageRequest(int64_t request_id, | 9 SavePageRequest::SavePageRequest(int64_t request_id, |
10 const GURL& url, | 10 const GURL& url, |
(...skipping 29 matching lines...) Expand all Loading... |
40 SavePageRequest::SavePageRequest(const SavePageRequest& other) | 40 SavePageRequest::SavePageRequest(const SavePageRequest& other) |
41 : request_id_(other.request_id_), | 41 : request_id_(other.request_id_), |
42 url_(other.url_), | 42 url_(other.url_), |
43 client_id_(other.client_id_), | 43 client_id_(other.client_id_), |
44 creation_time_(other.creation_time_), | 44 creation_time_(other.creation_time_), |
45 activation_time_(other.activation_time_), | 45 activation_time_(other.activation_time_), |
46 started_attempt_count_(other.started_attempt_count_), | 46 started_attempt_count_(other.started_attempt_count_), |
47 completed_attempt_count_(other.completed_attempt_count_), | 47 completed_attempt_count_(other.completed_attempt_count_), |
48 last_attempt_time_(other.last_attempt_time_), | 48 last_attempt_time_(other.last_attempt_time_), |
49 user_requested_(other.user_requested_), | 49 user_requested_(other.user_requested_), |
50 state_(other.state_) {} | 50 state_(other.state_), |
| 51 original_url_(other.original_url_) {} |
51 | 52 |
52 SavePageRequest::~SavePageRequest() {} | 53 SavePageRequest::~SavePageRequest() {} |
53 | 54 |
54 bool SavePageRequest::operator==(const SavePageRequest& other) const { | 55 bool SavePageRequest::operator==(const SavePageRequest& other) const { |
55 return request_id_ == other.request_id_ && url_ == other.url_ && | 56 return request_id_ == other.request_id_ && url_ == other.url_ && |
56 client_id_ == other.client_id_ && | 57 client_id_ == other.client_id_ && |
57 creation_time_ == other.creation_time_ && | 58 creation_time_ == other.creation_time_ && |
58 activation_time_ == other.activation_time_ && | 59 activation_time_ == other.activation_time_ && |
59 started_attempt_count_ == other.started_attempt_count_ && | 60 started_attempt_count_ == other.started_attempt_count_ && |
60 completed_attempt_count_ == other.completed_attempt_count_ && | 61 completed_attempt_count_ == other.completed_attempt_count_ && |
61 last_attempt_time_ == other.last_attempt_time_ && | 62 last_attempt_time_ == other.last_attempt_time_ && |
62 state_ == other.state_; | 63 state_ == other.state_ && original_url_ == other.original_url_; |
63 } | 64 } |
64 | 65 |
65 void SavePageRequest::MarkAttemptStarted(const base::Time& start_time) { | 66 void SavePageRequest::MarkAttemptStarted(const base::Time& start_time) { |
66 DCHECK_LE(activation_time_, start_time); | 67 DCHECK_LE(activation_time_, start_time); |
67 // TODO(fgorski): As part of introducing policy in GetStatus, we can make a | 68 // TODO(fgorski): As part of introducing policy in GetStatus, we can make a |
68 // check here to ensure we only start tasks in status pending, and bail out in | 69 // check here to ensure we only start tasks in status pending, and bail out in |
69 // other cases. | 70 // other cases. |
70 last_attempt_time_ = start_time; | 71 last_attempt_time_ = start_time; |
71 ++started_attempt_count_; | 72 ++started_attempt_count_; |
72 state_ = RequestState::OFFLINING; | 73 state_ = RequestState::OFFLINING; |
(...skipping 11 matching lines...) Expand all Loading... |
84 // other things. | 85 // other things. |
85 if (state_ == RequestState::OFFLINING) | 86 if (state_ == RequestState::OFFLINING) |
86 state_ = RequestState::AVAILABLE; | 87 state_ = RequestState::AVAILABLE; |
87 } | 88 } |
88 | 89 |
89 void SavePageRequest::MarkAttemptPaused() { | 90 void SavePageRequest::MarkAttemptPaused() { |
90 state_ = RequestState::PAUSED; | 91 state_ = RequestState::PAUSED; |
91 } | 92 } |
92 | 93 |
93 } // namespace offline_pages | 94 } // namespace offline_pages |
OLD | NEW |