| OLD | NEW |
| 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/webapps/webapp_registry.h" | 5 #include "chrome/browser/android/webapps/webapp_registry.h" |
| 6 | 6 |
| 7 #include <jni.h> | 7 #include <jni.h> |
| 8 | 8 |
| 9 #include "base/android/context_utils.h" | 9 #include "base/android/context_utils.h" |
| 10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // destroy this closure from Java, eliminating the need for | 24 // destroy this closure from Java, eliminating the need for |
| 25 // OnWebappsUnregistered() and OnClearedWebappHistory() callbacks. | 25 // OnWebappsUnregistered() and OnClearedWebappHistory() callbacks. |
| 26 uintptr_t callback_pointer = reinterpret_cast<uintptr_t>( | 26 uintptr_t callback_pointer = reinterpret_cast<uintptr_t>( |
| 27 new base::Closure(callback)); | 27 new base::Closure(callback)); |
| 28 | 28 |
| 29 // We will destroy |filter_bridge| from its Java counterpart before calling | 29 // We will destroy |filter_bridge| from its Java counterpart before calling |
| 30 // back OnWebappsUnregistered(). | 30 // back OnWebappsUnregistered(). |
| 31 UrlFilterBridge* filter_bridge = new UrlFilterBridge(url_filter); | 31 UrlFilterBridge* filter_bridge = new UrlFilterBridge(url_filter); |
| 32 | 32 |
| 33 Java_WebappRegistry_unregisterWebappsForUrls( | 33 Java_WebappRegistry_unregisterWebappsForUrls( |
| 34 env, | 34 env, base::android::GetApplicationContext(), filter_bridge->j_bridge(), |
| 35 base::android::GetApplicationContext(), | |
| 36 filter_bridge->j_bridge().obj(), | |
| 37 callback_pointer); | 35 callback_pointer); |
| 38 } | 36 } |
| 39 | 37 |
| 40 void WebappRegistry::ClearWebappHistory(const base::Closure& callback) { | 38 void WebappRegistry::ClearWebappHistory(const base::Closure& callback) { |
| 41 JNIEnv* env = base::android::AttachCurrentThread(); | 39 JNIEnv* env = base::android::AttachCurrentThread(); |
| 42 uintptr_t callback_pointer = reinterpret_cast<uintptr_t>( | 40 uintptr_t callback_pointer = reinterpret_cast<uintptr_t>( |
| 43 new base::Closure(callback)); | 41 new base::Closure(callback)); |
| 44 | 42 |
| 45 Java_WebappRegistry_clearWebappHistory( | 43 Java_WebappRegistry_clearWebappHistory( |
| 46 env, | 44 env, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 63 jlong jcallback) { | 61 jlong jcallback) { |
| 64 base::Closure* callback = reinterpret_cast<base::Closure*>(jcallback); | 62 base::Closure* callback = reinterpret_cast<base::Closure*>(jcallback); |
| 65 callback->Run(); | 63 callback->Run(); |
| 66 delete callback; | 64 delete callback; |
| 67 } | 65 } |
| 68 | 66 |
| 69 // static | 67 // static |
| 70 bool WebappRegistry::RegisterWebappRegistry(JNIEnv* env) { | 68 bool WebappRegistry::RegisterWebappRegistry(JNIEnv* env) { |
| 71 return RegisterNativesImpl(env); | 69 return RegisterNativesImpl(env); |
| 72 } | 70 } |
| OLD | NEW |