| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef ANDROID_WEBVIEW_NATIVE_PERMISSION_AW_PERMISSION_REQUEST_H | 5 #ifndef ANDROID_WEBVIEW_NATIVE_PERMISSION_AW_PERMISSION_REQUEST_H |
| 6 #define ANDROID_WEBVIEW_NATIVE_PERMISSION_AW_PERMISSION_REQUEST_H | 6 #define ANDROID_WEBVIEW_NATIVE_PERMISSION_AW_PERMISSION_REQUEST_H |
| 7 | 7 |
| 8 #include "base/android/jni_weak_ref.h" | 8 #include "base/android/jni_weak_ref.h" |
| 9 #include "base/android/scoped_java_ref.h" | 9 #include "base/android/scoped_java_ref.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // |weak_ptr|, which is owned by the returned java peer. | 34 // |weak_ptr|, which is owned by the returned java peer. |
| 35 static base::android::ScopedJavaLocalRef<jobject> Create( | 35 static base::android::ScopedJavaLocalRef<jobject> Create( |
| 36 scoped_ptr<AwPermissionRequestDelegate> delegate, | 36 scoped_ptr<AwPermissionRequestDelegate> delegate, |
| 37 base::WeakPtr<AwPermissionRequest>* weak_ptr); | 37 base::WeakPtr<AwPermissionRequest>* weak_ptr); |
| 38 | 38 |
| 39 // Return the Java peer. Must be null-checked. | 39 // Return the Java peer. Must be null-checked. |
| 40 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); | 40 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); |
| 41 | 41 |
| 42 // Invoked by Java peer when request is processed, |granted| indicates the | 42 // Invoked by Java peer when request is processed, |granted| indicates the |
| 43 // request was granted or not. | 43 // request was granted or not. |
| 44 void OnAccept(JNIEnv* env, jobject jcaller, jboolean granted); | 44 void OnAccept(JNIEnv* env, |
| 45 void Destroy(JNIEnv* env, jobject obj); | 45 const base::android::JavaParamRef<jobject>& jcaller, |
| 46 jboolean granted); |
| 47 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); |
| 46 | 48 |
| 47 // Return the origin which initiated the request. | 49 // Return the origin which initiated the request. |
| 48 const GURL& GetOrigin(); | 50 const GURL& GetOrigin(); |
| 49 | 51 |
| 50 // Return the resources origin requested. | 52 // Return the resources origin requested. |
| 51 int64 GetResources(); | 53 int64 GetResources(); |
| 52 | 54 |
| 53 // Cancel this request. Guarantee that | 55 // Cancel this request. Guarantee that |
| 54 // AwPermissionRequestDelegate::NotifyRequestResult will not be called after | 56 // AwPermissionRequestDelegate::NotifyRequestResult will not be called after |
| 55 // this call. This also deletes this object, so weak pointers are invalidated | 57 // this call. This also deletes this object, so weak pointers are invalidated |
| (...skipping 17 matching lines...) Expand all Loading... |
| 73 base::WeakPtrFactory<AwPermissionRequest> weak_factory_; | 75 base::WeakPtrFactory<AwPermissionRequest> weak_factory_; |
| 74 | 76 |
| 75 DISALLOW_COPY_AND_ASSIGN(AwPermissionRequest); | 77 DISALLOW_COPY_AND_ASSIGN(AwPermissionRequest); |
| 76 }; | 78 }; |
| 77 | 79 |
| 78 bool RegisterAwPermissionRequest(JNIEnv* env); | 80 bool RegisterAwPermissionRequest(JNIEnv* env); |
| 79 | 81 |
| 80 } // namespace android_webivew | 82 } // namespace android_webivew |
| 81 | 83 |
| 82 #endif // ANDROID_WEBVIEW_NATIVE_PERMISSION_AW_PERMISSION_REQUEST_H | 84 #endif // ANDROID_WEBVIEW_NATIVE_PERMISSION_AW_PERMISSION_REQUEST_H |
| OLD | NEW |