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

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

Issue 8416020: Handle additional feedback from http://codereview.chromium.org/8395038/. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/extension_updater.h" 5 #include "chrome/browser/extensions/extension_updater.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 } 592 }
593 593
594 void ExtensionUpdater::OnURLFetchComplete(const content::URLFetcher* source) { 594 void ExtensionUpdater::OnURLFetchComplete(const content::URLFetcher* source) {
595 // Stop() destroys all our URLFetchers, which means we shouldn't be 595 // Stop() destroys all our URLFetchers, which means we shouldn't be
596 // called after Stop() is called. 596 // called after Stop() is called.
597 DCHECK(alive_); 597 DCHECK(alive_);
598 598
599 if (source == manifest_fetcher_.get()) { 599 if (source == manifest_fetcher_.get()) {
600 std::string data; 600 std::string data;
601 source->GetResponseAsString(&data); 601 source->GetResponseAsString(&data);
602 OnManifestFetchComplete(source->GetUrl(), 602 OnManifestFetchComplete(source->GetURL(),
603 source->GetStatus(), 603 source->GetStatus(),
604 source->GetResponseCode(), 604 source->GetResponseCode(),
605 data); 605 data);
606 } else if (source == extension_fetcher_.get()) { 606 } else if (source == extension_fetcher_.get()) {
607 OnCRXFetchComplete(source, 607 OnCRXFetchComplete(source,
608 source->GetUrl(), 608 source->GetURL(),
609 source->GetStatus(), 609 source->GetStatus(),
610 source->GetResponseCode()); 610 source->GetResponseCode());
611 } else { 611 } else {
612 NOTREACHED(); 612 NOTREACHED();
613 } 613 }
614 NotifyIfFinished(); 614 NotifyIfFinished();
615 } 615 }
616 616
617 // Utility class to handle doing xml parsing in a sandboxed utility process. 617 // Utility class to handle doing xml parsing in a sandboxed utility process.
618 class SafeManifestParser : public UtilityProcessHost::Client { 618 class SafeManifestParser : public UtilityProcessHost::Client {
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
1153 1153
1154 std::deque<ManifestFetchData*>::const_iterator i; 1154 std::deque<ManifestFetchData*>::const_iterator i;
1155 for (i = manifests_pending_.begin(); i != manifests_pending_.end(); i++) { 1155 for (i = manifests_pending_.begin(); i != manifests_pending_.end(); i++) {
1156 if (fetch_data->full_url() == (*i)->full_url()) { 1156 if (fetch_data->full_url() == (*i)->full_url()) {
1157 // This url is already scheduled to be fetched. 1157 // This url is already scheduled to be fetched.
1158 return; 1158 return;
1159 } 1159 }
1160 } 1160 }
1161 1161
1162 if (manifest_fetcher_.get() != NULL) { 1162 if (manifest_fetcher_.get() != NULL) {
1163 if (manifest_fetcher_->GetUrl() != fetch_data->full_url()) { 1163 if (manifest_fetcher_->GetURL() != fetch_data->full_url()) {
1164 manifests_pending_.push_back(scoped_fetch_data.release()); 1164 manifests_pending_.push_back(scoped_fetch_data.release());
1165 } 1165 }
1166 } else { 1166 } else {
1167 UMA_HISTOGRAM_COUNTS("Extensions.UpdateCheckUrlLength", 1167 UMA_HISTOGRAM_COUNTS("Extensions.UpdateCheckUrlLength",
1168 fetch_data->full_url().possibly_invalid_spec().length()); 1168 fetch_data->full_url().possibly_invalid_spec().length());
1169 1169
1170 current_manifest_fetch_.swap(scoped_fetch_data); 1170 current_manifest_fetch_.swap(scoped_fetch_data);
1171 manifest_fetcher_.reset(content::URLFetcher::Create( 1171 manifest_fetcher_.reset(content::URLFetcher::Create(
1172 kManifestFetcherId, fetch_data->full_url(), content::URLFetcher::GET, 1172 kManifestFetcherId, fetch_data->full_url(), content::URLFetcher::GET,
1173 this)); 1173 this));
(...skipping 11 matching lines...) Expand all
1185 const std::string& version) { 1185 const std::string& version) {
1186 for (std::deque<ExtensionFetch>::const_iterator iter = 1186 for (std::deque<ExtensionFetch>::const_iterator iter =
1187 extensions_pending_.begin(); 1187 extensions_pending_.begin();
1188 iter != extensions_pending_.end(); ++iter) { 1188 iter != extensions_pending_.end(); ++iter) {
1189 if (iter->id == id || iter->url == url) { 1189 if (iter->id == id || iter->url == url) {
1190 return; // already scheduled 1190 return; // already scheduled
1191 } 1191 }
1192 } 1192 }
1193 1193
1194 if (extension_fetcher_.get() != NULL) { 1194 if (extension_fetcher_.get() != NULL) {
1195 if (extension_fetcher_->GetUrl() != url) { 1195 if (extension_fetcher_->GetURL() != url) {
1196 extensions_pending_.push_back(ExtensionFetch(id, url, hash, version)); 1196 extensions_pending_.push_back(ExtensionFetch(id, url, hash, version));
1197 } 1197 }
1198 } else { 1198 } else {
1199 extension_fetcher_.reset(content::URLFetcher::Create( 1199 extension_fetcher_.reset(content::URLFetcher::Create(
1200 kExtensionFetcherId, url, content::URLFetcher::GET, this)); 1200 kExtensionFetcherId, url, content::URLFetcher::GET, this));
1201 extension_fetcher_->SetRequestContext( 1201 extension_fetcher_->SetRequestContext(
1202 profile_->GetRequestContext()); 1202 profile_->GetRequestContext());
1203 extension_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | 1203 extension_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
1204 net::LOAD_DO_NOT_SAVE_COOKIES | 1204 net::LOAD_DO_NOT_SAVE_COOKIES |
1205 net::LOAD_DISABLE_CACHE); 1205 net::LOAD_DISABLE_CACHE);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1243 std::set<std::string>::const_iterator i; 1243 std::set<std::string>::const_iterator i;
1244 for (i = ids.begin(); i != ids.end(); ++i) 1244 for (i = ids.begin(); i != ids.end(); ++i)
1245 in_progress_ids_.insert(*i); 1245 in_progress_ids_.insert(*i);
1246 } 1246 }
1247 1247
1248 void ExtensionUpdater::RemoveFromInProgress(const std::set<std::string>& ids) { 1248 void ExtensionUpdater::RemoveFromInProgress(const std::set<std::string>& ids) {
1249 std::set<std::string>::const_iterator i; 1249 std::set<std::string>::const_iterator i;
1250 for (i = ids.begin(); i != ids.end(); ++i) 1250 for (i = ids.begin(); i != ids.end(); ++i)
1251 in_progress_ids_.erase(*i); 1251 in_progress_ids_.erase(*i);
1252 } 1252 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698