summaryrefslogtreecommitdiffstats
path: root/chrome/common/common_param_traits.cc
diff options
context:
space:
mode:
authorbulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-18 16:44:22 +0000
committerbulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-18 16:44:22 +0000
commit434afdcf94e2319ff03872db312d489a44637508 (patch)
tree3414ee5da70cb7ada1074c36cfc001e4ebfd5438 /chrome/common/common_param_traits.cc
parentf01e0a37fa8f328b8694c9abc69ecc62fbc9690a (diff)
downloadchromium_src-434afdcf94e2319ff03872db312d489a44637508.zip
chromium_src-434afdcf94e2319ff03872db312d489a44637508.tar.gz
chromium_src-434afdcf94e2319ff03872db312d489a44637508.tar.bz2
Initial Geolocation implementation
Adds IPC plumbing. Adds Infobar buttons for requesting permission TEST=geolocation_browsertest.cc Review URL: http://codereview.chromium.org/548188 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39366 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/common_param_traits.cc')
-rw-r--r--chrome/common/common_param_traits.cc63
1 files changed, 62 insertions, 1 deletions
diff --git a/chrome/common/common_param_traits.cc b/chrome/common/common_param_traits.cc
index e213f6d..62e57ff 100644
--- a/chrome/common/common_param_traits.cc
+++ b/chrome/common/common_param_traits.cc
@@ -245,5 +245,66 @@ void ParamTraits<webkit_glue::WebApplicationInfo>::Log(
l->append(L"<WebApplicationInfo>");
}
-} // namespace IPC
+void ParamTraits<Geoposition::ErrorCode>::Write(
+ Message* m, const Geoposition::ErrorCode& p) {
+ int error_code = p;
+ WriteParam(m, error_code);
+}
+
+bool ParamTraits<Geoposition::ErrorCode>::Read(
+ const Message* m, void** iter, Geoposition::ErrorCode* p) {
+ int error_code_param = 0;
+ bool ret = ReadParam(m, iter, &error_code_param);
+ *p = static_cast<Geoposition::ErrorCode>(error_code_param);
+ return ret;
+}
+void ParamTraits<Geoposition::ErrorCode>::Log(
+ const Geoposition::ErrorCode& p, std::wstring* l) {
+ int error_code = p;
+ l->append(StringPrintf(L"<Geoposition::ErrorCode>%d", error_code));
+}
+
+void ParamTraits<Geoposition>::Write(Message* m, const Geoposition& p) {
+ WriteParam(m, p.latitude);
+ WriteParam(m, p.longitude);
+ WriteParam(m, p.accuracy);
+ WriteParam(m, p.altitude);
+ WriteParam(m, p.altitude_accuracy);
+ WriteParam(m, p.speed);
+ WriteParam(m, p.heading);
+ WriteParam(m, p.timestamp);
+ WriteParam(m, p.error_code);
+ WriteParam(m, p.error_message);
+}
+
+bool ParamTraits<Geoposition>::Read(
+ const Message* m, void** iter, Geoposition* p) {
+ bool ret = ReadParam(m, iter, &p->latitude);
+ ret = ret && ReadParam(m, iter, &p->longitude);
+ ret = ret && ReadParam(m, iter, &p->accuracy);
+ ret = ret && ReadParam(m, iter, &p->altitude);
+ ret = ret && ReadParam(m, iter, &p->altitude_accuracy);
+ ret = ret && ReadParam(m, iter, &p->speed);
+ ret = ret && ReadParam(m, iter, &p->heading);
+ ret = ret && ReadParam(m, iter, &p->timestamp);
+ ret = ret && ReadParam(m, iter, &p->error_code);
+ ret = ret && ReadParam(m, iter, &p->error_message);
+ return ret;
+}
+
+void ParamTraits<Geoposition>::Log(const Geoposition& p, std::wstring* l) {
+ l->append(
+ StringPrintf(
+ L"<Geoposition>"
+ L"%.6f %.6f %.6f %.6f "
+ L"%.6f %.6f %.6f "
+ L"%lld ",
+ p.latitude, p.longitude, p.accuracy, p.altitude,
+ p.altitude_accuracy, p.speed, p.heading,
+ p.timestamp));
+ l->append(p.error_message);
+ LogParam<Geoposition::ErrorCode>(p.error_code, l);
+}
+
+} // namespace IPC