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 <utility> |
| 8 |
7 #include "base/android/jni_array.h" | 9 #include "base/android/jni_array.h" |
8 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
9 #include "chrome/browser/android/offline_pages/offline_page_mhtml_archiver.h" | 11 #include "chrome/browser/android/offline_pages/offline_page_mhtml_archiver.h" |
10 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" | 12 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" |
11 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/profiles/profile_android.h" | 14 #include "chrome/browser/profiles/profile_android.h" |
13 #include "components/offline_pages/offline_page_feature.h" | 15 #include "components/offline_pages/offline_page_feature.h" |
14 #include "components/offline_pages/offline_page_item.h" | 16 #include "components/offline_pages/offline_page_item.h" |
15 #include "components/offline_pages/offline_page_model.h" | 17 #include "components/offline_pages/offline_page_model.h" |
16 #include "content/public/browser/browser_context.h" | 18 #include "content/public/browser/browser_context.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 j_callback_ref.Reset(env, j_callback_obj); | 170 j_callback_ref.Reset(env, j_callback_obj); |
169 | 171 |
170 content::WebContents* web_contents = | 172 content::WebContents* web_contents = |
171 content::WebContents::FromJavaWebContents(j_web_contents); | 173 content::WebContents::FromJavaWebContents(j_web_contents); |
172 GURL url(web_contents->GetLastCommittedURL()); | 174 GURL url(web_contents->GetLastCommittedURL()); |
173 | 175 |
174 scoped_ptr<OfflinePageArchiver> archiver( | 176 scoped_ptr<OfflinePageArchiver> archiver( |
175 new OfflinePageMHTMLArchiver(web_contents)); | 177 new OfflinePageMHTMLArchiver(web_contents)); |
176 | 178 |
177 offline_page_model_->SavePage( | 179 offline_page_model_->SavePage( |
178 url, bookmark_id, archiver.Pass(), | 180 url, bookmark_id, std::move(archiver), |
179 base::Bind(&SavePageCallback, j_callback_ref, url)); | 181 base::Bind(&SavePageCallback, j_callback_ref, url)); |
180 } | 182 } |
181 | 183 |
182 void OfflinePageBridge::MarkPageAccessed(JNIEnv* env, | 184 void OfflinePageBridge::MarkPageAccessed(JNIEnv* env, |
183 const JavaParamRef<jobject>& obj, | 185 const JavaParamRef<jobject>& obj, |
184 jlong bookmark_id) { | 186 jlong bookmark_id) { |
185 offline_page_model_->MarkPageAccessed(bookmark_id); | 187 offline_page_model_->MarkPageAccessed(bookmark_id); |
186 } | 188 } |
187 | 189 |
188 void OfflinePageBridge::DeletePage(JNIEnv* env, | 190 void OfflinePageBridge::DeletePage(JNIEnv* env, |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 return reinterpret_cast<jlong>(new OfflinePageBridge( | 254 return reinterpret_cast<jlong>(new OfflinePageBridge( |
253 env, obj, ProfileAndroid::FromProfileAndroid(j_profile))); | 255 env, obj, ProfileAndroid::FromProfileAndroid(j_profile))); |
254 } | 256 } |
255 | 257 |
256 bool RegisterOfflinePageBridge(JNIEnv* env) { | 258 bool RegisterOfflinePageBridge(JNIEnv* env) { |
257 return RegisterNativesImpl(env); | 259 return RegisterNativesImpl(env); |
258 } | 260 } |
259 | 261 |
260 } // namespace android | 262 } // namespace android |
261 } // namespace offline_pages | 263 } // namespace offline_pages |
OLD | NEW |