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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 case net::ERR_HTTPS_PROXY_TUNNEL_RESPONSE: | 86 case net::ERR_HTTPS_PROXY_TUNNEL_RESPONSE: |
87 case net::ERR_MANDATORY_PROXY_CONFIGURATION_FAILED: | 87 case net::ERR_MANDATORY_PROXY_CONFIGURATION_FAILED: |
88 case net::ERR_PROXY_CERTIFICATE_INVALID: | 88 case net::ERR_PROXY_CERTIFICATE_INVALID: |
89 case net::ERR_SOCKS_CONNECTION_FAILED: | 89 case net::ERR_SOCKS_CONNECTION_FAILED: |
90 case net::ERR_SOCKS_CONNECTION_HOST_UNREACHABLE: | 90 case net::ERR_SOCKS_CONNECTION_HOST_UNREACHABLE: |
91 return true; | 91 return true; |
92 } | 92 } |
93 return false; | 93 return false; |
94 } | 94 } |
95 | 95 |
96 bool IsProtobufMimeType(const content::URLFetcher* source) { | 96 bool IsProtobufMimeType(const net::URLFetcher* source) { |
97 return source->GetResponseHeaders()->HasHeaderValue( | 97 return source->GetResponseHeaders()->HasHeaderValue( |
98 "content-type", "application/x-protobuffer"); | 98 "content-type", "application/x-protobuffer"); |
99 } | 99 } |
100 | 100 |
101 const char* UserAffiliationToString(UserAffiliation affiliation) { | 101 const char* UserAffiliationToString(UserAffiliation affiliation) { |
102 switch (affiliation) { | 102 switch (affiliation) { |
103 case USER_AFFILIATION_MANAGED: | 103 case USER_AFFILIATION_MANAGED: |
104 return dm_protocol::kValueUserAffiliationManaged; | 104 return dm_protocol::kValueUserAffiliationManaged; |
105 case USER_AFFILIATION_NONE: | 105 case USER_AFFILIATION_NONE: |
106 return dm_protocol::kValueUserAffiliationNone; | 106 return dm_protocol::kValueUserAffiliationNone; |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 net::LOAD_DO_NOT_SAVE_COOKIES | | 516 net::LOAD_DO_NOT_SAVE_COOKIES | |
517 net::LOAD_DISABLE_CACHE | | 517 net::LOAD_DISABLE_CACHE | |
518 (bypass_proxy ? net::LOAD_BYPASS_PROXY : 0)); | 518 (bypass_proxy ? net::LOAD_BYPASS_PROXY : 0)); |
519 fetcher->SetRequestContext(request_context_getter_.get()); | 519 fetcher->SetRequestContext(request_context_getter_.get()); |
520 job->ConfigureRequest(fetcher); | 520 job->ConfigureRequest(fetcher); |
521 pending_jobs_[fetcher] = job; | 521 pending_jobs_[fetcher] = job; |
522 fetcher->Start(); | 522 fetcher->Start(); |
523 } | 523 } |
524 | 524 |
525 void DeviceManagementService::OnURLFetchComplete( | 525 void DeviceManagementService::OnURLFetchComplete( |
526 const content::URLFetcher* source) { | 526 const net::URLFetcher* source) { |
527 JobFetcherMap::iterator entry(pending_jobs_.find(source)); | 527 JobFetcherMap::iterator entry(pending_jobs_.find(source)); |
528 if (entry == pending_jobs_.end()) { | 528 if (entry == pending_jobs_.end()) { |
529 NOTREACHED() << "Callback from foreign URL fetcher"; | 529 NOTREACHED() << "Callback from foreign URL fetcher"; |
530 return; | 530 return; |
531 } | 531 } |
532 | 532 |
533 DeviceManagementRequestJobImpl* job = entry->second; | 533 DeviceManagementRequestJobImpl* job = entry->second; |
534 pending_jobs_.erase(entry); | 534 pending_jobs_.erase(entry); |
535 | 535 |
536 // Retry the job if it failed due to a broken proxy, by bypassing the | 536 // Retry the job if it failed due to a broken proxy, by bypassing the |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 } | 585 } |
586 } | 586 } |
587 | 587 |
588 const JobQueue::iterator elem = | 588 const JobQueue::iterator elem = |
589 std::find(queued_jobs_.begin(), queued_jobs_.end(), job); | 589 std::find(queued_jobs_.begin(), queued_jobs_.end(), job); |
590 if (elem != queued_jobs_.end()) | 590 if (elem != queued_jobs_.end()) |
591 queued_jobs_.erase(elem); | 591 queued_jobs_.erase(elem); |
592 } | 592 } |
593 | 593 |
594 } // namespace policy | 594 } // namespace policy |
OLD | NEW |