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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 net::LOAD_DO_NOT_PROMPT_FOR_LOGIN | | 290 net::LOAD_DO_NOT_PROMPT_FOR_LOGIN | |
291 net::LOAD_DO_NOT_SEND_COOKIES | | 291 net::LOAD_DO_NOT_SEND_COOKIES | |
292 net::LOAD_DO_NOT_SAVE_COOKIES); | 292 net::LOAD_DO_NOT_SAVE_COOKIES); |
293 | 293 |
294 // Ensure rlz_lib::SetURLRequestContext() has been called before sending | 294 // Ensure rlz_lib::SetURLRequestContext() has been called before sending |
295 // pings. | 295 // pings. |
296 CHECK(g_context); | 296 CHECK(g_context); |
297 fetcher->SetRequestContext(g_context); | 297 fetcher->SetRequestContext(g_context); |
298 | 298 |
299 const base::TimeDelta kTimeout = base::TimeDelta::FromMinutes(5); | 299 const base::TimeDelta kTimeout = base::TimeDelta::FromMinutes(5); |
| 300 MessageLoop::ScopedNestableTaskAllower allow_nested(MessageLoop::current()); |
300 MessageLoop::current()->PostTask( | 301 MessageLoop::current()->PostTask( |
301 FROM_HERE, | 302 FROM_HERE, |
302 base::Bind(&net::URLFetcher::Start, base::Unretained(fetcher.get()))); | 303 base::Bind(&net::URLFetcher::Start, base::Unretained(fetcher.get()))); |
303 MessageLoop::current()->PostNonNestableDelayedTask( | 304 MessageLoop::current()->PostDelayedTask( |
304 FROM_HERE, loop.QuitClosure(), kTimeout); | 305 FROM_HERE, loop.QuitClosure(), kTimeout); |
305 | 306 |
306 loop.Run(); | 307 loop.Run(); |
307 | 308 |
308 if (fetcher->GetResponseCode() != 200) | 309 if (fetcher->GetResponseCode() != 200) |
309 return false; | 310 return false; |
310 | 311 |
311 return fetcher->GetResponseAsString(response); | 312 return fetcher->GetResponseAsString(response); |
312 #endif | 313 #endif |
313 } | 314 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 | 354 |
354 bool FinancialPing::ClearLastPingTime(Product product) { | 355 bool FinancialPing::ClearLastPingTime(Product product) { |
355 ScopedRlzValueStoreLock lock; | 356 ScopedRlzValueStoreLock lock; |
356 RlzValueStore* store = lock.GetStore(); | 357 RlzValueStore* store = lock.GetStore(); |
357 if (!store || !store->HasAccess(RlzValueStore::kWriteAccess)) | 358 if (!store || !store->HasAccess(RlzValueStore::kWriteAccess)) |
358 return false; | 359 return false; |
359 return store->ClearPingTime(product); | 360 return store->ClearPingTime(product); |
360 } | 361 } |
361 | 362 |
362 } // namespace | 363 } // namespace |
OLD | NEW |