| OLD | NEW |
| 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/guid.h" | 10 #include "base/guid.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 141 |
| 142 GURL url = web_contents->GetLastCommittedURL(); | 142 GURL url = web_contents->GetLastCommittedURL(); |
| 143 auto archiver = | 143 auto archiver = |
| 144 base::MakeUnique<offline_pages::OfflinePageMHTMLArchiver>(web_contents); | 144 base::MakeUnique<offline_pages::OfflinePageMHTMLArchiver>(web_contents); |
| 145 | 145 |
| 146 offline_pages::ClientId client_id; | 146 offline_pages::ClientId client_id; |
| 147 client_id.name_space = offline_pages::kDownloadNamespace; | 147 client_id.name_space = offline_pages::kDownloadNamespace; |
| 148 client_id.id = base::GenerateGUID(); | 148 client_id.id = base::GenerateGUID(); |
| 149 | 149 |
| 150 offline_page_model->SavePage( | 150 offline_page_model->SavePage( |
| 151 url, client_id, std::move(archiver), | 151 url, client_id, 0ul, std::move(archiver), |
| 152 base::Bind(&OfflinePageDownloadBridge::SavePageCallback, | 152 base::Bind(&OfflinePageDownloadBridge::SavePageCallback, |
| 153 weak_ptr_factory_.GetWeakPtr())); | 153 weak_ptr_factory_.GetWeakPtr())); |
| 154 } | 154 } |
| 155 | 155 |
| 156 void OfflinePageDownloadBridge::ItemsLoaded() { | 156 void OfflinePageDownloadBridge::ItemsLoaded() { |
| 157 JNIEnv* env = AttachCurrentThread(); | 157 JNIEnv* env = AttachCurrentThread(); |
| 158 ScopedJavaLocalRef<jobject> obj = weak_java_ref_.get(env); | 158 ScopedJavaLocalRef<jobject> obj = weak_java_ref_.get(env); |
| 159 if (obj.is_null()) | 159 if (obj.is_null()) |
| 160 return; | 160 return; |
| 161 Java_OfflinePageDownloadBridge_downloadItemsLoaded(env, obj.obj()); | 161 Java_OfflinePageDownloadBridge_downloadItemsLoaded(env, obj.obj()); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 | 202 |
| 203 DownloadUIAdapter* adapter = | 203 DownloadUIAdapter* adapter = |
| 204 DownloadUIAdapter::FromOfflinePageModel(offline_page_model); | 204 DownloadUIAdapter::FromOfflinePageModel(offline_page_model); |
| 205 | 205 |
| 206 return reinterpret_cast<jlong>( | 206 return reinterpret_cast<jlong>( |
| 207 new OfflinePageDownloadBridge(env, obj, adapter)); | 207 new OfflinePageDownloadBridge(env, obj, adapter)); |
| 208 } | 208 } |
| 209 | 209 |
| 210 } // namespace android | 210 } // namespace android |
| 211 } // namespace offline_pages | 211 } // namespace offline_pages |
| OLD | NEW |