OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/android/download_controller_android_impl.h" | 5 #include "content/browser/android/download_controller_android_impl.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 dl_params->set_prefer_cache(true); | 92 dl_params->set_prefer_cache(true); |
93 dl_params->set_prompt(false); | 93 dl_params->set_prompt(false); |
94 dlm->DownloadUrl(dl_params.Pass()); | 94 dlm->DownloadUrl(dl_params.Pass()); |
95 } | 95 } |
96 | 96 |
97 } // namespace | 97 } // namespace |
98 | 98 |
99 namespace content { | 99 namespace content { |
100 | 100 |
101 // JNI methods | 101 // JNI methods |
102 static void Init(JNIEnv* env, jobject obj) { | 102 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
103 DownloadControllerAndroidImpl::GetInstance()->Init(env, obj); | 103 DownloadControllerAndroidImpl::GetInstance()->Init(env, obj); |
104 } | 104 } |
105 | 105 |
106 static void OnRequestFileAccessResult( | 106 static void OnRequestFileAccessResult(JNIEnv* env, |
107 JNIEnv* env, jobject obj, jlong callback_id, jboolean granted) { | 107 const JavaParamRef<jobject>& obj, |
| 108 jlong callback_id, |
| 109 jboolean granted) { |
108 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 110 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
109 DCHECK(callback_id); | 111 DCHECK(callback_id); |
110 | 112 |
111 // Convert java long long int to c++ pointer, take ownership. | 113 // Convert java long long int to c++ pointer, take ownership. |
112 scoped_ptr<DownloadControllerAndroid::AcquireFileAccessPermissionCallback> cb( | 114 scoped_ptr<DownloadControllerAndroid::AcquireFileAccessPermissionCallback> cb( |
113 reinterpret_cast< | 115 reinterpret_cast< |
114 DownloadControllerAndroid::AcquireFileAccessPermissionCallback*>( | 116 DownloadControllerAndroid::AcquireFileAccessPermissionCallback*>( |
115 callback_id)); | 117 callback_id)); |
116 cb->Run(granted); | 118 cb->Run(granted); |
117 } | 119 } |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 } | 577 } |
576 | 578 |
577 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); | 579 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); |
578 if (info) | 580 if (info) |
579 has_user_gesture = info->HasUserGesture(); | 581 has_user_gesture = info->HasUserGesture(); |
580 } | 582 } |
581 | 583 |
582 DownloadControllerAndroidImpl::DownloadInfoAndroid::~DownloadInfoAndroid() {} | 584 DownloadControllerAndroidImpl::DownloadInfoAndroid::~DownloadInfoAndroid() {} |
583 | 585 |
584 } // namespace content | 586 } // namespace content |
OLD | NEW |