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

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

Issue 855513002: Add/resurrect support for bundles of WebStore items. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@testext_bundle
Patch Set: cleanup;rebase Created 5 years, 9 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 void WebstoreInstallHelper::StartWorkOnIOThread() { 75 void WebstoreInstallHelper::StartWorkOnIOThread() {
76 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 76 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
77 utility_host_ = UtilityProcessHost::Create( 77 utility_host_ = UtilityProcessHost::Create(
78 this, base::MessageLoopProxy::current().get())->AsWeakPtr(); 78 this, base::MessageLoopProxy::current().get())->AsWeakPtr();
79 utility_host_->StartBatchMode(); 79 utility_host_->StartBatchMode();
80 80
81 if (!icon_base64_data_.empty()) 81 if (!icon_base64_data_.empty())
82 utility_host_->Send( 82 utility_host_->Send(
83 new ChromeUtilityMsg_DecodeImageBase64(icon_base64_data_)); 83 new ChromeUtilityMsg_DecodeImageBase64(icon_base64_data_));
84 84
85 utility_host_->Send(new ChromeUtilityMsg_ParseJSON(manifest_)); 85 if (!manifest_.empty())
asargent_no_longer_on_chrome 2015/03/16 17:48:22 Why would the manifest be empty?
Marc Treib 2015/03/17 12:18:27 It is empty in the bundle install case. I'm (ab)us
asargent_no_longer_on_chrome 2015/03/24 23:34:00 Hmm, this seems like a risky approach, since all t
Marc Treib 2015/03/25 11:21:59 Ack re risky. Actually, http://crrev.com/931993002
Marc Treib 2015/03/26 15:49:25 931993002 has landed (yay!) and I've rebased this
86 utility_host_->Send(new ChromeUtilityMsg_ParseJSON(manifest_));
87 else
88 manifest_parse_complete_ = true;
89
90 ReportResultsIfComplete();
86 } 91 }
87 92
88 void WebstoreInstallHelper::OnURLFetchComplete( 93 void WebstoreInstallHelper::OnURLFetchComplete(
89 const net::URLFetcher* source) { 94 const net::URLFetcher* source) {
90 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 95 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
91 CHECK(source == url_fetcher_.get()); 96 CHECK(source == url_fetcher_.get());
92 int response_code = 97 int response_code =
93 source->GetStatus().is_success() ? source->GetResponseCode() : 0; 98 source->GetStatus().is_success() ? source->GetResponseCode() : 0;
94 if (!source->GetStatus().is_success() || 99 if (!source->GetStatus().is_success() ||
95 response_code / 100 == 4 || response_code / 100 == 5) { 100 response_code / 100 == 4 || response_code / 100 == 5) {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 } 194 }
190 195
191 BrowserThread::PostTask( 196 BrowserThread::PostTask(
192 BrowserThread::UI, 197 BrowserThread::UI,
193 FROM_HERE, 198 FROM_HERE,
194 base::Bind(&WebstoreInstallHelper::ReportResultFromUIThread, this)); 199 base::Bind(&WebstoreInstallHelper::ReportResultFromUIThread, this));
195 } 200 }
196 201
197 void WebstoreInstallHelper::ReportResultFromUIThread() { 202 void WebstoreInstallHelper::ReportResultFromUIThread() {
198 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 203 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
199 if (error_.empty() && parsed_manifest_) 204 if (error_.empty() && (parsed_manifest_ || manifest_.empty()))
200 delegate_->OnWebstoreParseSuccess(id_, icon_, parsed_manifest_.release()); 205 delegate_->OnWebstoreParseSuccess(id_, icon_, parsed_manifest_.release());
201 else 206 else
202 delegate_->OnWebstoreParseFailure(id_, parse_error_, error_); 207 delegate_->OnWebstoreParseFailure(id_, parse_error_, error_);
203 } 208 }
204 209
205 } // namespace extensions 210 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698