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

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

Issue 2472863002: Adding offline navigations to the previews blacklist (Closed)
Patch Set: megjablon comments 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 | chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.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 "chrome/browser/android/offline_pages/offline_page_request_job.h" 10 #include "chrome/browser/android/offline_pages/offline_page_request_job.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 // This is a new navigation so we can invalidate any previously scheduled 50 // This is a new navigation so we can invalidate any previously scheduled
51 // operations. 51 // operations.
52 weak_ptr_factory_.InvalidateWeakPtrs(); 52 weak_ptr_factory_.InvalidateWeakPtrs();
53 reloading_url_on_net_error_ = false; 53 reloading_url_on_net_error_ = false;
54 54
55 // The provisional offline info can be cleared no matter how. 55 // The provisional offline info can be cleared no matter how.
56 provisional_offline_info_.Clear(); 56 provisional_offline_info_.Clear();
57 57
58 // If not a fragment navigation, clear the cached offline info. 58 // If not a fragment navigation, clear the cached offline info.
59 if (offline_info_.offline_page.get() && 59 if (offline_info_.offline_page.get() && !navigation_handle->IsSamePage()) {
60 !OfflinePageUtils::EqualsIgnoringFragment(offline_info_.offline_page->url,
61 navigation_handle->GetURL())) {
62 offline_info_.Clear(); 60 offline_info_.Clear();
63 } 61 }
64 } 62 }
65 63
66 void OfflinePageTabHelper::DidFinishNavigation( 64 void OfflinePageTabHelper::DidFinishNavigation(
67 content::NavigationHandle* navigation_handle) { 65 content::NavigationHandle* navigation_handle) {
68 // Skips non-main frame. 66 // Skips non-main frame.
69 if (!navigation_handle->IsInMainFrame()) 67 if (!navigation_handle->IsInMainFrame())
70 return; 68 return;
71 69
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 } 177 }
180 178
181 bool OfflinePageTabHelper::IsShowingOfflinePreview() const { 179 bool OfflinePageTabHelper::IsShowingOfflinePreview() const {
182 // TODO(ryansturm): Change this once offline pages infrastructure uses 180 // TODO(ryansturm): Change this once offline pages infrastructure uses
183 // NavigationHandle instead of a back channel. crbug.com/658899 181 // NavigationHandle instead of a back channel. crbug.com/658899
184 return provisional_offline_info_.is_showing_offline_preview || 182 return provisional_offline_info_.is_showing_offline_preview ||
185 offline_info_.is_showing_offline_preview; 183 offline_info_.is_showing_offline_preview;
186 } 184 }
187 185
188 } // namespace offline_pages 186 } // namespace offline_pages
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698