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" |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 | 245 |
246 // Check the response status. | 246 // Check the response status. |
247 DWORD status; | 247 DWORD status; |
248 DWORD status_size = sizeof(status); | 248 DWORD status_size = sizeof(status); |
249 if (!HttpQueryInfo(http_handle, HTTP_QUERY_STATUS_CODE | | 249 if (!HttpQueryInfo(http_handle, HTTP_QUERY_STATUS_CODE | |
250 HTTP_QUERY_FLAG_NUMBER, &status, &status_size, NULL) || | 250 HTTP_QUERY_FLAG_NUMBER, &status, &status_size, NULL) || |
251 200 != status) | 251 200 != status) |
252 return false; | 252 return false; |
253 | 253 |
254 // Get the response text. | 254 // Get the response text. |
255 scoped_array<char> buffer(new char[kMaxPingResponseLength]); | 255 scoped_ptr<char[]> buffer(new char[kMaxPingResponseLength]); |
256 if (buffer.get() == NULL) | 256 if (buffer.get() == NULL) |
257 return false; | 257 return false; |
258 | 258 |
259 DWORD bytes_read = 0; | 259 DWORD bytes_read = 0; |
260 while (InternetReadFile(http_handle, buffer.get(), kMaxPingResponseLength, | 260 while (InternetReadFile(http_handle, buffer.get(), kMaxPingResponseLength, |
261 &bytes_read) && bytes_read > 0) { | 261 &bytes_read) && bytes_read > 0) { |
262 response->append(buffer.get(), bytes_read); | 262 response->append(buffer.get(), bytes_read); |
263 bytes_read = 0; | 263 bytes_read = 0; |
264 }; | 264 }; |
265 | 265 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 | 349 |
350 bool FinancialPing::ClearLastPingTime(Product product) { | 350 bool FinancialPing::ClearLastPingTime(Product product) { |
351 ScopedRlzValueStoreLock lock; | 351 ScopedRlzValueStoreLock lock; |
352 RlzValueStore* store = lock.GetStore(); | 352 RlzValueStore* store = lock.GetStore(); |
353 if (!store || !store->HasAccess(RlzValueStore::kWriteAccess)) | 353 if (!store || !store->HasAccess(RlzValueStore::kWriteAccess)) |
354 return false; | 354 return false; |
355 return store->ClearPingTime(product); | 355 return store->ClearPingTime(product); |
356 } | 356 } |
357 | 357 |
358 } // namespace | 358 } // namespace |
OLD | NEW |