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

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

Issue 2150103002: [Offline Pages] Allows offline redirection to offline pages with Aync Loading namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/offline_page_tab_helper_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/offline_page_tab_helper.h" 5 #include "chrome/browser/android/offline_pages/offline_page_tab_helper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 // page, so we can leave. 205 // page, so we can leave.
206 std::string tab_id; 206 std::string tab_id;
207 if (!delegate_->GetTabId(web_contents(), &tab_id)) { 207 if (!delegate_->GetTabId(web_contents(), &tab_id)) {
208 ReportRedirectResultUMA(RedirectResult::NO_TAB_ID); 208 ReportRedirectResultUMA(RedirectResult::NO_TAB_ID);
209 return; 209 return;
210 } 210 }
211 211
212 const OfflinePageItem* selected_page = nullptr; 212 const OfflinePageItem* selected_page = nullptr;
213 for (const auto& offline_page : pages) { 213 for (const auto& offline_page : pages) {
214 if ((offline_page.client_id.name_space == kBookmarkNamespace) || 214 if ((offline_page.client_id.name_space == kBookmarkNamespace) ||
215 (offline_page.client_id.name_space == kAsyncNamespace) ||
215 (offline_page.client_id.name_space == kLastNNamespace && 216 (offline_page.client_id.name_space == kLastNNamespace &&
216 offline_page.client_id.id == tab_id)) { 217 offline_page.client_id.id == tab_id)) {
217 if (!selected_page || 218 if (!selected_page ||
218 offline_page.creation_time > selected_page->creation_time) { 219 offline_page.creation_time > selected_page->creation_time) {
219 selected_page = &offline_page; 220 selected_page = &offline_page;
220 } 221 }
221 } 222 }
222 } 223 }
223 224
224 if (!selected_page) { 225 if (!selected_page) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 !entry->GetRedirectChain().empty() && 267 !entry->GetRedirectChain().empty() &&
267 entry->GetRedirectChain().back() == to_url; 268 entry->GetRedirectChain().back() == to_url;
268 } 269 }
269 270
270 void OfflinePageTabHelper::ReportRedirectResultUMA(RedirectResult result) { 271 void OfflinePageTabHelper::ReportRedirectResultUMA(RedirectResult result) {
271 UMA_HISTOGRAM_ENUMERATION("OfflinePages.RedirectResult", 272 UMA_HISTOGRAM_ENUMERATION("OfflinePages.RedirectResult",
272 static_cast<int>(result), 273 static_cast<int>(result),
273 static_cast<int>(RedirectResult::REDIRECT_RESULT_MAX)); 274 static_cast<int>(RedirectResult::REDIRECT_RESULT_MAX));
274 } 275 }
275 } // namespace offline_pages 276 } // namespace offline_pages
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/offline_page_tab_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698