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

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

Issue 6997006: iwyu: Include stringprintf.h where appropriate, part 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "content/browser/geolocation/libgps_wrapper_linux.h" 5 #include "content/browser/geolocation/libgps_wrapper_linux.h"
6 6
7 #include <dlfcn.h> 7 #include <dlfcn.h>
8 #include <errno.h> 8 #include <errno.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/string_util.h" 11 #include "base/stringprintf.h"
12 #include "content/common/geoposition.h" 12 #include "content/common/geoposition.h"
13 13
14 namespace { 14 namespace {
15 // Pass to TryToOpen() to indicate which functions should be wired up. 15 // Pass to TryToOpen() to indicate which functions should be wired up.
16 // This could be turned into a bit mask if required, but for now the 16 // This could be turned into a bit mask if required, but for now the
17 // two options are mutually exclusive. 17 // two options are mutually exclusive.
18 enum InitMode { 18 enum InitMode {
19 INITMODE_QUERY, 19 INITMODE_QUERY,
20 INITMODE_STREAM, 20 INITMODE_STREAM,
21 }; 21 };
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 void LibGps::Stop() { 102 void LibGps::Stop() {
103 library().close(); 103 library().close();
104 } 104 }
105 105
106 bool LibGps::Poll() { 106 bool LibGps::Poll() {
107 last_error_ = "no data received from gpsd"; 107 last_error_ = "no data received from gpsd";
108 while (DataWaiting()) { 108 while (DataWaiting()) {
109 int error = library().poll(); 109 int error = library().poll();
110 if (error) { 110 if (error) {
111 last_error_ = StringPrintf("poll() returned %d", error); 111 last_error_ = base::StringPrintf("poll() returned %d", error);
112 Stop(); 112 Stop();
113 return false; 113 return false;
114 } 114 }
115 last_error_.clear(); 115 last_error_.clear();
116 } 116 }
117 return last_error_.empty(); 117 return last_error_.empty();
118 } 118 }
119 119
120 bool LibGps::GetPosition(Geoposition* position) { 120 bool LibGps::GetPosition(Geoposition* position) {
121 DCHECK(position); 121 DCHECK(position);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 } 211 }
212 212
213 const gps_data_t& LibGpsLibraryWrapper::data() const { 213 const gps_data_t& LibGpsLibraryWrapper::data() const {
214 DCHECK(is_open()); 214 DCHECK(is_open());
215 return *gps_data_; 215 return *gps_data_;
216 } 216 }
217 217
218 bool LibGpsLibraryWrapper::is_open() const { 218 bool LibGpsLibraryWrapper::is_open() const {
219 return gps_data_ != NULL; 219 return gps_data_ != NULL;
220 } 220 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698