| Index: chrome/browser/geolocation/network_location_request.cc
|
| diff --git a/chrome/browser/geolocation/network_location_request.cc b/chrome/browser/geolocation/network_location_request.cc
|
| index e6423b02425d8a80fdc56c27930102159d5d4371..8081568fe8389fa379182be8441cfb92183b207c 100644
|
| --- a/chrome/browser/geolocation/network_location_request.cc
|
| +++ b/chrome/browser/geolocation/network_location_request.cc
|
| @@ -20,13 +20,13 @@ const char kMimeApplicationJson[] = "application/json";
|
| // See http://code.google.com/apis/gears/geolocation_network_protocol.html
|
| const char kGeoLocationNetworkProtocolVersion[] = "1.1.0";
|
|
|
| -const wchar_t kAccessTokenString[] = L"access_token";
|
| -const wchar_t kLocationString[] = L"location";
|
| -const wchar_t kLatitudeString[] = L"latitude";
|
| -const wchar_t kLongitudeString[] = L"longitude";
|
| -const wchar_t kAltitudeString[] = L"altitude";
|
| -const wchar_t kAccuracyString[] = L"accuracy";
|
| -const wchar_t kAltitudeAccuracyString[] = L"altitude_accuracy";
|
| +const char kAccessTokenString[] = "access_token";
|
| +const char kLocationString[] = "location";
|
| +const char kLatitudeString[] = "latitude";
|
| +const char kLongitudeString[] = "longitude";
|
| +const char kAltitudeString[] = "altitude";
|
| +const char kAccuracyString[] = "accuracy";
|
| +const char kAltitudeAccuracyString[] = "altitude_accuracy";
|
|
|
| // Local functions
|
| // Creates the request payload to send to the server.
|
| @@ -47,11 +47,11 @@ void GetLocationFromResponse(bool http_post_result,
|
|
|
| const char* RadioTypeToString(RadioType type);
|
| // Adds a string if it's valid to the JSON object.
|
| -void AddString(const std::wstring& property_name,
|
| +void AddString(const std::string& property_name,
|
| const string16& value,
|
| DictionaryValue* object);
|
| // Adds an integer if it's valid to the JSON object.
|
| -void AddInteger(const std::wstring& property_name,
|
| +void AddInteger(const std::string& property_name,
|
| int value,
|
| DictionaryValue* object);
|
| // Parses the server response body. Returns true if parsing was successful.
|
| @@ -150,12 +150,12 @@ void FormRequestBody(const std::string& host_name,
|
| COMPILE_ASSERT(sizeof(kGeoLocationNetworkProtocolVersion) > 1,
|
| must_include_valid_version);
|
| DCHECK(!host_name.empty());
|
| - body_object.SetString(L"version", kGeoLocationNetworkProtocolVersion);
|
| - body_object.SetString(L"host", host_name);
|
| + body_object.SetString("version", kGeoLocationNetworkProtocolVersion);
|
| + body_object.SetString("host", host_name);
|
|
|
| - AddString(L"access_token", access_token, &body_object);
|
| + AddString("access_token", access_token, &body_object);
|
|
|
| - body_object.SetBoolean(L"request_address", false);
|
| + body_object.SetBoolean("request_address", false);
|
|
|
| int age = kint32min; // Invalid so AddInteger() will ignore.
|
| if (!timestamp.is_null()) {
|
| @@ -239,7 +239,7 @@ const char* RadioTypeToString(RadioType type) {
|
| return "unknown";
|
| }
|
|
|
| -void AddString(const std::wstring& property_name,
|
| +void AddString(const std::string& property_name,
|
| const string16& value,
|
| DictionaryValue* object) {
|
| DCHECK(object);
|
| @@ -248,7 +248,7 @@ void AddString(const std::wstring& property_name,
|
| }
|
| }
|
|
|
| -void AddInteger(const std::wstring& property_name,
|
| +void AddInteger(const std::string& property_name,
|
| int value,
|
| DictionaryValue* object) {
|
| DCHECK(object);
|
| @@ -262,7 +262,7 @@ void AddInteger(const std::wstring& property_name,
|
| // point numeric values. Note that isIntegral() includes boolean values, which
|
| // is not what we want.
|
| bool GetAsDouble(const DictionaryValue& object,
|
| - const std::wstring& property_name,
|
| + const std::string& property_name,
|
| double* out) {
|
| DCHECK(out);
|
| Value* value = NULL;
|
| @@ -312,7 +312,7 @@ bool ParseServerResponse(const std::string& response_body,
|
| static_cast<DictionaryValue*>(response_value.get());
|
|
|
| // Get the access token, if any.
|
| - response_object->GetStringAsUTF16(kAccessTokenString, access_token);
|
| + response_object->GetString(kAccessTokenString, access_token);
|
|
|
| // Get the location
|
| Value* location_value = NULL;
|
| @@ -363,14 +363,14 @@ void AddRadioData(const RadioData& radio_data,
|
| DictionaryValue* body_object) {
|
| DCHECK(body_object);
|
|
|
| - AddInteger(L"home_mobile_country_code", radio_data.home_mobile_country_code,
|
| + AddInteger("home_mobile_country_code", radio_data.home_mobile_country_code,
|
| body_object);
|
| - AddInteger(L"home_mobile_network_code", radio_data.home_mobile_network_code,
|
| + AddInteger("home_mobile_network_code", radio_data.home_mobile_network_code,
|
| body_object);
|
| - AddString(L"radio_type",
|
| + AddString("radio_type",
|
| ASCIIToUTF16(RadioTypeToString(radio_data.radio_type)),
|
| body_object);
|
| - AddString(L"carrier", radio_data.carrier, body_object);
|
| + AddString("carrier", radio_data.carrier, body_object);
|
|
|
| const int num_cell_towers = static_cast<int>(radio_data.cell_data.size());
|
| if (num_cell_towers == 0) {
|
| @@ -379,21 +379,21 @@ void AddRadioData(const RadioData& radio_data,
|
| ListValue* cell_towers = new ListValue;
|
| for (int i = 0; i < num_cell_towers; ++i) {
|
| DictionaryValue* cell_tower = new DictionaryValue;
|
| - AddInteger(L"cell_id", radio_data.cell_data[i].cell_id, cell_tower);
|
| - AddInteger(L"location_area_code",
|
| + AddInteger("cell_id", radio_data.cell_data[i].cell_id, cell_tower);
|
| + AddInteger("location_area_code",
|
| radio_data.cell_data[i].location_area_code, cell_tower);
|
| - AddInteger(L"mobile_country_code",
|
| + AddInteger("mobile_country_code",
|
| radio_data.cell_data[i].mobile_country_code, cell_tower);
|
| - AddInteger(L"mobile_network_code",
|
| + AddInteger("mobile_network_code",
|
| radio_data.cell_data[i].mobile_network_code, cell_tower);
|
| - AddInteger(L"age", age_milliseconds, cell_tower);
|
| - AddInteger(L"signal_strength",
|
| + AddInteger("age", age_milliseconds, cell_tower);
|
| + AddInteger("signal_strength",
|
| radio_data.cell_data[i].radio_signal_strength, cell_tower);
|
| - AddInteger(L"timing_advance", radio_data.cell_data[i].timing_advance,
|
| + AddInteger("timing_advance", radio_data.cell_data[i].timing_advance,
|
| cell_tower);
|
| cell_towers->Append(cell_tower);
|
| }
|
| - body_object->Set(L"cell_towers", cell_towers);
|
| + body_object->Set("cell_towers", cell_towers);
|
| }
|
|
|
| void AddWifiData(const WifiData& wifi_data,
|
| @@ -411,14 +411,14 @@ void AddWifiData(const WifiData& wifi_data,
|
| iter != wifi_data.access_point_data.end();
|
| iter++) {
|
| DictionaryValue* wifi_tower = new DictionaryValue;
|
| - AddString(L"mac_address", iter->mac_address, wifi_tower);
|
| - AddInteger(L"signal_strength", iter->radio_signal_strength, wifi_tower);
|
| - AddInteger(L"age", age_milliseconds, wifi_tower);
|
| - AddInteger(L"channel", iter->channel, wifi_tower);
|
| - AddInteger(L"signal_to_noise", iter->signal_to_noise, wifi_tower);
|
| - AddString(L"ssid", iter->ssid, wifi_tower);
|
| + AddString("mac_address", iter->mac_address, wifi_tower);
|
| + AddInteger("signal_strength", iter->radio_signal_strength, wifi_tower);
|
| + AddInteger("age", age_milliseconds, wifi_tower);
|
| + AddInteger("channel", iter->channel, wifi_tower);
|
| + AddInteger("signal_to_noise", iter->signal_to_noise, wifi_tower);
|
| + AddString("ssid", iter->ssid, wifi_tower);
|
| wifi_towers->Append(wifi_tower);
|
| }
|
| - body_object->Set(L"wifi_towers", wifi_towers);
|
| + body_object->Set("wifi_towers", wifi_towers);
|
| }
|
| } // namespace
|
|
|