| 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" |
| 11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 12 #include "base/message_loop_proxy.h" | 12 #include "base/message_loop_proxy.h" |
| 13 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
| 14 #include "base/sys_info.h" | 14 #include "base/sys_info.h" |
| 15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
| 16 #include "chrome/browser/net/chrome_net_log.h" | 16 #include "chrome/browser/net/chrome_net_log.h" |
| 17 #include "chrome/common/chrome_version_info.h" | 17 #include "chrome/common/chrome_version_info.h" |
| 18 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
| 19 #include "content/public/common/content_client.h" | 19 #include "content/public/common/content_client.h" |
| 20 #include "content/public/common/url_fetcher.h" | |
| 21 #include "googleurl/src/gurl.h" | 20 #include "googleurl/src/gurl.h" |
| 22 #include "net/base/escape.h" | 21 #include "net/base/escape.h" |
| 23 #include "net/base/host_resolver.h" | 22 #include "net/base/host_resolver.h" |
| 24 #include "net/base/load_flags.h" | 23 #include "net/base/load_flags.h" |
| 25 #include "net/base/net_errors.h" | 24 #include "net/base/net_errors.h" |
| 26 #include "net/base/ssl_config_service_defaults.h" | 25 #include "net/base/ssl_config_service_defaults.h" |
| 27 #include "net/cookies/cookie_monster.h" | 26 #include "net/cookies/cookie_monster.h" |
| 28 #include "net/http/http_network_layer.h" | 27 #include "net/http/http_network_layer.h" |
| 29 #include "net/http/http_response_headers.h" | 28 #include "net/http/http_response_headers.h" |
| 30 #include "net/proxy/proxy_service.h" | 29 #include "net/proxy/proxy_service.h" |
| 30 #include "net/url_request/url_fetcher.h" |
| 31 #include "net/url_request/url_request_context.h" | 31 #include "net/url_request/url_request_context.h" |
| 32 #include "net/url_request/url_request_context_getter.h" | 32 #include "net/url_request/url_request_context_getter.h" |
| 33 #include "net/url_request/url_request_status.h" | 33 #include "net/url_request/url_request_status.h" |
| 34 | 34 |
| 35 #if defined(OS_CHROMEOS) | 35 #if defined(OS_CHROMEOS) |
| 36 #include "chrome/browser/chromeos/system/statistics_provider.h" | 36 #include "chrome/browser/chromeos/system/statistics_provider.h" |
| 37 #endif | 37 #endif |
| 38 | 38 |
| 39 using content::BrowserThread; | 39 using content::BrowserThread; |
| 40 | 40 |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 | 503 |
| 504 DeviceManagementService::DeviceManagementService( | 504 DeviceManagementService::DeviceManagementService( |
| 505 const std::string& server_url) | 505 const std::string& server_url) |
| 506 : server_url_(server_url), | 506 : server_url_(server_url), |
| 507 initialized_(false), | 507 initialized_(false), |
| 508 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { | 508 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { |
| 509 } | 509 } |
| 510 | 510 |
| 511 void DeviceManagementService::StartJob(DeviceManagementRequestJobImpl* job, | 511 void DeviceManagementService::StartJob(DeviceManagementRequestJobImpl* job, |
| 512 bool bypass_proxy) { | 512 bool bypass_proxy) { |
| 513 net::URLFetcher* fetcher = content::URLFetcher::Create( | 513 net::URLFetcher* fetcher = net::URLFetcher::Create( |
| 514 0, job->GetURL(server_url_), net::URLFetcher::POST, this); | 514 0, job->GetURL(server_url_), net::URLFetcher::POST, this); |
| 515 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | | 515 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
| 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 } |
| (...skipping 61 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 |