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

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

Issue 2462713003: Offline Page Cache: do not save a snapshot of a page loaded from a snapshot. (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 download_info_.reset(); 157 download_info_.reset();
158 } 158 }
159 159
160 is_page_ready_for_snapshot_ = false; 160 is_page_ready_for_snapshot_ = false;
161 161
162 // New navigation, new snapshot session. 162 // New navigation, new snapshot session.
163 snapshot_url_ = web_contents()->GetLastCommittedURL(); 163 snapshot_url_ = web_contents()->GetLastCommittedURL();
164 164
165 // Check for conditions that would cause us not to snapshot. 165 // Check for conditions that would cause us not to snapshot.
166 bool can_save = !navigation_handle->IsErrorPage() && 166 bool can_save = !navigation_handle->IsErrorPage() &&
167 OfflinePageModel::CanSaveURL(snapshot_url_); 167 OfflinePageModel::CanSaveURL(snapshot_url_) &&
168 OfflinePageUtils::GetOfflinePageFromWebContents(
169 web_contents()) == nullptr;
168 170
169 UMA_HISTOGRAM_BOOLEAN("OfflinePages.CanSaveRecentPage", can_save); 171 UMA_HISTOGRAM_BOOLEAN("OfflinePages.CanSaveRecentPage", can_save);
170 172
171 // Always reset so that posted tasks get canceled. 173 // Always reset so that posted tasks get canceled.
172 snapshot_controller_->Reset(); 174 snapshot_controller_->Reset();
173 175
174 if (!can_save) 176 if (!can_save)
175 snapshot_controller_->Stop(); 177 snapshot_controller_->Stop();
176 } 178 }
177 179
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 bool RecentTabHelper::IsSamePage() const { 289 bool RecentTabHelper::IsSamePage() const {
288 return web_contents() && 290 return web_contents() &&
289 (web_contents()->GetLastCommittedURL() == snapshot_url_); 291 (web_contents()->GetLastCommittedURL() == snapshot_url_);
290 } 292 }
291 293
292 ClientId RecentTabHelper::GetRecentPagesClientId() const { 294 ClientId RecentTabHelper::GetRecentPagesClientId() const {
293 return ClientId(kLastNNamespace, tab_id_); 295 return ClientId(kLastNNamespace, tab_id_);
294 } 296 }
295 297
296 } // namespace offline_pages 298 } // namespace offline_pages
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698