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

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

Issue 9572001: Do cookie checks in NetworkDelegate instead of the URLRequest::Delegate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clang fix Created 8 years, 9 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"
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/content_url_request_user_data.h"
20 #include "content/public/common/url_fetcher.h" 21 #include "content/public/common/url_fetcher.h"
21 #include "googleurl/src/gurl.h" 22 #include "googleurl/src/gurl.h"
22 #include "net/base/cookie_monster.h" 23 #include "net/base/cookie_monster.h"
23 #include "net/base/escape.h" 24 #include "net/base/escape.h"
24 #include "net/base/host_resolver.h" 25 #include "net/base/host_resolver.h"
25 #include "net/base/load_flags.h" 26 #include "net/base/load_flags.h"
26 #include "net/base/net_errors.h" 27 #include "net/base/net_errors.h"
27 #include "net/base/ssl_config_service_defaults.h" 28 #include "net/base/ssl_config_service_defaults.h"
28 #include "net/http/http_network_layer.h" 29 #include "net/http/http_network_layer.h"
29 #include "net/http/http_response_headers.h" 30 #include "net/http/http_response_headers.h"
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 508
508 void DeviceManagementService::StartJob(DeviceManagementRequestJobImpl* job, 509 void DeviceManagementService::StartJob(DeviceManagementRequestJobImpl* job,
509 bool bypass_proxy) { 510 bool bypass_proxy) {
510 content::URLFetcher* fetcher = content::URLFetcher::Create( 511 content::URLFetcher* fetcher = content::URLFetcher::Create(
511 0, job->GetURL(server_url_), content::URLFetcher::POST, this); 512 0, job->GetURL(server_url_), content::URLFetcher::POST, this);
512 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | 513 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
513 net::LOAD_DO_NOT_SAVE_COOKIES | 514 net::LOAD_DO_NOT_SAVE_COOKIES |
514 net::LOAD_DISABLE_CACHE | 515 net::LOAD_DISABLE_CACHE |
515 (bypass_proxy ? net::LOAD_BYPASS_PROXY : 0)); 516 (bypass_proxy ? net::LOAD_BYPASS_PROXY : 0));
516 fetcher->SetRequestContext(request_context_getter_.get()); 517 fetcher->SetRequestContext(request_context_getter_.get());
518 // No user data, as the request will be cookie-less.
519 fetcher->SetContentURLRequestUserData(
520 new content::ContentURLRequestUserData());
517 job->ConfigureRequest(fetcher); 521 job->ConfigureRequest(fetcher);
518 pending_jobs_[fetcher] = job; 522 pending_jobs_[fetcher] = job;
519 fetcher->Start(); 523 fetcher->Start();
520 } 524 }
521 525
522 void DeviceManagementService::OnURLFetchComplete( 526 void DeviceManagementService::OnURLFetchComplete(
523 const content::URLFetcher* source) { 527 const content::URLFetcher* source) {
524 JobFetcherMap::iterator entry(pending_jobs_.find(source)); 528 JobFetcherMap::iterator entry(pending_jobs_.find(source));
525 if (entry == pending_jobs_.end()) { 529 if (entry == pending_jobs_.end()) {
526 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
582 } 586 }
583 } 587 }
584 588
585 const JobQueue::iterator elem = 589 const JobQueue::iterator elem =
586 std::find(queued_jobs_.begin(), queued_jobs_.end(), job); 590 std::find(queued_jobs_.begin(), queued_jobs_.end(), job);
587 if (elem != queued_jobs_.end()) 591 if (elem != queued_jobs_.end())
588 queued_jobs_.erase(elem); 592 queued_jobs_.erase(elem);
589 } 593 }
590 594
591 } // namespace policy 595 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698