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

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

Issue 1312153003: jni_generator: Pass object parameters as JavaParamRef. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 3 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
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 "base/android/jni_array.h" 7 #include "base/android/jni_array.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 env, j_result_obj, 60 env, j_result_obj,
61 ConvertUTF8ToJavaString(env, offline_page.url.spec()).obj(), 61 ConvertUTF8ToJavaString(env, offline_page.url.spec()).obj(),
62 offline_page.bookmark_id, 62 offline_page.bookmark_id,
63 ConvertUTF8ToJavaString(env, offline_page.GetOfflineURL().spec()).obj(), 63 ConvertUTF8ToJavaString(env, offline_page.GetOfflineURL().spec()).obj(),
64 offline_page.file_size); 64 offline_page.file_size);
65 } 65 }
66 } 66 }
67 67
68 } // namespace 68 } // namespace
69 69
70 static jboolean IsOfflinePagesEnabled(JNIEnv* env, jclass clazz) { 70 static jboolean IsOfflinePagesEnabled(JNIEnv* env,
71 const JavaParamRef<jclass>& clazz) {
71 return offline_pages::IsOfflinePagesEnabled(); 72 return offline_pages::IsOfflinePagesEnabled();
72 } 73 }
73 74
74 OfflinePageBridge::OfflinePageBridge(JNIEnv* env, 75 OfflinePageBridge::OfflinePageBridge(JNIEnv* env,
75 jobject obj, 76 jobject obj,
76 content::BrowserContext* browser_context) 77 content::BrowserContext* browser_context)
77 : weak_java_ref_(env, obj), 78 : weak_java_ref_(env, obj),
78 offline_page_model_(OfflinePageModelFactory::GetForBrowserContext( 79 offline_page_model_(OfflinePageModelFactory::GetForBrowserContext(
79 browser_context)), 80 browser_context)),
80 browser_context_(browser_context) { 81 browser_context_(browser_context) {
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 content::DownloadManager* manager = 209 content::DownloadManager* manager =
209 content::BrowserContext::GetDownloadManager(browser_context); 210 content::BrowserContext::GetDownloadManager(browser_context);
210 if (!manager) { 211 if (!manager) {
211 DVLOG(1) << "No download manager available in offline page bridge"; 212 DVLOG(1) << "No download manager available in offline page bridge";
212 return base::FilePath(); 213 return base::FilePath();
213 } 214 }
214 215
215 return DownloadPrefs::FromDownloadManager(manager)->DownloadPath(); 216 return DownloadPrefs::FromDownloadManager(manager)->DownloadPath();
216 } 217 }
217 218
218 static jlong Init(JNIEnv* env, jobject obj, jobject j_profile) { 219 static jlong Init(JNIEnv* env,
220 const JavaParamRef<jobject>& obj,
221 const JavaParamRef<jobject>& j_profile) {
219 return reinterpret_cast<jlong>(new OfflinePageBridge( 222 return reinterpret_cast<jlong>(new OfflinePageBridge(
220 env, obj, ProfileAndroid::FromProfileAndroid(j_profile))); 223 env, obj, ProfileAndroid::FromProfileAndroid(j_profile)));
221 } 224 }
222 225
223 bool RegisterOfflinePageBridge(JNIEnv* env) { 226 bool RegisterOfflinePageBridge(JNIEnv* env) {
224 return RegisterNativesImpl(env); 227 return RegisterNativesImpl(env);
225 } 228 }
226 229
227 } // namespace android 230 } // namespace android
228 } // namespace offline_pages 231 } // namespace offline_pages
OLDNEW
« no previous file with comments | « chrome/browser/android/new_tab_page_prefs.cc ('k') | chrome/browser/android/omnibox/answers_image_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698