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

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

Issue 2773273002: Last_n: do not save snapshot of custom tabs. (Closed)
Patch Set: Renamed method; added custom tab checks to tests. Created 3 years, 9 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_utils.h" 5 #include "chrome/browser/android/offline_pages/offline_page_utils.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/guid.h" 8 #include "base/guid.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 bool OfflinePageUtils::GetTabId(content::WebContents* web_contents, 151 bool OfflinePageUtils::GetTabId(content::WebContents* web_contents,
152 int* tab_id) { 152 int* tab_id) {
153 TabAndroid* tab_android = TabAndroid::FromWebContents(web_contents); 153 TabAndroid* tab_android = TabAndroid::FromWebContents(web_contents);
154 if (!tab_android) 154 if (!tab_android)
155 return false; 155 return false;
156 *tab_id = tab_android->GetAndroidId(); 156 *tab_id = tab_android->GetAndroidId();
157 return true; 157 return true;
158 } 158 }
159 159
160 // static 160 // static
161 bool OfflinePageUtils::CurrentlyShownInCustomTab(
162 content::WebContents* web_contents) {
163 TabAndroid* tab_android = TabAndroid::FromWebContents(web_contents);
164 DCHECK(tab_android);
165 return tab_android && tab_android->IsCurrentlyACustomTab();
166 }
167
168 // static
161 void OfflinePageUtils::CheckExistenceOfPagesWithURL( 169 void OfflinePageUtils::CheckExistenceOfPagesWithURL(
162 content::BrowserContext* browser_context, 170 content::BrowserContext* browser_context,
163 const std::string name_space, 171 const std::string name_space,
164 const GURL& offline_page_url, 172 const GURL& offline_page_url,
165 const PagesExistCallback& callback) { 173 const PagesExistCallback& callback) {
166 OfflinePageModel* offline_page_model = 174 OfflinePageModel* offline_page_model =
167 OfflinePageModelFactory::GetForBrowserContext(browser_context); 175 OfflinePageModelFactory::GetForBrowserContext(browser_context);
168 DCHECK(offline_page_model); 176 DCHECK(offline_page_model);
169 auto continuation = []( 177 auto continuation = [](
170 const std::string& name_space, 178 const std::string& name_space,
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 GURL OfflinePageUtils::GetOriginalURLFromWebContents( 264 GURL OfflinePageUtils::GetOriginalURLFromWebContents(
257 content::WebContents* web_contents) { 265 content::WebContents* web_contents) {
258 content::NavigationEntry* entry = 266 content::NavigationEntry* entry =
259 web_contents->GetController().GetLastCommittedEntry(); 267 web_contents->GetController().GetLastCommittedEntry();
260 if (!entry || entry->GetRedirectChain().size() <= 1) 268 if (!entry || entry->GetRedirectChain().size() <= 1)
261 return GURL(); 269 return GURL();
262 return entry->GetRedirectChain().front(); 270 return entry->GetRedirectChain().front();
263 } 271 }
264 272
265 } // namespace offline_pages 273 } // namespace offline_pages
OLDNEW
« no previous file with comments | « chrome/browser/android/offline_pages/offline_page_utils.h ('k') | chrome/browser/android/offline_pages/recent_tab_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698