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 #ifndef CHROME_BROWSER_ANDROID_WEBAPPS_WEBAPP_REGISTRY_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_WEBAPPS_WEBAPP_REGISTRY_H_ |
6 #define CHROME_BROWSER_ANDROID_WEBAPPS_WEBAPP_REGISTRY_H_ | 6 #define CHROME_BROWSER_ANDROID_WEBAPPS_WEBAPP_REGISTRY_H_ |
7 | 7 |
8 #include "base/android/jni_android.h" | |
9 #include "base/android/scoped_java_ref.h" | |
10 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
11 #include "base/macros.h" | 9 #include "base/macros.h" |
12 | 10 |
13 class GURL; | 11 class GURL; |
14 | 12 |
15 // WebappRegistry is the C++ counterpart of | 13 // WebappRegistry is the C++ counterpart of |
16 // org.chromium.chrome.browser.webapp's WebappRegistry in Java. | 14 // org.chromium.chrome.browser.webapp's WebappRegistry in Java. |
17 // All methods in this class which make JNI calls should be declared virtual and | 15 // All methods in this class which make JNI calls should be declared virtual and |
18 // mocked out in C++ unit tests. The JNI call cannot be made in this environment | 16 // mocked out in C++ unit tests. The JNI call cannot be made in this environment |
19 // as the Java side will not be initialised. | 17 // as the Java side will not be initialised. |
20 class WebappRegistry { | 18 class WebappRegistry { |
21 public: | 19 public: |
22 WebappRegistry() { } | 20 WebappRegistry() { } |
23 virtual ~WebappRegistry() { } | 21 virtual ~WebappRegistry() { } |
24 | 22 |
25 // Registers JNI hooks. | |
26 static bool RegisterWebappRegistry(JNIEnv* env); | |
27 | |
28 // Cleans up data stored by web apps on URLs matching |url_filter|. | 23 // Cleans up data stored by web apps on URLs matching |url_filter|. |
29 virtual void UnregisterWebappsForUrls( | 24 virtual void UnregisterWebappsForUrls( |
30 const base::Callback<bool(const GURL&)>& url_filter, | 25 const base::Callback<bool(const GURL&)>& url_filter); |
31 const base::Closure& callback); | |
32 | 26 |
33 // Removes history data (last used time and URLs) stored by web apps with | 27 // Removes history data (last used time and URLs) stored by web apps with |
34 // URLs matching |url_filter|, whilst leaving other data intact. | 28 // URLs matching |url_filter|, whilst leaving other data intact. |
35 virtual void ClearWebappHistoryForUrls( | 29 virtual void ClearWebappHistoryForUrls( |
36 const base::Callback<bool(const GURL&)>& url_filter, | 30 const base::Callback<bool(const GURL&)>& url_filter); |
37 const base::Closure& callback); | |
38 | 31 |
39 private: | 32 private: |
40 DISALLOW_COPY_AND_ASSIGN(WebappRegistry); | 33 DISALLOW_COPY_AND_ASSIGN(WebappRegistry); |
41 }; | 34 }; |
42 | 35 |
43 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_WEBAPP_REGISTRY_H_ | 36 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_WEBAPP_REGISTRY_H_ |
OLD | NEW |