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

Unified Diff: chrome/browser/android/physical_web/physical_web_data_source_android.cc

Issue 2377513002: Add a Physical Web JNI bridge to support native Physical Web clients (Closed)
Patch Set: remove @CalledByNative annotation on unused method Created 4 years, 2 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
« no previous file with comments | « chrome/browser/android/physical_web/physical_web_data_source_android.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/physical_web/physical_web_data_source_android.cc
diff --git a/chrome/browser/android/physical_web/physical_web_data_source_android.cc b/chrome/browser/android/physical_web/physical_web_data_source_android.cc
index 9e078b391b3f3acf2ffb191dd4998c0d3a1ba0ba..2f8eed56b84a066eacf4b440260fec8cb4f1d7a6 100644
--- a/chrome/browser/android/physical_web/physical_web_data_source_android.cc
+++ b/chrome/browser/android/physical_web/physical_web_data_source_android.cc
@@ -4,34 +4,59 @@
#include "chrome/browser/android/physical_web/physical_web_data_source_android.h"
+#include <jni.h>
+
#include "base/memory/ptr_util.h"
#include "base/values.h"
+#include "chrome/browser/browser_process.h"
+#include "jni/UrlManager_jni.h"
+
+using base::android::AttachCurrentThread;
+using base::android::JavaParamRef;
+using base::android::ScopedJavaLocalRef;
PhysicalWebDataSourceAndroid::PhysicalWebDataSourceAndroid() {
+ Initialize();
}
-PhysicalWebDataSourceAndroid::~PhysicalWebDataSourceAndroid() {
+PhysicalWebDataSourceAndroid::~PhysicalWebDataSourceAndroid() {}
+
+void PhysicalWebDataSourceAndroid::Initialize() {
+ JNIEnv* env = AttachCurrentThread();
+
+ // Cache a reference to the singleton instance of UrlManager.
+ url_manager_.Reset(Java_UrlManager_getInstance(env));
+ DCHECK(url_manager_.obj());
}
void PhysicalWebDataSourceAndroid::StartDiscovery(
bool network_request_enabled) {
+ // On Android, scanning is started and stopped through the Java layer.
+ NOTREACHED();
}
void PhysicalWebDataSourceAndroid::StopDiscovery() {
+ // On Android, scanning is started and stopped through the Java layer.
+ NOTREACHED();
}
std::unique_ptr<base::ListValue> PhysicalWebDataSourceAndroid::GetMetadata() {
+ // TODO(mattreynolds): get the metadata from the Java layer
return base::MakeUnique<base::ListValue>();
}
bool PhysicalWebDataSourceAndroid::HasUnresolvedDiscoveries() {
+ NOTIMPLEMENTED();
return false;
}
-void PhysicalWebDataSourceAndroid::RegisterListener(
- PhysicalWebListener* listener) {
+// static
+bool PhysicalWebDataSourceAndroid::RegisterPhysicalWebDataSource(JNIEnv* env) {
+ return RegisterNativesImpl(env);
}
-void PhysicalWebDataSourceAndroid::UnregisterListener(
- PhysicalWebListener* listener) {
+static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) {
+ PhysicalWebDataSource* data_source =
+ g_browser_process->GetPhysicalWebDataSource();
+ return reinterpret_cast<intptr_t>(data_source);
}
« no previous file with comments | « chrome/browser/android/physical_web/physical_web_data_source_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698