| 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 "components/policy/core/common/cloud/device_management_service.h" | 5 #include "components/policy/core/common/cloud/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" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/message_loop/message_loop_proxy.h" | 12 #include "base/message_loop/message_loop_proxy.h" |
| 13 #include "base/profiler/scoped_profile.h" |
| 13 #include "net/base/escape.h" | 14 #include "net/base/escape.h" |
| 14 #include "net/base/load_flags.h" | 15 #include "net/base/load_flags.h" |
| 15 #include "net/base/net_errors.h" | 16 #include "net/base/net_errors.h" |
| 16 #include "net/http/http_response_headers.h" | 17 #include "net/http/http_response_headers.h" |
| 17 #include "net/url_request/url_fetcher.h" | 18 #include "net/url_request/url_fetcher.h" |
| 18 #include "net/url_request/url_request_context_getter.h" | 19 #include "net/url_request/url_request_context_getter.h" |
| 19 #include "net/url_request/url_request_status.h" | 20 #include "net/url_request/url_request_status.h" |
| 20 #include "url/gurl.h" | 21 #include "url/gurl.h" |
| 21 | 22 |
| 22 namespace em = enterprise_management; | 23 namespace em = enterprise_management; |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 pending_jobs_[fetcher] = job; | 474 pending_jobs_[fetcher] = job; |
| 474 fetcher->Start(); | 475 fetcher->Start(); |
| 475 } | 476 } |
| 476 | 477 |
| 477 std::string DeviceManagementService::GetServerUrl() { | 478 std::string DeviceManagementService::GetServerUrl() { |
| 478 return configuration_->GetServerUrl(); | 479 return configuration_->GetServerUrl(); |
| 479 } | 480 } |
| 480 | 481 |
| 481 void DeviceManagementService::OnURLFetchComplete( | 482 void DeviceManagementService::OnURLFetchComplete( |
| 482 const net::URLFetcher* source) { | 483 const net::URLFetcher* source) { |
| 484 // TODO(vadimt): Remove ScopedProfile below once crbug.com/422577 is fixed. |
| 485 tracked_objects::ScopedProfile tracking_profile( |
| 486 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 487 "422577 DeviceManagementService::OnURLFetchComplete")); |
| 488 |
| 483 JobFetcherMap::iterator entry(pending_jobs_.find(source)); | 489 JobFetcherMap::iterator entry(pending_jobs_.find(source)); |
| 484 if (entry == pending_jobs_.end()) { | 490 if (entry == pending_jobs_.end()) { |
| 485 NOTREACHED() << "Callback from foreign URL fetcher"; | 491 NOTREACHED() << "Callback from foreign URL fetcher"; |
| 486 return; | 492 return; |
| 487 } | 493 } |
| 488 | 494 |
| 489 DeviceManagementRequestJobImpl* job = entry->second; | 495 DeviceManagementRequestJobImpl* job = entry->second; |
| 490 pending_jobs_.erase(entry); | 496 pending_jobs_.erase(entry); |
| 491 | 497 |
| 492 if (job->ShouldRetry(source)) { | 498 if (job->ShouldRetry(source)) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 520 } | 526 } |
| 521 } | 527 } |
| 522 | 528 |
| 523 const JobQueue::iterator elem = | 529 const JobQueue::iterator elem = |
| 524 std::find(queued_jobs_.begin(), queued_jobs_.end(), job); | 530 std::find(queued_jobs_.begin(), queued_jobs_.end(), job); |
| 525 if (elem != queued_jobs_.end()) | 531 if (elem != queued_jobs_.end()) |
| 526 queued_jobs_.erase(elem); | 532 queued_jobs_.erase(elem); |
| 527 } | 533 } |
| 528 | 534 |
| 529 } // namespace policy | 535 } // namespace policy |
| OLD | NEW |