| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/recent_tab_helper.h" | 5 #include "chrome/browser/android/offline_pages/recent_tab_helper.h" |
| 6 | 6 |
| 7 #include <queue> | 7 #include <queue> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 // No snapshots yet happened on the current page - return and wait for some. | 93 // No snapshots yet happened on the current page - return and wait for some. |
| 94 if (!is_page_ready_for_snapshot_) | 94 if (!is_page_ready_for_snapshot_) |
| 95 return; | 95 return; |
| 96 | 96 |
| 97 // If snapshot already happened and we missed it, go ahead and snapshot now. | 97 // If snapshot already happened and we missed it, go ahead and snapshot now. |
| 98 OfflinePageModel::SavePageParams save_page_params; | 98 OfflinePageModel::SavePageParams save_page_params; |
| 99 save_page_params.url = web_contents()->GetLastCommittedURL(); | 99 save_page_params.url = web_contents()->GetLastCommittedURL(); |
| 100 save_page_params.client_id = client_id; | 100 save_page_params.client_id = client_id; |
| 101 save_page_params.proposed_offline_id = request_id; | 101 save_page_params.proposed_offline_id = request_id; |
| 102 save_page_params.is_background = false; |
| 102 page_model_->SavePage( | 103 page_model_->SavePage( |
| 103 save_page_params, | 104 save_page_params, |
| 104 delegate_->CreatePageArchiver(web_contents()), | 105 delegate_->CreatePageArchiver(web_contents()), |
| 105 base::Bind(&RecentTabHelper::SavePageCallback, | 106 base::Bind(&RecentTabHelper::SavePageCallback, |
| 106 weak_ptr_factory_.GetWeakPtr())); | 107 weak_ptr_factory_.GetWeakPtr())); |
| 107 } | 108 } |
| 108 | 109 |
| 109 // Initialize lazily. It needs TabAndroid for initialization, which is also a | 110 // Initialize lazily. It needs TabAndroid for initialization, which is also a |
| 110 // TabHelper - so can't initialize in constructor because of uncertain order | 111 // TabHelper - so can't initialize in constructor because of uncertain order |
| 111 // of creation of TabHelpers. | 112 // of creation of TabHelpers. |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 else | 283 else |
| 283 request_coordinator->EnableForOffliner(snapshot_info_->request_id, | 284 request_coordinator->EnableForOffliner(snapshot_info_->request_id, |
| 284 snapshot_info_->client_id); | 285 snapshot_info_->client_id); |
| 285 } | 286 } |
| 286 | 287 |
| 287 ClientId RecentTabHelper::GetRecentPagesClientId() const { | 288 ClientId RecentTabHelper::GetRecentPagesClientId() const { |
| 288 return ClientId(kLastNNamespace, tab_id_); | 289 return ClientId(kLastNNamespace, tab_id_); |
| 289 } | 290 } |
| 290 | 291 |
| 291 } // namespace offline_pages | 292 } // namespace offline_pages |
| OLD | NEW |