Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: chrome/browser/extensions/webstore_install_helper.cc

Issue 1097383005: Add possibility to define data callback to BitmapFetcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@r479598_extensions_content_verifier_directories_fail
Patch Set: Another approach - split Start to Init and Start Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698