OLD | NEW |
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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 const JavaParamRef<jstring>& j_client_id, | 459 const JavaParamRef<jstring>& j_client_id, |
460 jboolean user_requested) { | 460 jboolean user_requested) { |
461 offline_pages::ClientId client_id; | 461 offline_pages::ClientId client_id; |
462 client_id.name_space = ConvertJavaStringToUTF8(env, j_namespace); | 462 client_id.name_space = ConvertJavaStringToUTF8(env, j_namespace); |
463 client_id.id = ConvertJavaStringToUTF8(env, j_client_id); | 463 client_id.id = ConvertJavaStringToUTF8(env, j_client_id); |
464 | 464 |
465 RequestCoordinator* coordinator = | 465 RequestCoordinator* coordinator = |
466 offline_pages::RequestCoordinatorFactory::GetInstance()-> | 466 offline_pages::RequestCoordinatorFactory::GetInstance()-> |
467 GetForBrowserContext(browser_context_); | 467 GetForBrowserContext(browser_context_); |
468 | 468 |
469 coordinator->SavePageLater( | 469 RequestCoordinator::SavePageLaterParams params; |
470 GURL(ConvertJavaStringToUTF8(env, j_url)), client_id, | 470 params.url = GURL(ConvertJavaStringToUTF8(env, j_url)); |
471 static_cast<bool>(user_requested), | 471 params.client_id = client_id; |
472 RequestCoordinator::RequestAvailability::ENABLED_FOR_OFFLINER); | 472 params.user_requested = static_cast<bool>(user_requested); |
| 473 params.availability = |
| 474 RequestCoordinator::RequestAvailability::ENABLED_FOR_OFFLINER; |
| 475 coordinator->SavePageLater(params); |
473 } | 476 } |
474 | 477 |
475 ScopedJavaLocalRef<jstring> OfflinePageBridge::GetOfflinePageHeaderForReload( | 478 ScopedJavaLocalRef<jstring> OfflinePageBridge::GetOfflinePageHeaderForReload( |
476 JNIEnv* env, | 479 JNIEnv* env, |
477 const base::android::JavaParamRef<jobject>& obj, | 480 const base::android::JavaParamRef<jobject>& obj, |
478 const JavaParamRef<jobject>& j_web_contents) { | 481 const JavaParamRef<jobject>& j_web_contents) { |
479 content::WebContents* web_contents = | 482 content::WebContents* web_contents = |
480 content::WebContents::FromJavaWebContents(j_web_contents); | 483 content::WebContents::FromJavaWebContents(j_web_contents); |
481 if (!web_contents) | 484 if (!web_contents) |
482 return ScopedJavaLocalRef<jstring>(); | 485 return ScopedJavaLocalRef<jstring>(); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 env, ConvertUTF8ToJavaString(env, client_id.name_space), | 587 env, ConvertUTF8ToJavaString(env, client_id.name_space), |
585 ConvertUTF8ToJavaString(env, client_id.id)); | 588 ConvertUTF8ToJavaString(env, client_id.id)); |
586 } | 589 } |
587 | 590 |
588 bool RegisterOfflinePageBridge(JNIEnv* env) { | 591 bool RegisterOfflinePageBridge(JNIEnv* env) { |
589 return RegisterNativesImpl(env); | 592 return RegisterNativesImpl(env); |
590 } | 593 } |
591 | 594 |
592 } // namespace android | 595 } // namespace android |
593 } // namespace offline_pages | 596 } // namespace offline_pages |
OLD | NEW |