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" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "chrome/browser/android/browsing_data/url_filter_bridge.h" | 12 #include "chrome/browser/android/browsing_data/url_filter_bridge.h" |
13 #include "chrome/browser/io_thread.h" | 13 #include "chrome/browser/io_thread.h" |
14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
15 #include "jni/WebappRegistry_jni.h" | 15 #include "jni/WebappRegistry_jni.h" |
16 | 16 |
| 17 using base::android::JavaParamRef; |
| 18 |
17 void WebappRegistry::UnregisterWebappsForUrls( | 19 void WebappRegistry::UnregisterWebappsForUrls( |
18 const base::Callback<bool(const GURL&)>& url_filter, | 20 const base::Callback<bool(const GURL&)>& url_filter, |
19 const base::Closure& callback) { | 21 const base::Closure& callback) { |
20 JNIEnv* env = base::android::AttachCurrentThread(); | 22 JNIEnv* env = base::android::AttachCurrentThread(); |
21 // TODO(msramek): Consider implementing a wrapper class that will call and | 23 // TODO(msramek): Consider implementing a wrapper class that will call and |
22 // destroy this closure from Java, eliminating the need for | 24 // destroy this closure from Java, eliminating the need for |
23 // OnWebappsUnregistered() and OnClearedWebappHistory() callbacks. | 25 // OnWebappsUnregistered() and OnClearedWebappHistory() callbacks. |
24 uintptr_t callback_pointer = reinterpret_cast<uintptr_t>( | 26 uintptr_t callback_pointer = reinterpret_cast<uintptr_t>( |
25 new base::Closure(callback)); | 27 new base::Closure(callback)); |
26 | 28 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 jlong jcallback) { | 63 jlong jcallback) { |
62 base::Closure* callback = reinterpret_cast<base::Closure*>(jcallback); | 64 base::Closure* callback = reinterpret_cast<base::Closure*>(jcallback); |
63 callback->Run(); | 65 callback->Run(); |
64 delete callback; | 66 delete callback; |
65 } | 67 } |
66 | 68 |
67 // static | 69 // static |
68 bool WebappRegistry::RegisterWebappRegistry(JNIEnv* env) { | 70 bool WebappRegistry::RegisterWebappRegistry(JNIEnv* env) { |
69 return RegisterNativesImpl(env); | 71 return RegisterNativesImpl(env); |
70 } | 72 } |
OLD | NEW |