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

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

Issue 2484223005: Store original request URL in offline page metadata table (Closed)
Patch Set: Address feedback 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/android/offline_pages/offline_page_request_job_unittest.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 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_bridge.h" 5 #include "chrome/browser/android/offline_pages/offline_page_bridge.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 const JavaParamRef<jobject>& j_callback_obj, 422 const JavaParamRef<jobject>& j_callback_obj,
423 const JavaParamRef<jobject>& j_web_contents, 423 const JavaParamRef<jobject>& j_web_contents,
424 const JavaParamRef<jstring>& j_namespace, 424 const JavaParamRef<jstring>& j_namespace,
425 const JavaParamRef<jstring>& j_client_id) { 425 const JavaParamRef<jstring>& j_client_id) {
426 DCHECK(j_callback_obj); 426 DCHECK(j_callback_obj);
427 DCHECK(j_web_contents); 427 DCHECK(j_web_contents);
428 428
429 ScopedJavaGlobalRef<jobject> j_callback_ref; 429 ScopedJavaGlobalRef<jobject> j_callback_ref;
430 j_callback_ref.Reset(env, j_callback_obj); 430 j_callback_ref.Reset(env, j_callback_obj);
431 431
432 GURL url; 432 OfflinePageModel::SavePageParams save_page_params;
433 std::unique_ptr<OfflinePageArchiver> archiver; 433 std::unique_ptr<OfflinePageArchiver> archiver;
434 434
435 content::WebContents* web_contents = 435 content::WebContents* web_contents =
436 content::WebContents::FromJavaWebContents(j_web_contents); 436 content::WebContents::FromJavaWebContents(j_web_contents);
437 if (web_contents) { 437 if (web_contents) {
438 url = web_contents->GetLastCommittedURL(); 438 save_page_params.url = web_contents->GetLastCommittedURL();
439 archiver.reset(new OfflinePageMHTMLArchiver(web_contents)); 439 archiver.reset(new OfflinePageMHTMLArchiver(web_contents));
440 } 440 }
441 441
442 offline_pages::ClientId client_id; 442 save_page_params.client_id.name_space =
443 client_id.name_space = ConvertJavaStringToUTF8(env, j_namespace); 443 ConvertJavaStringToUTF8(env, j_namespace);
444 client_id.id = ConvertJavaStringToUTF8(env, j_client_id); 444 save_page_params.client_id.id = ConvertJavaStringToUTF8(env, j_client_id);
445 445
446 offline_page_model_->SavePage( 446 offline_page_model_->SavePage(
447 url, client_id, 0l, std::move(archiver), 447 save_page_params, std::move(archiver),
448 base::Bind(&SavePageCallback, j_callback_ref, url)); 448 base::Bind(&SavePageCallback, j_callback_ref, save_page_params.url));
449 } 449 }
450 450
451 void OfflinePageBridge::SavePageLater(JNIEnv* env, 451 void OfflinePageBridge::SavePageLater(JNIEnv* env,
452 const JavaParamRef<jobject>& obj, 452 const JavaParamRef<jobject>& obj,
453 const JavaParamRef<jstring>& j_url, 453 const JavaParamRef<jstring>& j_url,
454 const JavaParamRef<jstring>& j_namespace, 454 const JavaParamRef<jstring>& j_namespace,
455 const JavaParamRef<jstring>& j_client_id, 455 const JavaParamRef<jstring>& j_client_id,
456 jboolean user_requested) { 456 jboolean user_requested) {
457 offline_pages::ClientId client_id; 457 offline_pages::ClientId client_id;
458 client_id.name_space = ConvertJavaStringToUTF8(env, j_namespace); 458 client_id.name_space = ConvertJavaStringToUTF8(env, j_namespace);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 env, ConvertUTF8ToJavaString(env, client_id.name_space), 568 env, ConvertUTF8ToJavaString(env, client_id.name_space),
569 ConvertUTF8ToJavaString(env, client_id.id)); 569 ConvertUTF8ToJavaString(env, client_id.id));
570 } 570 }
571 571
572 bool RegisterOfflinePageBridge(JNIEnv* env) { 572 bool RegisterOfflinePageBridge(JNIEnv* env) {
573 return RegisterNativesImpl(env); 573 return RegisterNativesImpl(env);
574 } 574 }
575 575
576 } // namespace android 576 } // namespace android
577 } // namespace offline_pages 577 } // namespace offline_pages
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/offline_page_request_job_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698