Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Side by Side Diff: chrome/browser/android/webapps/webapp_registry.cc

Issue 2206953002: Use mojo for WebappRegistry. Base URL: https://chromium.googlesource.com/chromium/src.git@java-interface-registry
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/android/webapps/webapp_registry.h"
6
7 #include <jni.h>
8
9 #include "base/android/context_utils.h"
10 #include "base/android/jni_android.h"
11 #include "base/callback.h"
12 #include "chrome/browser/io_thread.h"
13 #include "content/public/browser/browser_thread.h"
14 #include "jni/WebappRegistry_jni.h"
15
16 void WebappRegistry::UnregisterWebapps(const base::Closure& callback) {
17 JNIEnv* env = base::android::AttachCurrentThread();
18 uintptr_t callback_pointer = reinterpret_cast<uintptr_t>(
19 new base::Closure(callback));
20
21 Java_WebappRegistry_unregisterAllWebapps(
22 env,
23 base::android::GetApplicationContext(),
24 callback_pointer);
25 }
26
27 void WebappRegistry::ClearWebappHistory(const base::Closure& callback) {
28 JNIEnv* env = base::android::AttachCurrentThread();
29 uintptr_t callback_pointer = reinterpret_cast<uintptr_t>(
30 new base::Closure(callback));
31
32 Java_WebappRegistry_clearWebappHistory(
33 env,
34 base::android::GetApplicationContext(),
35 callback_pointer);
36 }
37
38 // Callback used by Java when all web apps have been unregistered.
39 void OnWebappsUnregistered(JNIEnv* env,
40 const JavaParamRef<jclass>& clazz,
41 jlong jcallback) {
42 base::Closure* callback = reinterpret_cast<base::Closure*>(jcallback);
43 callback->Run();
44 delete callback;
45 }
46
47 // Callback used by Java when all web app last used times have been cleared.
48 void OnClearedWebappHistory(JNIEnv* env,
49 const JavaParamRef<jclass>& clazz,
50 jlong jcallback) {
51 base::Closure* callback = reinterpret_cast<base::Closure*>(jcallback);
52 callback->Run();
53 delete callback;
54 }
55
56 // static
57 bool WebappRegistry::RegisterWebappRegistry(JNIEnv* env) {
58 return RegisterNativesImpl(env);
59 }
OLDNEW
« no previous file with comments | « chrome/browser/android/webapps/webapp_registry.h ('k') | chrome/browser/android/webapps/webapp_registry.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698