| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 175 |
| 176 return true; | 176 return true; |
| 177 } | 177 } |
| 178 | 178 |
| 179 #if defined(RLZ_NETWORK_IMPLEMENTATION_CHROME_NET) | 179 #if defined(RLZ_NETWORK_IMPLEMENTATION_CHROME_NET) |
| 180 // The URLRequestContextGetter used by FinancialPing::PingServer(). | 180 // The URLRequestContextGetter used by FinancialPing::PingServer(). |
| 181 net::URLRequestContextGetter* g_context; | 181 net::URLRequestContextGetter* g_context; |
| 182 | 182 |
| 183 bool FinancialPing::SetURLRequestContext( | 183 bool FinancialPing::SetURLRequestContext( |
| 184 net::URLRequestContextGetter* context) { | 184 net::URLRequestContextGetter* context) { |
| 185 ScopedRlzValueStoreLock lock; | |
| 186 RlzValueStore* store = lock.GetStore(); | |
| 187 if (!store) | |
| 188 return false; | |
| 189 | |
| 190 g_context = context; | 185 g_context = context; |
| 191 return true; | 186 return true; |
| 192 } | 187 } |
| 193 | 188 |
| 194 namespace { | 189 namespace { |
| 195 | 190 |
| 196 class FinancialPingUrlFetcherDelegate : public net::URLFetcherDelegate { | 191 class FinancialPingUrlFetcherDelegate : public net::URLFetcherDelegate { |
| 197 public: | 192 public: |
| 198 FinancialPingUrlFetcherDelegate(const base::Closure& callback) | 193 FinancialPingUrlFetcherDelegate(const base::Closure& callback) |
| 199 : callback_(callback) { | 194 : callback_(callback) { |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 | 349 |
| 355 bool FinancialPing::ClearLastPingTime(Product product) { | 350 bool FinancialPing::ClearLastPingTime(Product product) { |
| 356 ScopedRlzValueStoreLock lock; | 351 ScopedRlzValueStoreLock lock; |
| 357 RlzValueStore* store = lock.GetStore(); | 352 RlzValueStore* store = lock.GetStore(); |
| 358 if (!store || !store->HasAccess(RlzValueStore::kWriteAccess)) | 353 if (!store || !store->HasAccess(RlzValueStore::kWriteAccess)) |
| 359 return false; | 354 return false; |
| 360 return store->ClearPingTime(product); | 355 return store->ClearPingTime(product); |
| 361 } | 356 } |
| 362 | 357 |
| 363 } // namespace | 358 } // namespace |
| OLD | NEW |