OLD | NEW |
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_install_helper.h" | 5 #include "chrome/browser/extensions/webstore_install_helper.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chrome/common/chrome_utility_messages.h" | 11 #include "chrome/common/chrome_utility_messages.h" |
12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
13 #include "content/public/browser/utility_process_host.h" | 13 #include "content/public/browser/utility_process_host.h" |
| 14 #include "content/public/common/content_url_request_user_data.h" |
14 #include "content/public/common/url_fetcher.h" | 15 #include "content/public/common/url_fetcher.h" |
15 #include "net/base/load_flags.h" | 16 #include "net/base/load_flags.h" |
16 #include "net/url_request/url_request_context_getter.h" | 17 #include "net/url_request/url_request_context_getter.h" |
17 #include "net/url_request/url_request_status.h" | 18 #include "net/url_request/url_request_status.h" |
18 | 19 |
19 using content::BrowserThread; | 20 using content::BrowserThread; |
20 using content::UtilityProcessHost; | 21 using content::UtilityProcessHost; |
21 | 22 |
22 namespace { | 23 namespace { |
23 | 24 |
(...skipping 30 matching lines...) Expand all Loading... |
54 BrowserThread::PostTask( | 55 BrowserThread::PostTask( |
55 BrowserThread::IO, | 56 BrowserThread::IO, |
56 FROM_HERE, | 57 FROM_HERE, |
57 base::Bind(&WebstoreInstallHelper::StartWorkOnIOThread, this)); | 58 base::Bind(&WebstoreInstallHelper::StartWorkOnIOThread, this)); |
58 | 59 |
59 if (!icon_url_.is_empty()) { | 60 if (!icon_url_.is_empty()) { |
60 CHECK(context_getter_); | 61 CHECK(context_getter_); |
61 url_fetcher_.reset(content::URLFetcher::Create( | 62 url_fetcher_.reset(content::URLFetcher::Create( |
62 icon_url_, content::URLFetcher::GET, this)); | 63 icon_url_, content::URLFetcher::GET, this)); |
63 url_fetcher_->SetRequestContext(context_getter_); | 64 url_fetcher_->SetRequestContext(context_getter_); |
| 65 // TODO(jochen): Do cookie audit. |
| 66 url_fetcher_->SetContentURLRequestUserData( |
| 67 new content::ContentURLRequestUserData()); |
64 url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES); | 68 url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES); |
65 | 69 |
66 url_fetcher_->Start(); | 70 url_fetcher_->Start(); |
67 // We'll get called back in OnURLFetchComplete. | 71 // We'll get called back in OnURLFetchComplete. |
68 } | 72 } |
69 } | 73 } |
70 | 74 |
71 void WebstoreInstallHelper::StartWorkOnIOThread() { | 75 void WebstoreInstallHelper::StartWorkOnIOThread() { |
72 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 76 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
73 utility_host_ = | 77 utility_host_ = |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 base::Bind(&WebstoreInstallHelper::ReportResultFromUIThread, this)); | 191 base::Bind(&WebstoreInstallHelper::ReportResultFromUIThread, this)); |
188 } | 192 } |
189 | 193 |
190 void WebstoreInstallHelper::ReportResultFromUIThread() { | 194 void WebstoreInstallHelper::ReportResultFromUIThread() { |
191 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 195 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
192 if (error_.empty() && parsed_manifest_.get()) | 196 if (error_.empty() && parsed_manifest_.get()) |
193 delegate_->OnWebstoreParseSuccess(id_, icon_, parsed_manifest_.release()); | 197 delegate_->OnWebstoreParseSuccess(id_, icon_, parsed_manifest_.release()); |
194 else | 198 else |
195 delegate_->OnWebstoreParseFailure(id_, parse_error_, error_); | 199 delegate_->OnWebstoreParseFailure(id_, parse_error_, error_); |
196 } | 200 } |
OLD | NEW |