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