| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Library functions related to the Financial Server ping. | 5 // Library functions related to the Financial Server ping. |
| 6 | 6 |
| 7 #include "rlz/lib/financial_ping.h" | 7 #include "rlz/lib/financial_ping.h" |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "rlz/lib/assert.h" | 14 #include "rlz/lib/assert.h" |
| 15 #include "rlz/lib/lib_values.h" | 15 #include "rlz/lib/lib_values.h" |
| 16 #include "rlz/lib/machine_id.h" | 16 #include "rlz/lib/machine_id.h" |
| 17 #include "rlz/lib/rlz_lib.h" | 17 #include "rlz/lib/rlz_lib.h" |
| 18 #include "rlz/lib/rlz_value_store.h" | 18 #include "rlz/lib/rlz_value_store.h" |
| 19 #include "rlz/lib/string_utils.h" | 19 #include "rlz/lib/string_utils.h" |
| 20 | 20 |
| 21 #if !defined(OS_WIN) | 21 #if !defined(OS_WIN) |
| 22 #include "base/time.h" | 22 #include "base/time/time.h" |
| 23 #endif | 23 #endif |
| 24 | 24 |
| 25 #if defined(RLZ_NETWORK_IMPLEMENTATION_WIN_INET) | 25 #if defined(RLZ_NETWORK_IMPLEMENTATION_WIN_INET) |
| 26 | 26 |
| 27 #include <windows.h> | 27 #include <windows.h> |
| 28 #include <wininet.h> | 28 #include <wininet.h> |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 class InternetHandle { | 32 class InternetHandle { |
| 33 public: | 33 public: |
| 34 InternetHandle(HINTERNET handle) { handle_ = handle; } | 34 InternetHandle(HINTERNET handle) { handle_ = handle; } |
| 35 ~InternetHandle() { if (handle_) InternetCloseHandle(handle_); } | 35 ~InternetHandle() { if (handle_) InternetCloseHandle(handle_); } |
| 36 operator HINTERNET() const { return handle_; } | 36 operator HINTERNET() const { return handle_; } |
| 37 bool operator!() const { return (handle_ == NULL); } | 37 bool operator!() const { return (handle_ == NULL); } |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 HINTERNET handle_; | 40 HINTERNET handle_; |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 } // namespace | 43 } // namespace |
| 44 | 44 |
| 45 #else | 45 #else |
| 46 | 46 |
| 47 #include "base/bind.h" | 47 #include "base/bind.h" |
| 48 #include "base/message_loop.h" | 48 #include "base/message_loop.h" |
| 49 #include "base/run_loop.h" | 49 #include "base/run_loop.h" |
| 50 #include "base/time.h" | 50 #include "base/time/time.h" |
| 51 #include "googleurl/src/gurl.h" | 51 #include "googleurl/src/gurl.h" |
| 52 #include "net/base/load_flags.h" | 52 #include "net/base/load_flags.h" |
| 53 #include "net/url_request/url_fetcher.h" | 53 #include "net/url_request/url_fetcher.h" |
| 54 #include "net/url_request/url_fetcher_delegate.h" | 54 #include "net/url_request/url_fetcher_delegate.h" |
| 55 #include "net/url_request/url_request_context.h" | 55 #include "net/url_request/url_request_context.h" |
| 56 #include "net/url_request/url_request_context_getter.h" | 56 #include "net/url_request/url_request_context_getter.h" |
| 57 | 57 |
| 58 #endif | 58 #endif |
| 59 | 59 |
| 60 namespace { | 60 namespace { |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 | 353 |
| 354 bool FinancialPing::ClearLastPingTime(Product product) { | 354 bool FinancialPing::ClearLastPingTime(Product product) { |
| 355 ScopedRlzValueStoreLock lock; | 355 ScopedRlzValueStoreLock lock; |
| 356 RlzValueStore* store = lock.GetStore(); | 356 RlzValueStore* store = lock.GetStore(); |
| 357 if (!store || !store->HasAccess(RlzValueStore::kWriteAccess)) | 357 if (!store || !store->HasAccess(RlzValueStore::kWriteAccess)) |
| 358 return false; | 358 return false; |
| 359 return store->ClearPingTime(product); | 359 return store->ClearPingTime(product); |
| 360 } | 360 } |
| 361 | 361 |
| 362 } // namespace | 362 } // namespace |
| OLD | NEW |