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" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 void WebstoreInstallHelper::Start() { | 50 void WebstoreInstallHelper::Start() { |
51 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 51 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
52 | 52 |
53 if (icon_url_.is_empty()) { | 53 if (icon_url_.is_empty()) { |
54 icon_decode_complete_ = true; | 54 icon_decode_complete_ = true; |
55 } else { | 55 } else { |
56 // No existing |icon_fetcher_| to avoid unbalanced AddRef(). | 56 // No existing |icon_fetcher_| to avoid unbalanced AddRef(). |
57 CHECK(!icon_fetcher_.get()); | 57 CHECK(!icon_fetcher_.get()); |
58 AddRef(); // Balanced in OnFetchComplete(). | 58 AddRef(); // Balanced in OnFetchComplete(). |
59 icon_fetcher_.reset(new chrome::BitmapFetcher(icon_url_, this)); | 59 icon_fetcher_.reset(new chrome::BitmapFetcher(icon_url_, this)); |
60 icon_fetcher_->Start( | 60 icon_fetcher_->Init( |
61 context_getter_, std::string(), | 61 context_getter_, std::string(), |
62 net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE, | 62 net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE, |
63 net::LOAD_DO_NOT_SAVE_COOKIES | net::LOAD_DO_NOT_SEND_COOKIES); | 63 net::LOAD_DO_NOT_SAVE_COOKIES | net::LOAD_DO_NOT_SEND_COOKIES); |
| 64 icon_fetcher_->Start(); |
64 } | 65 } |
65 | 66 |
66 BrowserThread::PostTask( | 67 BrowserThread::PostTask( |
67 BrowserThread::IO, | 68 BrowserThread::IO, |
68 FROM_HERE, | 69 FROM_HERE, |
69 base::Bind(&WebstoreInstallHelper::StartWorkOnIOThread, this)); | 70 base::Bind(&WebstoreInstallHelper::StartWorkOnIOThread, this)); |
70 } | 71 } |
71 | 72 |
72 void WebstoreInstallHelper::StartWorkOnIOThread() { | 73 void WebstoreInstallHelper::StartWorkOnIOThread() { |
73 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 74 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 159 |
159 void WebstoreInstallHelper::ReportResultFromUIThread() { | 160 void WebstoreInstallHelper::ReportResultFromUIThread() { |
160 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 161 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
161 if (error_.empty() && parsed_manifest_) | 162 if (error_.empty() && parsed_manifest_) |
162 delegate_->OnWebstoreParseSuccess(id_, icon_, parsed_manifest_.release()); | 163 delegate_->OnWebstoreParseSuccess(id_, icon_, parsed_manifest_.release()); |
163 else | 164 else |
164 delegate_->OnWebstoreParseFailure(id_, parse_error_, error_); | 165 delegate_->OnWebstoreParseFailure(id_, parse_error_, error_); |
165 } | 166 } |
166 | 167 |
167 } // namespace extensions | 168 } // namespace extensions |
OLD | NEW |