| 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/background/save_page_request.h" | 5 #include "components/offline_pages/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 11 matching lines...) Expand all Loading... |
| 22 const ClientId& client_id, | 22 const ClientId& client_id, |
| 23 const base::Time& creation_time, | 23 const base::Time& creation_time, |
| 24 const base::Time& activation_time) | 24 const base::Time& activation_time) |
| 25 : request_id_(request_id), | 25 : request_id_(request_id), |
| 26 url_(url), | 26 url_(url), |
| 27 client_id_(client_id), | 27 client_id_(client_id), |
| 28 creation_time_(creation_time), | 28 creation_time_(creation_time), |
| 29 activation_time_(activation_time), | 29 activation_time_(activation_time), |
| 30 attempt_count_(0) {} | 30 attempt_count_(0) {} |
| 31 | 31 |
| 32 SavePageRequest::SavePageRequest(const SavePageRequest& other) |
| 33 : request_id_(other.request_id_), |
| 34 url_(other.url_), |
| 35 client_id_(other.client_id_), |
| 36 creation_time_(other.creation_time_), |
| 37 activation_time_(other.activation_time_), |
| 38 attempt_count_(other.attempt_count_), |
| 39 last_attempt_time_(other.last_attempt_time_) {} |
| 40 |
| 32 SavePageRequest::~SavePageRequest() {} | 41 SavePageRequest::~SavePageRequest() {} |
| 33 | 42 |
| 34 // TODO(fgorski): Introduce policy parameter, once policy is available. | 43 // TODO(fgorski): Introduce policy parameter, once policy is available. |
| 35 SavePageRequest::Status SavePageRequest::GetStatus( | 44 SavePageRequest::Status SavePageRequest::GetStatus( |
| 36 const base::Time& now) const { | 45 const base::Time& now) const { |
| 37 if (now < activation_time_) | 46 if (now < activation_time_) |
| 38 return Status::kNotReady; | 47 return Status::kNotReady; |
| 39 | 48 |
| 40 // TODO(fgorski): enable check once policy available. | 49 // TODO(fgorski): enable check once policy available. |
| 41 // if (attempt_count_ >= policy.max_attempt_count) | 50 // if (attempt_count_ >= policy.max_attempt_count) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 58 // other cases. | 67 // other cases. |
| 59 last_attempt_time_ = start_time; | 68 last_attempt_time_ = start_time; |
| 60 ++attempt_count_; | 69 ++attempt_count_; |
| 61 } | 70 } |
| 62 | 71 |
| 63 void SavePageRequest::MarkAttemptCompleted() { | 72 void SavePageRequest::MarkAttemptCompleted() { |
| 64 last_attempt_time_ = base::Time(); | 73 last_attempt_time_ = base::Time(); |
| 65 } | 74 } |
| 66 | 75 |
| 67 } // namespace offline_pages | 76 } // namespace offline_pages |
| OLD | NEW |