Various minor behavior-preserving changes to financial_ping.cc

TBR=rogerta
Review URL: https://codereview.appspot.com/5787047

git-svn-id: http://rlz.googlecode.com/svn/trunk@70 10bc0f33-e4bf-9a86-80cf-af638054f0c4
diff --git a/win/lib/financial_ping.cc b/win/lib/financial_ping.cc
index 893e170..151f552 100644
--- a/win/lib/financial_ping.cc
+++ b/win/lib/financial_ping.cc
@@ -6,8 +6,12 @@
 
 #include "rlz/win/lib/financial_ping.h"
 
+// TODO(thakis): use chromium's http stack instead.
+#if defined(OS_WIN)
 #include <windows.h>
 #include <wininet.h>
+#endif
+
 #include "base/basictypes.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/string_util.h"
@@ -21,26 +25,20 @@
 #include "rlz/win/lib/user_key.h"
 
 
+// TODO(thakis): Make this cross-platform.
+#if defined(OS_WIN)
 namespace {
 
-int64 ToInt64(const FILETIME& ft) {
-  LARGE_INTEGER integer;
-  integer.HighPart = ft.dwHighDateTime;
-  integer.LowPart = ft.dwLowDateTime;
-  return integer.QuadPart;
-}
-
 int64 GetSystemTimeAsInt64() {
   FILETIME now_as_file_time;
   GetSystemTimeAsFileTime(&now_as_file_time);
-  return ToInt64(now_as_file_time);
+
+  LARGE_INTEGER integer;
+  integer.HighPart = now_as_file_time.dwHighDateTime;
+  integer.LowPart = now_as_file_time.dwLowDateTime;
+  return integer.QuadPart;
 }
 
-}  // namespace anonymous
-
-
-namespace rlz_lib {
-
 class InternetHandle {
  public:
   InternetHandle(HINTERNET handle) { handle_ = handle; }
@@ -52,6 +50,12 @@
   HINTERNET handle_;
 };
 
+}  // namespace anonymous
+#endif
+
+
+namespace rlz_lib {
+
 bool FinancialPing::FormRequest(Product product,
     const AccessPoint* access_points, const char* product_signature,
     const char* product_brand, const char* product_id,
@@ -154,6 +158,7 @@
 
   response->clear();
 
+#if defined(OS_WIN)
   // Initialize WinInet.
   InternetHandle inet_handle = InternetOpenA(kFinancialPingUserAgent,
                                              INTERNET_OPEN_TYPE_PRECONFIG,
@@ -198,6 +203,10 @@
     response->append(buffer.get(), bytes_read);
     bytes_read = 0;
   };
+#else
+  // TODO(thakis): Make this cross-platform.
+  NOTIMPLEMENTED();
+#endif
 
   return true;
 }
@@ -261,9 +270,10 @@
   if (!user_key.HasAccess(true))
     return false;
 
-  const wchar_t* value_name = GetProductName(product);
   base::win::RegKey key;
   GetPingTimesRegKey(user_key.Get(), KEY_WRITE, &key);
+
+  const wchar_t* value_name = GetProductName(product);
   key.DeleteValue(value_name);
 
   // Verify deletion.