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

Side by Side Diff: chrome/browser/android/offline_pages/recent_tab_helper.cc

Issue 2234873004: Have the RequestCoordinator generate the offline_id (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge, and CR fixes per Dimich Created 4 years, 4 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 (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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 // If previous pages can't be deleted, don't add new ones. 159 // If previous pages can't be deleted, don't add new ones.
160 ReportSnapshotCompleted(); 160 ReportSnapshotCompleted();
161 return; 161 return;
162 } 162 }
163 163
164 if (!IsSamePage()) { 164 if (!IsSamePage()) {
165 ReportSnapshotCompleted(); 165 ReportSnapshotCompleted();
166 return; 166 return;
167 } 167 }
168 168
169 page_model_->SavePage( 169 page_model_->SavePage(snapshot_url_, client_id(), 0ul,
dougarnett 2016/08/18 17:59:07 possibly dumb C++ question: why are you using "u"
170 snapshot_url_, client_id(), 170 delegate_->CreatePageArchiver(web_contents()),
171 delegate_->CreatePageArchiver(web_contents()), 171 base::Bind(&RecentTabHelper::SavePageCallback,
172 base::Bind(&RecentTabHelper::SavePageCallback, 172 weak_ptr_factory_.GetWeakPtr()));
173 weak_ptr_factory_.GetWeakPtr()));
174 } 173 }
175 174
176 void RecentTabHelper::SavePageCallback(OfflinePageModel::SavePageResult result, 175 void RecentTabHelper::SavePageCallback(OfflinePageModel::SavePageResult result,
177 int64_t offline_id) { 176 int64_t offline_id) {
178 ReportSnapshotCompleted(); 177 ReportSnapshotCompleted();
179 } 178 }
180 179
181 void RecentTabHelper::ReportSnapshotCompleted() { 180 void RecentTabHelper::ReportSnapshotCompleted() {
182 snapshot_controller_->PendingSnapshotCompleted(); 181 snapshot_controller_->PendingSnapshotCompleted();
183 } 182 }
184 183
185 bool RecentTabHelper::IsSamePage() const { 184 bool RecentTabHelper::IsSamePage() const {
186 return web_contents() && 185 return web_contents() &&
187 (web_contents()->GetLastCommittedURL() == snapshot_url_); 186 (web_contents()->GetLastCommittedURL() == snapshot_url_);
188 } 187 }
189 188
190 ClientId RecentTabHelper::client_id() const { 189 ClientId RecentTabHelper::client_id() const {
191 return ClientId(kLastNNamespace, tab_id_); 190 return ClientId(kLastNNamespace, tab_id_);
192 } 191 }
193 192
194 } // namespace offline_pages 193 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698