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

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

Issue 2522073002: [OfflinePages] RequestCoordinatorFactory return null for incognito (Closed)
Patch Set: Merge Created 4 years 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/location.h" 8 #include "base/location.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_piece.h" 10 #include "base/strings/string_piece.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 } 178 }
179 179
180 // static 180 // static
181 void OfflinePageUtils::CheckExistenceOfRequestsWithURL( 181 void OfflinePageUtils::CheckExistenceOfRequestsWithURL(
182 content::BrowserContext* browser_context, 182 content::BrowserContext* browser_context,
183 const std::string name_space, 183 const std::string name_space,
184 const GURL& offline_page_url, 184 const GURL& offline_page_url,
185 const PagesExistCallback& callback) { 185 const PagesExistCallback& callback) {
186 RequestCoordinator* request_coordinator = 186 RequestCoordinator* request_coordinator =
187 RequestCoordinatorFactory::GetForBrowserContext(browser_context); 187 RequestCoordinatorFactory::GetForBrowserContext(browser_context);
188 if (!request_coordinator)
189 return;
188 190
189 auto request_coordinator_continuation = []( 191 auto request_coordinator_continuation = [](
190 const std::string& name_space, const GURL& offline_page_url, 192 const std::string& name_space, const GURL& offline_page_url,
191 const PagesExistCallback& callback, 193 const PagesExistCallback& callback,
192 std::vector<std::unique_ptr<SavePageRequest>> requests) { 194 std::vector<std::unique_ptr<SavePageRequest>> requests) {
193 base::Time latest_request_time; 195 base::Time latest_request_time;
194 for (auto& request : requests) { 196 for (auto& request : requests) {
195 if (request->url() == offline_page_url && 197 if (request->url() == offline_page_url &&
196 request->client_id().name_space == name_space && 198 request->client_id().name_space == name_space &&
197 latest_request_time < request->creation_time()) { 199 latest_request_time < request->creation_time()) {
(...skipping 14 matching lines...) Expand all
212 GURL::Replacements remove_params; 214 GURL::Replacements remove_params;
213 remove_params.ClearRef(); 215 remove_params.ClearRef();
214 216
215 GURL lhs_stripped = lhs.ReplaceComponents(remove_params); 217 GURL lhs_stripped = lhs.ReplaceComponents(remove_params);
216 GURL rhs_stripped = rhs.ReplaceComponents(remove_params); 218 GURL rhs_stripped = rhs.ReplaceComponents(remove_params);
217 219
218 return lhs_stripped == rhs_stripped; 220 return lhs_stripped == rhs_stripped;
219 } 221 }
220 222
221 } // namespace offline_pages 223 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698