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

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

Issue 2648973004: Remove GetMetadata from PhysicalWebDataSource and PhysicalWebScanner (Closed)
Patch Set: nil -> null Created 3 years, 10 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
« no previous file with comments | « no previous file | chrome/browser/android/physical_web/physical_web_data_source_android.cc » ('j') | 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 #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 {
15 class ListValue;
16 }
17
18 // A container for Physical Web metadata. This is primarily a wrapper for a 14 // A container for Physical Web metadata. This is primarily a wrapper for a
19 // ListValue so we can append to it over JNI. 15 // physical_web::MetadataList so we can append to it over JNI.
20 class PhysicalWebCollection { 16 class PhysicalWebCollection {
21 public: 17 public:
22 PhysicalWebCollection(); 18 PhysicalWebCollection();
23 ~PhysicalWebCollection(); 19 ~PhysicalWebCollection();
24 20
25 void AppendMetadataItem( 21 void AppendMetadataItem(
26 JNIEnv* env, 22 JNIEnv* env,
27 const base::android::JavaParamRef<jobject>& obj, 23 const base::android::JavaParamRef<jobject>& obj,
28 const base::android::JavaParamRef<jstring>& j_request_url, 24 const base::android::JavaParamRef<jstring>& j_request_url,
29 jdouble distance_estimate, 25 jdouble distance_estimate,
30 jlong scan_timestamp, 26 jlong scan_timestamp,
31 const base::android::JavaParamRef<jstring>& j_site_url, 27 const base::android::JavaParamRef<jstring>& j_site_url,
32 const base::android::JavaParamRef<jstring>& j_icon_url, 28 const base::android::JavaParamRef<jstring>& j_icon_url,
33 const base::android::JavaParamRef<jstring>& j_title, 29 const base::android::JavaParamRef<jstring>& j_title,
34 const base::android::JavaParamRef<jstring>& j_description, 30 const base::android::JavaParamRef<jstring>& j_description,
35 const base::android::JavaParamRef<jstring>& j_group_id); 31 const base::android::JavaParamRef<jstring>& j_group_id);
36 32
37 // Returns the metadata list and transfers ownership of the list to the 33 // Returns the metadata list and transfers ownership of the list to the
38 // caller. Call only once. 34 // caller. Call only once.
39 std::unique_ptr<physical_web::MetadataList> GetMetadataList(); 35 std::unique_ptr<physical_web::MetadataList> GetMetadataList();
40 36
41 // Returns the metadata list and transfers ownership of the list to the
42 // caller. Call only once.
43 // DEPRECATED
44 // TODO(cco3): Remove when we no longer rely on this.
45 std::unique_ptr<base::ListValue> GetMetadata();
46
47 private: 37 private:
48 std::unique_ptr<base::ListValue> dictionary_value_list_;
49 std::unique_ptr<physical_web::MetadataList> metadata_list_; 38 std::unique_ptr<physical_web::MetadataList> metadata_list_;
50 bool accessed_once_; 39 bool accessed_once_;
51 40
52 DISALLOW_COPY_AND_ASSIGN(PhysicalWebCollection); 41 DISALLOW_COPY_AND_ASSIGN(PhysicalWebCollection);
53 }; 42 };
54 43
55 class PhysicalWebDataSourceAndroid 44 class PhysicalWebDataSourceAndroid
56 : public physical_web::PhysicalWebDataSourceImpl { 45 : public physical_web::PhysicalWebDataSourceImpl {
57 public: 46 public:
58 PhysicalWebDataSourceAndroid(); 47 PhysicalWebDataSourceAndroid();
59 ~PhysicalWebDataSourceAndroid() override; 48 ~PhysicalWebDataSourceAndroid() override;
60 49
61 static bool RegisterPhysicalWebDataSource(JNIEnv* env); 50 static bool RegisterPhysicalWebDataSource(JNIEnv* env);
62 51
63 void Initialize(); 52 void Initialize();
64 53
65 void StartDiscovery(bool network_request_enabled) override; 54 void StartDiscovery(bool network_request_enabled) override;
66 void StopDiscovery() override; 55 void StopDiscovery() override;
67 56
68 std::unique_ptr<base::ListValue> GetMetadata() override;
69 std::unique_ptr<physical_web::MetadataList> GetMetadataList() override; 57 std::unique_ptr<physical_web::MetadataList> GetMetadataList() override;
70 bool HasUnresolvedDiscoveries() override; 58 bool HasUnresolvedDiscoveries() override;
71 59
72 void OnFound(JNIEnv* env, 60 void OnFound(JNIEnv* env,
73 const base::android::JavaParamRef<jobject>& obj, 61 const base::android::JavaParamRef<jobject>& obj,
74 const base::android::JavaParamRef<jstring>& j_url); 62 const base::android::JavaParamRef<jstring>& j_url);
75 void OnLost(JNIEnv* env, 63 void OnLost(JNIEnv* env,
76 const base::android::JavaParamRef<jobject>& obj, 64 const base::android::JavaParamRef<jobject>& obj,
77 const base::android::JavaParamRef<jstring>& j_url); 65 const base::android::JavaParamRef<jstring>& j_url);
78 void OnDistanceChanged(JNIEnv* env, 66 void OnDistanceChanged(JNIEnv* env,
79 const base::android::JavaParamRef<jobject>& obj, 67 const base::android::JavaParamRef<jobject>& obj,
80 const base::android::JavaParamRef<jstring>& j_url, 68 const base::android::JavaParamRef<jstring>& j_url,
81 jdouble distance_estimate); 69 jdouble distance_estimate);
82 70
83 private: 71 private:
84 // A reference to the Java UrlManager singleton. 72 // A reference to the Java UrlManager singleton.
85 base::android::ScopedJavaGlobalRef<jobject> url_manager_; 73 base::android::ScopedJavaGlobalRef<jobject> url_manager_;
86 74
87 DISALLOW_COPY_AND_ASSIGN(PhysicalWebDataSourceAndroid); 75 DISALLOW_COPY_AND_ASSIGN(PhysicalWebDataSourceAndroid);
88 }; 76 };
89 77
90 #endif // CHROME_BROWSER_ANDROID_PHYSICAL_WEB_PHYSICAL_WEB_DATA_SOURCE_ANDROID_ H_ 78 #endif // CHROME_BROWSER_ANDROID_PHYSICAL_WEB_PHYSICAL_WEB_DATA_SOURCE_ANDROID_ H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/physical_web/physical_web_data_source_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698