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 "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "chrome/browser/android/browsing_data/url_filter_bridge.h" | 8 #include "chrome/browser/android/browsing_data/url_filter_bridge.h" |
9 #include "chrome/browser/ui/webui/webapk_info_callback.h" | |
9 #include "jni/WebappRegistry_jni.h" | 10 #include "jni/WebappRegistry_jni.h" |
10 | 11 |
11 using base::android::JavaParamRef; | 12 using base::android::JavaParamRef; |
12 | 13 |
13 void WebappRegistry::UnregisterWebappsForUrls( | 14 void WebappRegistry::UnregisterWebappsForUrls( |
14 const base::Callback<bool(const GURL&)>& url_filter) { | 15 const base::Callback<bool(const GURL&)>& url_filter) { |
15 // |filter_bridge| is destroyed from its Java counterpart. | 16 // |filter_bridge| is destroyed from its Java counterpart. |
16 UrlFilterBridge* filter_bridge = new UrlFilterBridge(url_filter); | 17 UrlFilterBridge* filter_bridge = new UrlFilterBridge(url_filter); |
17 | 18 |
18 Java_WebappRegistry_unregisterWebappsForUrls( | 19 Java_WebappRegistry_unregisterWebappsForUrls( |
19 base::android::AttachCurrentThread(), filter_bridge->j_bridge()); | 20 base::android::AttachCurrentThread(), filter_bridge->j_bridge()); |
20 } | 21 } |
21 | 22 |
22 void WebappRegistry::ClearWebappHistoryForUrls( | 23 void WebappRegistry::ClearWebappHistoryForUrls( |
23 const base::Callback<bool(const GURL&)>& url_filter) { | 24 const base::Callback<bool(const GURL&)>& url_filter) { |
24 // |filter_bridge| is destroyed from its Java counterpart. | 25 // |filter_bridge| is destroyed from its Java counterpart. |
25 UrlFilterBridge* filter_bridge = new UrlFilterBridge(url_filter); | 26 UrlFilterBridge* filter_bridge = new UrlFilterBridge(url_filter); |
26 | 27 |
27 Java_WebappRegistry_clearWebappHistoryForUrls( | 28 Java_WebappRegistry_clearWebappHistoryForUrls( |
28 base::android::AttachCurrentThread(), filter_bridge->j_bridge()); | 29 base::android::AttachCurrentThread(), filter_bridge->j_bridge()); |
29 } | 30 } |
31 | |
32 void WebappRegistry::ListWebAPKs( | |
33 const base::RepeatingCallback<void(std::string, std::string, int, int)>& | |
34 callback) { | |
pkotwicz
2017/01/13 17:00:58
I think that it would be clearer if this function
gonzalon
2017/01/13 20:24:39
Returning an array was my first approach too, it w
pkotwicz
2017/01/17 03:20:16
I recommend doing this by making WebappRegistry::L
gonzalon
2017/01/17 16:45:17
I did something very similar to what you recommend
| |
35 WebapkInfoCallback* webapk_info_callback = new WebapkInfoCallback(callback); | |
Xi Han
2017/01/13 15:50:15
Please add a comment that the WebApkInfoCallback w
gonzalon
2017/01/13 20:24:39
Good to know! Thanks for explaining.
| |
36 | |
37 Java_WebappRegistry_listWebAPKs( | |
38 base::android::AttachCurrentThread(), | |
39 webapk_info_callback->j_webapk_info_callback()); | |
Xi Han
2017/01/13 15:50:15
It is better to move this JNI call into WebApkInfo
| |
40 } | |
OLD | NEW |