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

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

Issue 8113027: Export some unix-specific content symbols (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more exports 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.
11 11
12 #ifndef CONTENT_BROWSER_GEOLOCATION_LIBGPS_WRAPPER_LINUX_H_ 12 #ifndef CONTENT_BROWSER_GEOLOCATION_LIBGPS_WRAPPER_LINUX_H_
13 #define CONTENT_BROWSER_GEOLOCATION_LIBGPS_WRAPPER_LINUX_H_ 13 #define CONTENT_BROWSER_GEOLOCATION_LIBGPS_WRAPPER_LINUX_H_
14 #pragma once 14 #pragma once
15 15
16 #include <string> 16 #include <string>
17 17
18 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
19 #include "base/time.h" 19 #include "base/time.h"
20 #include "content/common/content_export.h"
20 21
21 struct Geoposition; 22 struct Geoposition;
22 class LibGpsLibraryWrapper; 23 class LibGpsLibraryWrapper;
23 24
24 class LibGps { 25 class CONTENT_EXPORT LibGps {
25 public: 26 public:
26 virtual ~LibGps(); 27 virtual ~LibGps();
27 // Attempts to dynamically load the libgps.so library, and creates and 28 // Attempts to dynamically load the libgps.so library, and creates and
28 // appropriate LibGps instance for the version loaded. Returns NULL on 29 // appropriate LibGps instance for the version loaded. Returns NULL on
29 // failure. 30 // failure.
30 static LibGps* New(); 31 static LibGps* New();
31 32
32 bool Start(); 33 bool Start();
33 void Stop(); 34 void Stop();
34 bool Poll(); 35 bool Poll();
(...skipping 23 matching lines...) Expand all
58 scoped_ptr<LibGpsLibraryWrapper> library_; 59 scoped_ptr<LibGpsLibraryWrapper> library_;
59 std::string last_error_; 60 std::string last_error_;
60 61
61 DISALLOW_COPY_AND_ASSIGN(LibGps); 62 DISALLOW_COPY_AND_ASSIGN(LibGps);
62 }; 63 };
63 64
64 struct gps_data_t; 65 struct gps_data_t;
65 66
66 // Wraps the low-level shared object, binding C++ member functions onto the 67 // Wraps the low-level shared object, binding C++ member functions onto the
67 // underlying C functions obtained from the library. 68 // underlying C functions obtained from the library.
68 class LibGpsLibraryWrapper { 69 class CONTENT_EXPORT LibGpsLibraryWrapper {
69 public: 70 public:
70 typedef gps_data_t* (*gps_open_fn)(const char*, const char*); 71 typedef gps_data_t* (*gps_open_fn)(const char*, const char*);
71 typedef int (*gps_close_fn)(gps_data_t*); 72 typedef int (*gps_close_fn)(gps_data_t*);
72 typedef int (*gps_poll_fn)(gps_data_t*); 73 typedef int (*gps_poll_fn)(gps_data_t*);
73 // v2.34 only 74 // v2.34 only
74 typedef int (*gps_query_fn)(gps_data_t*, const char*, ...); 75 typedef int (*gps_query_fn)(gps_data_t*, const char*, ...);
75 // v2.90+ 76 // v2.90+
76 typedef int (*gps_stream_fn)(gps_data_t*, unsigned int, void*); 77 typedef int (*gps_stream_fn)(gps_data_t*, unsigned int, void*);
77 typedef bool (*gps_waiting_fn)(gps_data_t*); 78 typedef bool (*gps_waiting_fn)(gps_data_t*);
78 79
(...skipping 24 matching lines...) Expand all
103 gps_query_fn gps_query_; 104 gps_query_fn gps_query_;
104 gps_stream_fn gps_stream_; 105 gps_stream_fn gps_stream_;
105 gps_waiting_fn gps_waiting_; 106 gps_waiting_fn gps_waiting_;
106 107
107 gps_data_t* gps_data_; 108 gps_data_t* gps_data_;
108 109
109 DISALLOW_COPY_AND_ASSIGN(LibGpsLibraryWrapper); 110 DISALLOW_COPY_AND_ASSIGN(LibGpsLibraryWrapper);
110 }; 111 };
111 112
112 #endif // CONTENT_BROWSER_GEOLOCATION_LIBGPS_WRAPPER_LINUX_H_ 113 #endif // CONTENT_BROWSER_GEOLOCATION_LIBGPS_WRAPPER_LINUX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698