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/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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 // conditions. Also store a cached copy here such that Tab knows that | 107 // conditions. Also store a cached copy here such that Tab knows that |
108 // the offline page is opened. | 108 // the offline page is opened. |
109 if (OfflinePageUtils::MightBeOfflineURL(navigated_url)) { | 109 if (OfflinePageUtils::MightBeOfflineURL(navigated_url)) { |
110 OfflinePageModel* offline_page_model = | 110 OfflinePageModel* offline_page_model = |
111 OfflinePageModelFactory::GetForBrowserContext( | 111 OfflinePageModelFactory::GetForBrowserContext( |
112 web_contents()->GetBrowserContext()); | 112 web_contents()->GetBrowserContext()); |
113 if (offline_page_model) { | 113 if (offline_page_model) { |
114 const OfflinePageItem* offline_page = | 114 const OfflinePageItem* offline_page = |
115 offline_page_model->MaybeGetPageByOfflineURL(navigated_url); | 115 offline_page_model->MaybeGetPageByOfflineURL(navigated_url); |
116 if (offline_page && | 116 if (offline_page && |
117 offline_page->client_id.name_space == kDownloadNamespace) { | 117 (offline_page->client_id.name_space == kDownloadNamespace || |
| 118 offline_page->client_id.name_space == kAsyncNamespace)) { |
118 offline_page_ = base::MakeUnique<OfflinePageItem>(*offline_page); | 119 offline_page_ = base::MakeUnique<OfflinePageItem>(*offline_page); |
119 return; | 120 return; |
120 } | 121 } |
121 } | 122 } |
122 } | 123 } |
123 | 124 |
124 // Ignore navigations that are forward or back transitions in the nav stack | 125 // Ignore navigations that are forward or back transitions in the nav stack |
125 // which are not at the head of the stack. | 126 // which are not at the head of the stack. |
126 // TODO(dimich): Not sure this is needed. Clarify and remove. Bug 624216. | 127 // TODO(dimich): Not sure this is needed. Clarify and remove. Bug 624216. |
127 const content::NavigationController& controller = | 128 const content::NavigationController& controller = |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 entry->GetRedirectChain().back() == to_url; | 319 entry->GetRedirectChain().back() == to_url; |
319 } | 320 } |
320 | 321 |
321 void OfflinePageTabHelper::ReportRedirectResultUMA(RedirectResult result) { | 322 void OfflinePageTabHelper::ReportRedirectResultUMA(RedirectResult result) { |
322 UMA_HISTOGRAM_ENUMERATION("OfflinePages.RedirectResult", | 323 UMA_HISTOGRAM_ENUMERATION("OfflinePages.RedirectResult", |
323 static_cast<int>(result), | 324 static_cast<int>(result), |
324 static_cast<int>(RedirectResult::REDIRECT_RESULT_MAX)); | 325 static_cast<int>(RedirectResult::REDIRECT_RESULT_MAX)); |
325 } | 326 } |
326 | 327 |
327 } // namespace offline_pages | 328 } // namespace offline_pages |
OLD | NEW |