Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #ifndef CHROME_BROWSER_ANDROID_PHYSICAL_WEB_PHYSICAL_WEB_DATA_SOURCE_ANDROID_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_PHYSICAL_WEB_PHYSICAL_WEB_DATA_SOURCE_ANDROID_H_ |
| 6 #define CHROME_BROWSER_ANDROID_PHYSICAL_WEB_PHYSICAL_WEB_DATA_SOURCE_ANDROID_H_ | 6 #define CHROME_BROWSER_ANDROID_PHYSICAL_WEB_PHYSICAL_WEB_DATA_SOURCE_ANDROID_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 | 9 |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "components/physical_web/data_source/physical_web_data_source_impl.h" | 12 #include "components/physical_web/data_source/physical_web_data_source_impl.h" |
| 13 | 13 |
| 14 namespace base { | 14 namespace base { |
| 15 class ListValue; | 15 class ListValue; |
| 16 } | 16 } |
| 17 | 17 |
| 18 // A container for Physical Web metadata. This is primarily a wrapper for a | |
| 19 // ListValue so we can append to it over JNI. | |
|
gone
2016/10/24 16:35:35
Is it worth yanking this out into its own file?
mattreynolds
2016/10/24 22:39:52
I tried this, but ran into issues with the way the
| |
| 20 class PhysicalWebCollection { | |
| 21 public: | |
| 22 PhysicalWebCollection(); | |
| 23 ~PhysicalWebCollection(); | |
| 24 | |
| 25 void AppendMetadataItem( | |
| 26 JNIEnv* env, | |
| 27 const base::android::JavaParamRef<jobject>& obj, | |
| 28 const base::android::JavaParamRef<jstring>& j_request_url, | |
| 29 jdouble distance_estimate, | |
| 30 jint scan_timestamp, | |
| 31 const base::android::JavaParamRef<jstring>& j_site_url, | |
| 32 const base::android::JavaParamRef<jstring>& j_icon_url, | |
| 33 const base::android::JavaParamRef<jstring>& j_title, | |
| 34 const base::android::JavaParamRef<jstring>& j_description, | |
| 35 const base::android::JavaParamRef<jstring>& j_group_id); | |
| 36 | |
| 37 std::unique_ptr<base::ListValue> GetMetadataList(); | |
|
gone
2016/10/24 16:35:35
Is it worth putting a note here that this hands ov
mattreynolds
2016/10/24 22:39:52
Done.
| |
| 38 | |
| 39 private: | |
| 40 std::unique_ptr<base::ListValue> metadata_list_; | |
| 41 | |
| 42 DISALLOW_COPY_AND_ASSIGN(PhysicalWebCollection); | |
| 43 }; | |
| 44 | |
| 18 class PhysicalWebDataSourceAndroid : public PhysicalWebDataSourceImpl { | 45 class PhysicalWebDataSourceAndroid : public PhysicalWebDataSourceImpl { |
| 19 public: | 46 public: |
| 20 PhysicalWebDataSourceAndroid(); | 47 PhysicalWebDataSourceAndroid(); |
| 21 ~PhysicalWebDataSourceAndroid() override; | 48 ~PhysicalWebDataSourceAndroid() override; |
| 22 | 49 |
| 23 static bool RegisterPhysicalWebDataSource(JNIEnv* env); | 50 static bool RegisterPhysicalWebDataSource(JNIEnv* env); |
| 24 | 51 |
| 25 void Initialize(); | 52 void Initialize(); |
| 26 | 53 |
| 27 void StartDiscovery(bool network_request_enabled) override; | 54 void StartDiscovery(bool network_request_enabled) override; |
| 28 void StopDiscovery() override; | 55 void StopDiscovery() override; |
| 29 | 56 |
| 30 std::unique_ptr<base::ListValue> GetMetadata() override; | 57 std::unique_ptr<base::ListValue> GetMetadata() override; |
| 31 bool HasUnresolvedDiscoveries() override; | 58 bool HasUnresolvedDiscoveries() override; |
| 32 | 59 |
| 33 private: | 60 private: |
| 34 // A reference to the Java UrlManager singleton. | 61 // A reference to the Java UrlManager singleton. |
| 35 base::android::ScopedJavaGlobalRef<jobject> url_manager_; | 62 base::android::ScopedJavaGlobalRef<jobject> url_manager_; |
| 36 | 63 |
| 37 DISALLOW_COPY_AND_ASSIGN(PhysicalWebDataSourceAndroid); | 64 DISALLOW_COPY_AND_ASSIGN(PhysicalWebDataSourceAndroid); |
| 38 }; | 65 }; |
| 39 | 66 |
| 40 #endif // CHROME_BROWSER_ANDROID_PHYSICAL_WEB_PHYSICAL_WEB_DATA_SOURCE_ANDROID_ H_ | 67 #endif // CHROME_BROWSER_ANDROID_PHYSICAL_WEB_PHYSICAL_WEB_DATA_SOURCE_ANDROID_ H_ |
| OLD | NEW |