Chromium Code Reviews| 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 "chrome/browser/android/offline_pages/background_loader_offliner.h" | 5 #include "chrome/browser/android/offline_pages/background_loader_offliner.h" |
| 6 | 6 |
| 7 #include "base/sys_info.h" | 7 #include "base/sys_info.h" |
| 8 #include "chrome/browser/android/offline_pages/offline_page_mhtml_archiver.h" | 8 #include "chrome/browser/android/offline_pages/offline_page_mhtml_archiver.h" |
| 9 #include "components/offline_pages/core/background/save_page_request.h" | 9 #include "components/offline_pages/core/background/save_page_request.h" |
| 10 #include "components/offline_pages/core/offline_page_model.h" | 10 #include "components/offline_pages/core/offline_page_model.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 return; | 66 return; |
| 67 | 67 |
| 68 if (save_state_ != NONE) { | 68 if (save_state_ != NONE) { |
| 69 save_state_ = DELETE_AFTER_SAVE; | 69 save_state_ = DELETE_AFTER_SAVE; |
| 70 return; | 70 return; |
| 71 } | 71 } |
| 72 | 72 |
| 73 ResetState(); | 73 ResetState(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 bool BackgroundLoaderOffliner::HandleTimeout(const SavePageRequest& request) { | |
| 77 return false; | |
|
Pete Williamson
2017/01/25 00:06:16
This should have a TODO: decide if we want to also
| |
| 78 } | |
| 79 | |
| 76 void BackgroundLoaderOffliner::DidStopLoading() { | 80 void BackgroundLoaderOffliner::DidStopLoading() { |
| 77 if (!pending_request_.get()) { | 81 if (!pending_request_.get()) { |
| 78 DVLOG(1) << "DidStopLoading called even though no pending request."; | 82 DVLOG(1) << "DidStopLoading called even though no pending request."; |
| 79 return; | 83 return; |
| 80 } | 84 } |
| 81 | 85 |
| 82 save_state_ = SAVING; | 86 save_state_ = SAVING; |
| 83 SavePageRequest request(*pending_request_.get()); | 87 SavePageRequest request(*pending_request_.get()); |
| 84 content::WebContents* web_contents( | 88 content::WebContents* web_contents( |
| 85 content::WebContentsObserver::web_contents()); | 89 content::WebContentsObserver::web_contents()); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 application_state == | 172 application_state == |
| 169 base::android::APPLICATION_STATE_HAS_RUNNING_ACTIVITIES) { | 173 base::android::APPLICATION_STATE_HAS_RUNNING_ACTIVITIES) { |
| 170 DVLOG(1) << "App became active, canceling current offlining request"; | 174 DVLOG(1) << "App became active, canceling current offlining request"; |
| 171 SavePageRequest* request = pending_request_.get(); | 175 SavePageRequest* request = pending_request_.get(); |
| 172 Cancel(); | 176 Cancel(); |
| 173 completion_callback_.Run(*request, RequestStatus::FOREGROUND_CANCELED); | 177 completion_callback_.Run(*request, RequestStatus::FOREGROUND_CANCELED); |
| 174 } | 178 } |
| 175 } | 179 } |
| 176 | 180 |
| 177 } // namespace offline_pages | 181 } // namespace offline_pages |
| OLD | NEW |