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

Side by Side Diff: chrome/browser/android/offline_pages/downloads/offline_page_download_bridge.cc

Issue 2395903002: API changes to support suspending requests (Closed)
Patch Set: Keep the JS with a boolean instead of forcing a double. Created 4 years, 2 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_bridge.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/downloads/offline_page_download_b ridge.h" 5 #include "chrome/browser/android/offline_pages/downloads/offline_page_download_b ridge.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 RecentTabHelper::FromWebContents(web_contents); 227 RecentTabHelper::FromWebContents(web_contents);
228 if (tab_helper && 228 if (tab_helper &&
229 !tab_helper->is_page_ready_for_snapshot() && 229 !tab_helper->is_page_ready_for_snapshot() &&
230 offline_pages::IsBackgroundLoaderForDownloadsEnabled()) { 230 offline_pages::IsBackgroundLoaderForDownloadsEnabled()) {
231 // TODO(dimich): Improve this to wait for the page load if it is still going 231 // TODO(dimich): Improve this to wait for the page load if it is still going
232 // on. Pre-submit the request and if the load finishes and capture happens, 232 // on. Pre-submit the request and if the load finishes and capture happens,
233 // remove request. 233 // remove request.
234 offline_pages::RequestCoordinator* request_coordinator = 234 offline_pages::RequestCoordinator* request_coordinator =
235 offline_pages::RequestCoordinatorFactory::GetForBrowserContext( 235 offline_pages::RequestCoordinatorFactory::GetForBrowserContext(
236 tab->GetProfile()->GetOriginalProfile()); 236 tab->GetProfile()->GetOriginalProfile());
237 request_coordinator->SavePageLater(url, client_id, true); 237 request_coordinator->SavePageLater(
238 url, client_id, true,
239 RequestCoordinator::RequestAvailability::ENABLED_FOR_OFFLINER);
238 return; 240 return;
239 } 241 }
240 242
241 // Page is ready, capture it right from the tab. 243 // Page is ready, capture it right from the tab.
242 offline_pages::OfflinePageModel* offline_page_model = 244 offline_pages::OfflinePageModel* offline_page_model =
243 OfflinePageModelFactory::GetForBrowserContext( 245 OfflinePageModelFactory::GetForBrowserContext(
244 tab->GetProfile()->GetOriginalProfile()); 246 tab->GetProfile()->GetOriginalProfile());
245 if (!offline_page_model) 247 if (!offline_page_model)
246 return; 248 return;
247 249
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 356
355 DownloadUIAdapter* adapter = 357 DownloadUIAdapter* adapter =
356 DownloadUIAdapter::FromOfflinePageModel(offline_page_model); 358 DownloadUIAdapter::FromOfflinePageModel(offline_page_model);
357 359
358 return reinterpret_cast<jlong>( 360 return reinterpret_cast<jlong>(
359 new OfflinePageDownloadBridge(env, obj, adapter, browser_context)); 361 new OfflinePageDownloadBridge(env, obj, adapter, browser_context));
360 } 362 }
361 363
362 } // namespace android 364 } // namespace android
363 } // namespace offline_pages 365 } // namespace offline_pages
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/offline_page_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698