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