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