Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(472)

Side by Side Diff: chrome/browser/policy/device_management_service.cc

Issue 10412050: Change most content::URLFetcher references to net::URLFetcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix ChromeOS, address comments Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 // Handles the URL request response. 275 // Handles the URL request response.
276 void HandleResponse(const net::URLRequestStatus& status, 276 void HandleResponse(const net::URLRequestStatus& status,
277 int response_code, 277 int response_code,
278 const net::ResponseCookies& cookies, 278 const net::ResponseCookies& cookies,
279 const std::string& data); 279 const std::string& data);
280 280
281 // Gets the URL to contact. 281 // Gets the URL to contact.
282 GURL GetURL(const std::string& server_url); 282 GURL GetURL(const std::string& server_url);
283 283
284 // Configures the fetcher, setting up payload and headers. 284 // Configures the fetcher, setting up payload and headers.
285 void ConfigureRequest(content::URLFetcher* fetcher); 285 void ConfigureRequest(net::URLFetcher* fetcher);
286 286
287 protected: 287 protected:
288 // DeviceManagementRequestJob: 288 // DeviceManagementRequestJob:
289 virtual void Run() OVERRIDE; 289 virtual void Run() OVERRIDE;
290 290
291 private: 291 private:
292 // Invokes the callback with the given error code. 292 // Invokes the callback with the given error code.
293 void ReportError(DeviceManagementStatus code); 293 void ReportError(DeviceManagementStatus code);
294 294
295 // Pointer to the service this job is associated with. 295 // Pointer to the service this job is associated with.
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 if (entry != query_params_.begin()) 386 if (entry != query_params_.begin())
387 result += '&'; 387 result += '&';
388 result += net::EscapeQueryParamValue(entry->first, true); 388 result += net::EscapeQueryParamValue(entry->first, true);
389 result += '='; 389 result += '=';
390 result += net::EscapeQueryParamValue(entry->second, true); 390 result += net::EscapeQueryParamValue(entry->second, true);
391 } 391 }
392 return GURL(result); 392 return GURL(result);
393 } 393 }
394 394
395 void DeviceManagementRequestJobImpl::ConfigureRequest( 395 void DeviceManagementRequestJobImpl::ConfigureRequest(
396 content::URLFetcher* fetcher) { 396 net::URLFetcher* fetcher) {
397 std::string payload; 397 std::string payload;
398 CHECK(request_.SerializeToString(&payload)); 398 CHECK(request_.SerializeToString(&payload));
399 fetcher->SetUploadData(kPostContentType, payload); 399 fetcher->SetUploadData(kPostContentType, payload);
400 std::string extra_headers; 400 std::string extra_headers;
401 if (!gaia_token_.empty()) 401 if (!gaia_token_.empty())
402 extra_headers += kServiceTokenAuthHeader + gaia_token_ + "\n"; 402 extra_headers += kServiceTokenAuthHeader + gaia_token_ + "\n";
403 if (!dm_token_.empty()) 403 if (!dm_token_.empty())
404 extra_headers += kDMTokenAuthHeader + dm_token_ + "\n"; 404 extra_headers += kDMTokenAuthHeader + dm_token_ + "\n";
405 fetcher->SetExtraRequestHeaders(extra_headers); 405 fetcher->SetExtraRequestHeaders(extra_headers);
406 } 406 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 content::URLFetcher* fetcher = content::URLFetcher::Create( 513 net::URLFetcher* fetcher = content::URLFetcher::Create(
514 0, job->GetURL(server_url_), content::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 }
524 524
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « chrome/browser/net/sdch_dictionary_fetcher.cc ('k') | chrome/browser/policy/testing_policy_url_fetcher_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698