| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 140 |
| 141 //static | 141 //static |
| 142 void DownloadControllerAndroid::SetDownloadControllerAndroid( | 142 void DownloadControllerAndroid::SetDownloadControllerAndroid( |
| 143 DownloadControllerAndroid* download_controller) { | 143 DownloadControllerAndroid* download_controller) { |
| 144 base::AutoLock lock(g_download_controller_lock_.Get()); | 144 base::AutoLock lock(g_download_controller_lock_.Get()); |
| 145 DownloadControllerAndroid::download_controller_ = download_controller; | 145 DownloadControllerAndroid::download_controller_ = download_controller; |
| 146 } | 146 } |
| 147 | 147 |
| 148 // static | 148 // static |
| 149 DownloadControllerAndroidImpl* DownloadControllerAndroidImpl::GetInstance() { | 149 DownloadControllerAndroidImpl* DownloadControllerAndroidImpl::GetInstance() { |
| 150 return Singleton<DownloadControllerAndroidImpl>::get(); | 150 return base::Singleton<DownloadControllerAndroidImpl>::get(); |
| 151 } | 151 } |
| 152 | 152 |
| 153 DownloadControllerAndroidImpl::DownloadControllerAndroidImpl() | 153 DownloadControllerAndroidImpl::DownloadControllerAndroidImpl() |
| 154 : java_object_(NULL) { | 154 : java_object_(NULL) { |
| 155 } | 155 } |
| 156 | 156 |
| 157 DownloadControllerAndroidImpl::~DownloadControllerAndroidImpl() { | 157 DownloadControllerAndroidImpl::~DownloadControllerAndroidImpl() { |
| 158 if (java_object_) { | 158 if (java_object_) { |
| 159 JNIEnv* env = base::android::AttachCurrentThread(); | 159 JNIEnv* env = base::android::AttachCurrentThread(); |
| 160 env->DeleteWeakGlobalRef(java_object_->obj); | 160 env->DeleteWeakGlobalRef(java_object_->obj); |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 } | 577 } |
| 578 | 578 |
| 579 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); | 579 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); |
| 580 if (info) | 580 if (info) |
| 581 has_user_gesture = info->HasUserGesture(); | 581 has_user_gesture = info->HasUserGesture(); |
| 582 } | 582 } |
| 583 | 583 |
| 584 DownloadControllerAndroidImpl::DownloadInfoAndroid::~DownloadInfoAndroid() {} | 584 DownloadControllerAndroidImpl::DownloadInfoAndroid::~DownloadInfoAndroid() {} |
| 585 | 585 |
| 586 } // namespace content | 586 } // namespace content |
| OLD | NEW |