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/url_fetcher.h" | 14 #include "content/public/common/url_fetcher.h" |
| 15 #include "net/base/load_flags.h" |
15 #include "net/url_request/url_request_context_getter.h" | 16 #include "net/url_request/url_request_context_getter.h" |
16 #include "net/url_request/url_request_status.h" | 17 #include "net/url_request/url_request_status.h" |
17 | 18 |
18 using content::BrowserThread; | 19 using content::BrowserThread; |
19 using content::UtilityProcessHost; | 20 using content::UtilityProcessHost; |
20 | 21 |
21 namespace { | 22 namespace { |
22 | 23 |
23 const char kImageDecodeError[] = "Image decode failed"; | 24 const char kImageDecodeError[] = "Image decode failed"; |
24 | 25 |
(...skipping 28 matching lines...) Expand all Loading... |
53 BrowserThread::PostTask( | 54 BrowserThread::PostTask( |
54 BrowserThread::IO, | 55 BrowserThread::IO, |
55 FROM_HERE, | 56 FROM_HERE, |
56 base::Bind(&WebstoreInstallHelper::StartWorkOnIOThread, this)); | 57 base::Bind(&WebstoreInstallHelper::StartWorkOnIOThread, this)); |
57 | 58 |
58 if (!icon_url_.is_empty()) { | 59 if (!icon_url_.is_empty()) { |
59 CHECK(context_getter_); | 60 CHECK(context_getter_); |
60 url_fetcher_.reset(content::URLFetcher::Create( | 61 url_fetcher_.reset(content::URLFetcher::Create( |
61 icon_url_, content::URLFetcher::GET, this)); | 62 icon_url_, content::URLFetcher::GET, this)); |
62 url_fetcher_->SetRequestContext(context_getter_); | 63 url_fetcher_->SetRequestContext(context_getter_); |
| 64 url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES); |
63 | 65 |
64 url_fetcher_->Start(); | 66 url_fetcher_->Start(); |
65 // We'll get called back in OnURLFetchComplete. | 67 // We'll get called back in OnURLFetchComplete. |
66 } | 68 } |
67 } | 69 } |
68 | 70 |
69 void WebstoreInstallHelper::StartWorkOnIOThread() { | 71 void WebstoreInstallHelper::StartWorkOnIOThread() { |
70 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 72 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
71 utility_host_ = | 73 utility_host_ = |
72 UtilityProcessHost::Create(this, BrowserThread::IO)->AsWeakPtr(); | 74 UtilityProcessHost::Create(this, BrowserThread::IO)->AsWeakPtr(); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 base::Bind(&WebstoreInstallHelper::ReportResultFromUIThread, this)); | 187 base::Bind(&WebstoreInstallHelper::ReportResultFromUIThread, this)); |
186 } | 188 } |
187 | 189 |
188 void WebstoreInstallHelper::ReportResultFromUIThread() { | 190 void WebstoreInstallHelper::ReportResultFromUIThread() { |
189 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 191 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
190 if (error_.empty() && parsed_manifest_.get()) | 192 if (error_.empty() && parsed_manifest_.get()) |
191 delegate_->OnWebstoreParseSuccess(id_, icon_, parsed_manifest_.release()); | 193 delegate_->OnWebstoreParseSuccess(id_, icon_, parsed_manifest_.release()); |
192 else | 194 else |
193 delegate_->OnWebstoreParseFailure(id_, parse_error_, error_); | 195 delegate_->OnWebstoreParseFailure(id_, parse_error_, error_); |
194 } | 196 } |
OLD | NEW |