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

Side by Side Diff: chrome/browser/extensions/webstore_inline_installer.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/extensions/webstore_inline_installer.h" 5 #include "chrome/browser/extensions/webstore_inline_installer.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/extensions/crx_installer.h" 13 #include "chrome/browser/extensions/crx_installer.h"
14 #include "chrome/browser/extensions/extension_install_dialog.h" 14 #include "chrome/browser/extensions/extension_install_dialog.h"
15 #include "chrome/browser/extensions/extension_service.h" 15 #include "chrome/browser/extensions/extension_service.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/common/chrome_utility_messages.h" 17 #include "chrome/common/chrome_utility_messages.h"
18 #include "chrome/common/extensions/extension.h" 18 #include "chrome/common/extensions/extension.h"
19 #include "chrome/common/extensions/extension_constants.h" 19 #include "chrome/common/extensions/extension_constants.h"
20 #include "chrome/common/extensions/url_pattern.h" 20 #include "chrome/common/extensions/url_pattern.h"
21 #include "chrome/common/url_constants.h" 21 #include "chrome/common/url_constants.h"
22 #include "content/public/browser/web_contents.h" 22 #include "content/public/browser/web_contents.h"
23 #include "content/public/browser/utility_process_host.h" 23 #include "content/public/browser/utility_process_host.h"
24 #include "content/public/browser/utility_process_host_client.h" 24 #include "content/public/browser/utility_process_host_client.h"
25 #include "content/public/common/content_url_request_user_data.h"
25 #include "content/public/common/url_fetcher.h" 26 #include "content/public/common/url_fetcher.h"
26 #include "net/base/escape.h" 27 #include "net/base/escape.h"
27 #include "net/base/load_flags.h" 28 #include "net/base/load_flags.h"
28 #include "net/url_request/url_request_status.h" 29 #include "net/url_request/url_request_status.h"
29 30
30 using content::BrowserThread; 31 using content::BrowserThread;
31 using content::OpenURLParams; 32 using content::OpenURLParams;
32 using content::UtilityProcessHost; 33 using content::UtilityProcessHost;
33 using content::UtilityProcessHostClient; 34 using content::UtilityProcessHostClient;
34 using content::WebContents; 35 using content::WebContents;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 } 172 }
172 173
173 GURL webstore_data_url(extension_urls::GetWebstoreItemJsonDataURL(id_)); 174 GURL webstore_data_url(extension_urls::GetWebstoreItemJsonDataURL(id_));
174 175
175 webstore_data_url_fetcher_.reset(content::URLFetcher::Create( 176 webstore_data_url_fetcher_.reset(content::URLFetcher::Create(
176 webstore_data_url, content::URLFetcher::GET, this)); 177 webstore_data_url, content::URLFetcher::GET, this));
177 Profile* profile = Profile::FromBrowserContext( 178 Profile* profile = Profile::FromBrowserContext(
178 web_contents()->GetBrowserContext()); 179 web_contents()->GetBrowserContext());
179 webstore_data_url_fetcher_->SetRequestContext( 180 webstore_data_url_fetcher_->SetRequestContext(
180 profile->GetRequestContext()); 181 profile->GetRequestContext());
182 // No user data, as the request will be cookie-less.
183 webstore_data_url_fetcher_->SetContentURLRequestUserData(
184 new content::ContentURLRequestUserData());
181 // Use the requesting page as the referrer both since that is more correct 185 // Use the requesting page as the referrer both since that is more correct
182 // (it is the page that caused this request to happen) and so that we can 186 // (it is the page that caused this request to happen) and so that we can
183 // track top sites that trigger inline install requests. 187 // track top sites that trigger inline install requests.
184 webstore_data_url_fetcher_->SetReferrer(requestor_url_.spec()); 188 webstore_data_url_fetcher_->SetReferrer(requestor_url_.spec());
185 webstore_data_url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | 189 webstore_data_url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
186 net::LOAD_DO_NOT_SAVE_COOKIES | 190 net::LOAD_DO_NOT_SAVE_COOKIES |
187 net::LOAD_DISABLE_CACHE); 191 net::LOAD_DISABLE_CACHE);
188 webstore_data_url_fetcher_->Start(); 192 webstore_data_url_fetcher_->Start();
189 } 193 }
190 194
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 if (web_contents()) { 453 if (web_contents()) {
450 if (error.empty()) { 454 if (error.empty()) {
451 delegate_->OnInlineInstallSuccess(install_id_, return_route_id_); 455 delegate_->OnInlineInstallSuccess(install_id_, return_route_id_);
452 } else { 456 } else {
453 delegate_->OnInlineInstallFailure(install_id_, return_route_id_, error); 457 delegate_->OnInlineInstallFailure(install_id_, return_route_id_, error);
454 } 458 }
455 } 459 }
456 460
457 Release(); // Matches the AddRef in BeginInstall. 461 Release(); // Matches the AddRef in BeginInstall.
458 } 462 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698