Index: chrome/browser/search_engines/template_url_fetcher.cc |
diff --git a/chrome/browser/search_engines/template_url_fetcher.cc b/chrome/browser/search_engines/template_url_fetcher.cc |
index d943699f54eedbd4bbfb1e5225eccb8ea3f7e269..707bcc9527bb02a8f91f125e45fb8289963316c2 100644 |
--- a/chrome/browser/search_engines/template_url_fetcher.cc |
+++ b/chrome/browser/search_engines/template_url_fetcher.cc |
@@ -15,9 +15,13 @@ |
#include "chrome/browser/search_engines/template_url_service_factory.h" |
#include "chrome/browser/search_engines/template_url_parser.h" |
#include "chrome/common/chrome_notification_types.h" |
+#include "content/browser/renderer_host/render_view_host.h" |
#include "content/public/browser/notification_observer.h" |
#include "content/public/browser/notification_registrar.h" |
#include "content/public/browser/notification_source.h" |
+#include "content/public/browser/render_process_host.h" |
+#include "content/public/browser/web_contents.h" |
+#include "content/public/common/content_url_request_user_data.h" |
#include "content/public/common/url_fetcher.h" |
#include "content/public/common/url_fetcher_delegate.h" |
#include "net/base/load_flags.h" |
@@ -33,6 +37,7 @@ class TemplateURLFetcher::RequestDelegate |
const string16& keyword, |
const GURL& osdd_url, |
const GURL& favicon_url, |
+ content::WebContents* web_contents, |
TemplateURLFetcherCallbacks* callbacks, |
ProviderType provider_type); |
@@ -78,6 +83,7 @@ TemplateURLFetcher::RequestDelegate::RequestDelegate( |
const string16& keyword, |
const GURL& osdd_url, |
const GURL& favicon_url, |
+ content::WebContents* web_contents, |
TemplateURLFetcherCallbacks* callbacks, |
ProviderType provider_type) |
: ALLOW_THIS_IN_INITIALIZER_LIST(url_fetcher_(content::URLFetcher::Create( |
@@ -101,7 +107,17 @@ TemplateURLFetcher::RequestDelegate::RequestDelegate( |
} |
url_fetcher_->SetRequestContext(fetcher->profile()->GetRequestContext()); |
- url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES); |
+ // Can be NULL during tests. |
+ if (web_contents) { |
+ url_fetcher_->SetContentURLRequestUserData( |
+ new content::ContentURLRequestUserData( |
+ web_contents->GetRenderProcessHost()->GetID(), |
+ web_contents->GetRenderViewHost()->routing_id())); |
+ } else { |
+ url_fetcher_->SetContentURLRequestUserData( |
+ new content::ContentURLRequestUserData()); |
+ } |
+ |
url_fetcher_->Start(); |
} |
@@ -240,6 +256,7 @@ void TemplateURLFetcher::ScheduleDownload( |
const string16& keyword, |
const GURL& osdd_url, |
const GURL& favicon_url, |
+ content::WebContents* web_contents, |
TemplateURLFetcherCallbacks* callbacks, |
ProviderType provider_type) { |
DCHECK(osdd_url.is_valid()); |
@@ -281,7 +298,7 @@ void TemplateURLFetcher::ScheduleDownload( |
} |
requests_->push_back( |
- new RequestDelegate(this, keyword, osdd_url, favicon_url, |
+ new RequestDelegate(this, keyword, osdd_url, favicon_url, web_contents, |
owned_callbacks.release(), provider_type)); |
} |