| 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 #include "chrome/browser/policy/device_management_service.h" | 5 #include "chrome/browser/policy/device_management_service.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 | 505 |
| 506 void DeviceManagementService::StartJob(DeviceManagementRequestJobImpl* job, | 506 void DeviceManagementService::StartJob(DeviceManagementRequestJobImpl* job, |
| 507 bool bypass_proxy) { | 507 bool bypass_proxy) { |
| 508 net::URLFetcher* fetcher = net::URLFetcher::Create( | 508 net::URLFetcher* fetcher = net::URLFetcher::Create( |
| 509 0, job->GetURL(server_url_), net::URLFetcher::POST, this); | 509 0, job->GetURL(server_url_), net::URLFetcher::POST, this); |
| 510 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | | 510 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
| 511 net::LOAD_DO_NOT_SAVE_COOKIES | | 511 net::LOAD_DO_NOT_SAVE_COOKIES | |
| 512 net::LOAD_DISABLE_CACHE | | 512 net::LOAD_DISABLE_CACHE | |
| 513 (bypass_proxy ? net::LOAD_BYPASS_PROXY : 0)); | 513 (bypass_proxy ? net::LOAD_BYPASS_PROXY : 0)); |
| 514 fetcher->SetRequestContext(request_context_getter_.get()); | 514 fetcher->SetRequestContext(request_context_getter_.get()); |
| 515 // Early device policy fetches on ChromeOS and Auto-Enrollment checks are |
| 516 // often interrupted during ChromeOS startup when network change notifications |
| 517 // are sent. Allowing the fetcher to retry once after that is enough to |
| 518 // recover; allow it to retry up to 3 times just in case. |
| 519 // http://crosbug.com/16114 |
| 520 fetcher->SetAutomaticallyRetryOnNetworkChanges(3); |
| 515 job->ConfigureRequest(fetcher); | 521 job->ConfigureRequest(fetcher); |
| 516 pending_jobs_[fetcher] = job; | 522 pending_jobs_[fetcher] = job; |
| 517 fetcher->Start(); | 523 fetcher->Start(); |
| 518 } | 524 } |
| 519 | 525 |
| 520 void DeviceManagementService::OnURLFetchComplete( | 526 void DeviceManagementService::OnURLFetchComplete( |
| 521 const net::URLFetcher* source) { | 527 const net::URLFetcher* source) { |
| 522 JobFetcherMap::iterator entry(pending_jobs_.find(source)); | 528 JobFetcherMap::iterator entry(pending_jobs_.find(source)); |
| 523 if (entry == pending_jobs_.end()) { | 529 if (entry == pending_jobs_.end()) { |
| 524 NOTREACHED() << "Callback from foreign URL fetcher"; | 530 NOTREACHED() << "Callback from foreign URL fetcher"; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 } | 586 } |
| 581 } | 587 } |
| 582 | 588 |
| 583 const JobQueue::iterator elem = | 589 const JobQueue::iterator elem = |
| 584 std::find(queued_jobs_.begin(), queued_jobs_.end(), job); | 590 std::find(queued_jobs_.begin(), queued_jobs_.end(), job); |
| 585 if (elem != queued_jobs_.end()) | 591 if (elem != queued_jobs_.end()) |
| 586 queued_jobs_.erase(elem); | 592 queued_jobs_.erase(elem); |
| 587 } | 593 } |
| 588 | 594 |
| 589 } // namespace policy | 595 } // namespace policy |
| OLD | NEW |