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

Side by Side Diff: chrome/common/net/url_fetcher.cc

Issue 6308009: If user had consented for metrics reporting, send speech input request origin to the server. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 11 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
« no previous file with comments | « chrome/common/net/url_fetcher.h ('k') | chrome/common/render_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/common/net/url_fetcher.h" 5 #include "chrome/common/net/url_fetcher.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 scoped_refptr<net::IOBuffer> buffer_; 120 scoped_refptr<net::IOBuffer> buffer_;
121 // Read buffer 121 // Read buffer
122 scoped_refptr<URLRequestContextGetter> request_context_getter_; 122 scoped_refptr<URLRequestContextGetter> request_context_getter_;
123 // Cookie/cache info for the request 123 // Cookie/cache info for the request
124 ResponseCookies cookies_; // Response cookies 124 ResponseCookies cookies_; // Response cookies
125 net::HttpRequestHeaders extra_request_headers_; 125 net::HttpRequestHeaders extra_request_headers_;
126 scoped_refptr<net::HttpResponseHeaders> response_headers_; 126 scoped_refptr<net::HttpResponseHeaders> response_headers_;
127 127
128 std::string upload_content_; // HTTP POST payload 128 std::string upload_content_; // HTTP POST payload
129 std::string upload_content_type_; // MIME type of POST payload 129 std::string upload_content_type_; // MIME type of POST payload
130 std::string referrer_; // HTTP Referer header value
130 131
131 // Used to determine how long to wait before making a request or doing a 132 // Used to determine how long to wait before making a request or doing a
132 // retry. 133 // retry.
133 // Both of them can only be accessed on the IO thread. 134 // Both of them can only be accessed on the IO thread.
134 // We need not only the throttler entry for |original_URL|, but also the one 135 // We need not only the throttler entry for |original_URL|, but also the one
135 // for |url|. For example, consider the case that URL A redirects to URL B, 136 // for |url|. For example, consider the case that URL A redirects to URL B,
136 // for which the server returns a 500 response. In this case, the exponential 137 // for which the server returns a 500 response. In this case, the exponential
137 // back-off release time of URL A won't increase. If we retry without 138 // back-off release time of URL A won't increase. If we retry without
138 // considering the back-off constraint of URL B, we may send out too many 139 // considering the back-off constraint of URL B, we may send out too many
139 // requests for URL A in a short period of time. 140 // requests for URL A in a short period of time.
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 DCHECK(!request_.get()); 330 DCHECK(!request_.get());
330 331
331 g_registry.Get().AddURLFetcherCore(this); 332 g_registry.Get().AddURLFetcherCore(this);
332 request_.reset(new net::URLRequest(original_url_, this)); 333 request_.reset(new net::URLRequest(original_url_, this));
333 int flags = request_->load_flags() | load_flags_; 334 int flags = request_->load_flags() | load_flags_;
334 if (!g_interception_enabled) { 335 if (!g_interception_enabled) {
335 flags = flags | net::LOAD_DISABLE_INTERCEPT; 336 flags = flags | net::LOAD_DISABLE_INTERCEPT;
336 } 337 }
337 request_->set_load_flags(flags); 338 request_->set_load_flags(flags);
338 request_->set_context(request_context_getter_->GetURLRequestContext()); 339 request_->set_context(request_context_getter_->GetURLRequestContext());
340 request_->set_referrer(referrer_);
339 341
340 switch (request_type_) { 342 switch (request_type_) {
341 case GET: 343 case GET:
342 break; 344 break;
343 345
344 case POST: 346 case POST:
345 DCHECK(!upload_content_.empty()); 347 DCHECK(!upload_content_.empty());
346 DCHECK(!upload_content_type_.empty()); 348 DCHECK(!upload_content_type_.empty());
347 349
348 request_->set_method("POST"); 350 request_->set_method("POST");
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 void URLFetcher::set_upload_data(const std::string& upload_content_type, 476 void URLFetcher::set_upload_data(const std::string& upload_content_type,
475 const std::string& upload_content) { 477 const std::string& upload_content) {
476 core_->upload_content_type_ = upload_content_type; 478 core_->upload_content_type_ = upload_content_type;
477 core_->upload_content_ = upload_content; 479 core_->upload_content_ = upload_content;
478 } 480 }
479 481
480 const std::string& URLFetcher::upload_data() const { 482 const std::string& URLFetcher::upload_data() const {
481 return core_->upload_content_; 483 return core_->upload_content_;
482 } 484 }
483 485
486 void URLFetcher::set_referrer(const std::string& referrer) {
487 core_->referrer_ = referrer;
488 }
489
484 void URLFetcher::set_load_flags(int load_flags) { 490 void URLFetcher::set_load_flags(int load_flags) {
485 core_->load_flags_ = load_flags; 491 core_->load_flags_ = load_flags;
486 } 492 }
487 493
488 int URLFetcher::load_flags() const { 494 int URLFetcher::load_flags() const {
489 return core_->load_flags_; 495 return core_->load_flags_;
490 } 496 }
491 497
492 void URLFetcher::set_extra_request_headers( 498 void URLFetcher::set_extra_request_headers(
493 const std::string& extra_request_headers) { 499 const std::string& extra_request_headers) {
(...skipping 27 matching lines...) Expand all
521 } 527 }
522 528
523 // static 529 // static
524 void URLFetcher::CancelAll() { 530 void URLFetcher::CancelAll() {
525 Core::CancelAll(); 531 Core::CancelAll();
526 } 532 }
527 533
528 URLFetcher::Delegate* URLFetcher::delegate() const { 534 URLFetcher::Delegate* URLFetcher::delegate() const {
529 return core_->delegate(); 535 return core_->delegate();
530 } 536 }
OLDNEW
« no previous file with comments | « chrome/common/net/url_fetcher.h ('k') | chrome/common/render_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698