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

Unified Diff: chrome/browser/android/webapps/webapp_registry.cc

Issue 1329083002: Clear webapp storage when site data is cleared (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rework to use AsyncTask rather than IO thread Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/webapps/webapp_registry.cc
diff --git a/chrome/browser/android/webapps/webapp_registry.cc b/chrome/browser/android/webapps/webapp_registry.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ffa9404389915819102e2ded3a1173ef01280cf4
--- /dev/null
+++ b/chrome/browser/android/webapps/webapp_registry.cc
@@ -0,0 +1,41 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/android/webapps/webapp_registry.h"
+
+#include <jni.h>
+
+#include "base/android/jni_android.h"
+#include "base/callback.h"
+#include "chrome/browser/io_thread.h"
+#include "content/public/browser/browser_thread.h"
+#include "jni/WebappRegistry_jni.h"
+
+// static
+void WebappRegistry::UnregisterWebapps(
+ const base::Closure& callback) {
+ JNIEnv* env = base::android::AttachCurrentThread();
+ uintptr_t callback_pointer = reinterpret_cast<uintptr_t>(
+ new base::Closure(callback));
+
+ Java_WebappRegistry_unregisterAllWebapps(
+ env,
+ base::android::GetApplicationContext(),
+ callback_pointer);
+}
+
+// Callback used by Java when all webapps have been unregistered.
+// Declared in JNI header file.
gone 2015/09/09 23:30:40 nit: remove unhelpful "Declared in JNI header" com
Lalit Maganti 2015/09/10 09:41:58 Done.
+void OnWebappsUnregistered(JNIEnv* env,
+ const JavaParamRef<jclass>& klass,
+ jlong jcallback) {
+ base::Closure* callback = reinterpret_cast<base::Closure*>(jcallback);
gone 2015/09/09 23:30:40 again, my familiarity with native code is lacking,
Lalit Maganti 2015/09/10 09:41:57 AFAIK: no the pointer cannot be invalid until dele
+ callback->Run();
+ delete callback;
+}
+
+// static
+bool WebappRegistry::RegisterWebappRegistry(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}

Powered by Google App Engine
This is Rietveld 408576698