summaryrefslogtreecommitdiffstats
path: root/content/browser/geolocation/network_location_request.cc
diff options
context:
space:
mode:
authorbartfab@chromium.org <bartfab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-02 20:48:35 +0000
committerbartfab@chromium.org <bartfab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-02 20:48:35 +0000
commit9fc4dabfb2dd3f2f7e9da2af8ae9f41b469e68f9 (patch)
tree3fd3f6a5d05d6c8755b8658a22de2b2a8acbfdd4 /content/browser/geolocation/network_location_request.cc
parentbfde7449259ccf84393fd6751fca30ea36eb0368 (diff)
downloadchromium_src-9fc4dabfb2dd3f2f7e9da2af8ae9f41b469e68f9.zip
chromium_src-9fc4dabfb2dd3f2f7e9da2af8ae9f41b469e68f9.tar.gz
chromium_src-9fc4dabfb2dd3f2f7e9da2af8ae9f41b469e68f9.tar.bz2
Make the Geoposition helper struct public
This CL moves the Geoposition struct from content/common to public/content/common.h so that it can be shared by content and browser. The struct is placed in the |content| namespace and as required by the style guide, all methods except the constructor and Validate() are removed. This paves the way for a follow-up CL in which the content will provide geolocation information to the browser. BUG=chromium-os:22036 TEST=Chrome and tests build, run Review URL: http://codereview.chromium.org/10316007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134989 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/geolocation/network_location_request.cc')
-rw-r--r--content/browser/geolocation/network_location_request.cc24
1 files changed, 13 insertions, 11 deletions
diff --git a/content/browser/geolocation/network_location_request.cc b/content/browser/geolocation/network_location_request.cc
index c8702b2..3ea8def 100644
--- a/content/browser/geolocation/network_location_request.cc
+++ b/content/browser/geolocation/network_location_request.cc
@@ -12,8 +12,8 @@
#include "base/string_number_conversions.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
-#include "content/common/geoposition.h"
#include "content/common/net/url_fetcher_impl.h"
+#include "content/public/common/geoposition.h"
#include "net/base/escape.h"
#include "net/base/load_flags.h"
#include "net/url_request/url_request_context_getter.h"
@@ -44,15 +44,15 @@ void GetLocationFromResponse(bool http_post_result,
const std::string& response_body,
const base::Time& timestamp,
const GURL& server_url,
- Geoposition* position,
+ content::Geoposition* position,
string16* access_token);
// Parses the server response body. Returns true if parsing was successful.
// Sets |*position| to the parsed location if a valid fix was received,
-// otherwise leaves it unchanged (i.e. IsInitialized() == false).
+// otherwise leaves it unchanged.
bool ParseServerResponse(const std::string& response_body,
const base::Time& timestamp,
- Geoposition* position,
+ content::Geoposition* position,
string16* access_token);
void AddWifiData(const WifiData& wifi_data,
int age_milliseconds,
@@ -106,7 +106,7 @@ void NetworkLocationRequest::OnURLFetchComplete(
net::URLRequestStatus status = source->GetStatus();
int response_code = source->GetResponseCode();
- Geoposition position;
+ content::Geoposition position;
string16 access_token;
std::string data;
source->GetResponseAsString(&data);
@@ -237,8 +237,9 @@ void AddWifiData(const WifiData& wifi_data,
void FormatPositionError(const GURL& server_url,
const std::string& message,
- Geoposition* position) {
- position->error_code = Geoposition::ERROR_CODE_POSITION_UNAVAILABLE;
+ content::Geoposition* position) {
+ position->error_code =
+ content::Geoposition::ERROR_CODE_POSITION_UNAVAILABLE;
position->error_message = "Network location provider at '";
position->error_message += server_url.possibly_invalid_spec();
position->error_message += "' : ";
@@ -253,7 +254,7 @@ void GetLocationFromResponse(bool http_post_result,
const std::string& response_body,
const base::Time& timestamp,
const GURL& server_url,
- Geoposition* position,
+ content::Geoposition* position,
string16* access_token) {
DCHECK(position);
DCHECK(access_token);
@@ -279,7 +280,7 @@ void GetLocationFromResponse(bool http_post_result,
}
// The response was successfully parsed, but it may not be a valid
// position fix.
- if (!position->IsValidFix()) {
+ if (!position->Validate()) {
FormatPositionError(server_url,
"Did not provide a good position fix", position);
return;
@@ -308,10 +309,11 @@ bool GetAsDouble(const DictionaryValue& object,
bool ParseServerResponse(const std::string& response_body,
const base::Time& timestamp,
- Geoposition* position,
+ content::Geoposition* position,
string16* access_token) {
DCHECK(position);
- DCHECK(!position->IsInitialized());
+ DCHECK(!position->Validate());
+ DCHECK(position->error_code == content::Geoposition::ERROR_CODE_NONE);
DCHECK(access_token);
DCHECK(!timestamp.is_null());