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

Side by Side Diff: content/browser/geolocation/libgps_wrapper_linux.h

Issue 8171006: Fix gps.h license issue, by deleting it (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // Defines a wrapper around the C libgps API (gps.h). Similar to the libgpsmm.h 5 // Defines a wrapper around the C libgps API (gps.h). Similar to the libgpsmm.h
6 // API provided by that package, but adds: 6 // API provided by that package, but adds:
7 // - shared object dynamic loading 7 // - shared object dynamic loading
8 // - support for (and abstraction from) different libgps.so versions 8 // - support for (and abstraction from) different libgps.so versions
9 // - configurable for testing 9 // - configurable for testing
10 // - more convenient error handling. 10 // - more convenient error handling.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 virtual bool StartStreaming() = 0; 46 virtual bool StartStreaming() = 0;
47 virtual bool DataWaiting() = 0; 47 virtual bool DataWaiting() = 0;
48 // Returns false if there is not fix available. 48 // Returns false if there is not fix available.
49 virtual bool GetPositionIfFixed(Geoposition* position) = 0; 49 virtual bool GetPositionIfFixed(Geoposition* position) = 0;
50 50
51 private: 51 private:
52 // Factory functions to create instances of LibGps using the corresponding 52 // Factory functions to create instances of LibGps using the corresponding
53 // libgps API versions (v2.38 => libgps.so.17, v2.94 => libgps.so.19). 53 // libgps API versions (v2.38 => libgps.so.17, v2.94 => libgps.so.19).
54 // See LibGps::New() for the public API to this. 54 // See LibGps::New() for the public API to this.
55 // Takes ownership of |dl_wrapper|. 55 // Takes ownership of |dl_wrapper|.
56 static LibGps* NewV238(LibGpsLibraryWrapper* dl_wrapper);
57 static LibGps* NewV294(LibGpsLibraryWrapper* dl_wrapper); 56 static LibGps* NewV294(LibGpsLibraryWrapper* dl_wrapper);
58 57
59 scoped_ptr<LibGpsLibraryWrapper> library_; 58 scoped_ptr<LibGpsLibraryWrapper> library_;
60 std::string last_error_; 59 std::string last_error_;
61 60
62 DISALLOW_COPY_AND_ASSIGN(LibGps); 61 DISALLOW_COPY_AND_ASSIGN(LibGps);
63 }; 62 };
64 63
65 struct gps_data_t; 64 struct gps_data_t;
66 65
67 // Wraps the low-level shared object, binding C++ member functions onto the 66 // Wraps the low-level shared object, binding C++ member functions onto the
68 // underlying C functions obtained from the library. 67 // underlying C functions obtained from the library.
69 class CONTENT_EXPORT LibGpsLibraryWrapper { 68 class CONTENT_EXPORT LibGpsLibraryWrapper {
70 public: 69 public:
71 typedef gps_data_t* (*gps_open_fn)(const char*, const char*); 70 typedef gps_data_t* (*gps_open_fn)(const char*, const char*);
72 typedef int (*gps_close_fn)(gps_data_t*); 71 typedef int (*gps_close_fn)(gps_data_t*);
73 typedef int (*gps_poll_fn)(gps_data_t*); 72 typedef int (*gps_poll_fn)(gps_data_t*);
74 // v2.34 only
75 typedef int (*gps_query_fn)(gps_data_t*, const char*, ...);
76 // v2.90+ 73 // v2.90+
77 typedef int (*gps_stream_fn)(gps_data_t*, unsigned int, void*); 74 typedef int (*gps_stream_fn)(gps_data_t*, unsigned int, void*);
78 typedef bool (*gps_waiting_fn)(gps_data_t*); 75 typedef bool (*gps_waiting_fn)(gps_data_t*);
79 76
80 LibGpsLibraryWrapper(void* dl_handle, 77 LibGpsLibraryWrapper(void* dl_handle,
81 gps_open_fn gps_open, 78 gps_open_fn gps_open,
82 gps_close_fn gps_close, 79 gps_close_fn gps_close,
83 gps_poll_fn gps_poll, 80 gps_poll_fn gps_poll,
84 gps_query_fn gps_query,
85 gps_stream_fn gps_stream, 81 gps_stream_fn gps_stream,
86 gps_waiting_fn gps_waiting); 82 gps_waiting_fn gps_waiting);
87 ~LibGpsLibraryWrapper(); 83 ~LibGpsLibraryWrapper();
88 84
89 // Analogs of gps_xxx methods in gps.h 85 // Analogs of gps_xxx methods in gps.h
90 bool open(const char* host, const char* port); 86 bool open(const char* host, const char* port);
91 void close(); 87 void close();
92 int poll(); 88 int poll();
93 int query(const char* fmt);
94 int stream(int flags); 89 int stream(int flags);
95 bool waiting(); 90 bool waiting();
96 const gps_data_t& data() const; 91 const gps_data_t& data() const;
97 bool is_open() const; 92 bool is_open() const;
98 93
99 private: 94 private:
100 void* dl_handle_; 95 void* dl_handle_;
101 gps_open_fn gps_open_; 96 gps_open_fn gps_open_;
102 gps_close_fn gps_close_; 97 gps_close_fn gps_close_;
103 gps_poll_fn gps_poll_; 98 gps_poll_fn gps_poll_;
104 gps_query_fn gps_query_;
105 gps_stream_fn gps_stream_; 99 gps_stream_fn gps_stream_;
106 gps_waiting_fn gps_waiting_; 100 gps_waiting_fn gps_waiting_;
107 101
108 gps_data_t* gps_data_; 102 gps_data_t* gps_data_;
109 103
110 DISALLOW_COPY_AND_ASSIGN(LibGpsLibraryWrapper); 104 DISALLOW_COPY_AND_ASSIGN(LibGpsLibraryWrapper);
111 }; 105 };
112 106
113 #endif // CONTENT_BROWSER_GEOLOCATION_LIBGPS_WRAPPER_LINUX_H_ 107 #endif // CONTENT_BROWSER_GEOLOCATION_LIBGPS_WRAPPER_LINUX_H_
OLDNEW
« no previous file with comments | « content/browser/geolocation/libgps_2_94_wrapper_linux.cc ('k') | content/browser/geolocation/libgps_wrapper_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698