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

Side by Side Diff: chrome/browser/android/physical_web/physical_web_data_source_android.cc

Issue 2449963005: Notify native clients when Physical Web URL metadata is updated (Closed)
Patch Set: double-check native is initialized Created 4 years, 1 month 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
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/physical_web/physical_web_data_source_android.h " 5 #include "chrome/browser/android/physical_web/physical_web_data_source_android.h "
6 6
7 #include <jni.h> 7 #include <jni.h>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_string.h" 10 #include "base/android/jni_string.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 (long)pw_collection.get()); 92 (long)pw_collection.get());
93 93
94 return pw_collection->GetMetadataList(); 94 return pw_collection->GetMetadataList();
95 } 95 }
96 96
97 bool PhysicalWebDataSourceAndroid::HasUnresolvedDiscoveries() { 97 bool PhysicalWebDataSourceAndroid::HasUnresolvedDiscoveries() {
98 NOTIMPLEMENTED(); 98 NOTIMPLEMENTED();
99 return false; 99 return false;
100 } 100 }
101 101
102 void PhysicalWebDataSourceAndroid::OnFound(
103 JNIEnv* env,
104 const base::android::JavaParamRef<jobject>& obj,
105 const base::android::JavaParamRef<jstring>& j_url) {
106 std::string url = ConvertJavaStringToUTF8(env, j_url);
107 NotifyOnFound(url);
108 }
109
110 void PhysicalWebDataSourceAndroid::OnLost(
111 JNIEnv* env,
112 const base::android::JavaParamRef<jobject>& obj,
113 const base::android::JavaParamRef<jstring>& j_url) {
114 std::string url = ConvertJavaStringToUTF8(env, j_url);
115 NotifyOnLost(url);
116 }
117
118 void PhysicalWebDataSourceAndroid::OnDistanceChanged(
119 JNIEnv* env,
120 const base::android::JavaParamRef<jobject>& obj,
121 const base::android::JavaParamRef<jstring>& j_url,
122 jdouble distance_estimate) {
123 std::string url = ConvertJavaStringToUTF8(env, j_url);
124 NotifyOnDistanceChanged(url, distance_estimate);
125 }
126
102 // static 127 // static
103 bool PhysicalWebDataSourceAndroid::RegisterPhysicalWebDataSource(JNIEnv* env) { 128 bool PhysicalWebDataSourceAndroid::RegisterPhysicalWebDataSource(JNIEnv* env) {
104 return RegisterNativesImpl(env); 129 return RegisterNativesImpl(env);
105 } 130 }
106 131
107 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { 132 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) {
108 PhysicalWebDataSource* data_source = 133 PhysicalWebDataSource* data_source =
109 g_browser_process->GetPhysicalWebDataSource(); 134 g_browser_process->GetPhysicalWebDataSource();
110 return reinterpret_cast<intptr_t>(data_source); 135 return reinterpret_cast<intptr_t>(data_source);
111 } 136 }
OLDNEW
« 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