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

Side by Side Diff: chrome/browser/extensions/updater/extension_downloader.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 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 | Annotate | Revision Log
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/updater/extension_downloader.h" 5 #include "chrome/browser/extensions/updater/extension_downloader.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 status.status() == net::URLRequestStatus::FAILED; 146 status.status() == net::URLRequestStatus::FAILED;
147 } 147 }
148 148
149 } // namespace 149 } // namespace
150 150
151 UpdateDetails::UpdateDetails(const std::string& id, const Version& version) 151 UpdateDetails::UpdateDetails(const std::string& id, const Version& version)
152 : id(id), version(version) {} 152 : id(id), version(version) {}
153 153
154 UpdateDetails::~UpdateDetails() {} 154 UpdateDetails::~UpdateDetails() {}
155 155
156 156 ExtensionDownloader::ExtensionFetch::ExtensionFetch() : url() {}
157 ExtensionDownloader::ExtensionFetch::ExtensionFetch()
158 : id(""),
159 url(),
160 package_hash(""),
161 version("") {}
162 157
163 ExtensionDownloader::ExtensionFetch::ExtensionFetch( 158 ExtensionDownloader::ExtensionFetch::ExtensionFetch(
164 const std::string& id, 159 const std::string& id,
165 const GURL& url, 160 const GURL& url,
166 const std::string& package_hash, 161 const std::string& package_hash,
167 const std::string& version, 162 const std::string& version,
168 const std::set<int>& request_ids) 163 const std::set<int>& request_ids)
169 : id(id), url(url), package_hash(package_hash), version(version), 164 : id(id), url(url), package_hash(package_hash), version(version),
170 request_ids(request_ids) {} 165 request_ids(request_ids) {}
171 166
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 208
214 bool ExtensionDownloader::AddPendingExtension(const std::string& id, 209 bool ExtensionDownloader::AddPendingExtension(const std::string& id,
215 const GURL& update_url, 210 const GURL& update_url,
216 int request_id) { 211 int request_id) {
217 // Use a zero version to ensure that a pending extension will always 212 // Use a zero version to ensure that a pending extension will always
218 // be updated, and thus installed (assuming all extensions have 213 // be updated, and thus installed (assuming all extensions have
219 // non-zero versions). 214 // non-zero versions).
220 Version version("0.0.0.0"); 215 Version version("0.0.0.0");
221 DCHECK(version.IsValid()); 216 DCHECK(version.IsValid());
222 217
223 return AddExtensionData(id, version, Manifest::TYPE_UNKNOWN, update_url, "", 218 return AddExtensionData(id,
219 version,
220 Manifest::TYPE_UNKNOWN,
221 update_url,
222 std::string(),
224 request_id); 223 request_id);
225 } 224 }
226 225
227 void ExtensionDownloader::StartAllPending() { 226 void ExtensionDownloader::StartAllPending() {
228 ReportStats(); 227 ReportStats();
229 url_stats_ = URLStats(); 228 url_stats_ = URLStats();
230 229
231 for (FetchMap::iterator it = fetches_preparing_.begin(); 230 for (FetchMap::iterator it = fetches_preparing_.begin();
232 it != fetches_preparing_.end(); ++it) { 231 it != fetches_preparing_.end(); ++it) {
233 std::vector<linked_ptr<ManifestFetchData> >& list = it->second; 232 std::vector<linked_ptr<ManifestFetchData> >& list = it->second;
234 for (size_t i = 0; i < list.size(); ++i) { 233 for (size_t i = 0; i < list.size(); ++i) {
235 StartUpdateCheck(scoped_ptr<ManifestFetchData>(list[i].release())); 234 StartUpdateCheck(scoped_ptr<ManifestFetchData>(list[i].release()));
236 } 235 }
237 } 236 }
238 fetches_preparing_.clear(); 237 fetches_preparing_.clear();
239 } 238 }
240 239
241 void ExtensionDownloader::StartBlacklistUpdate( 240 void ExtensionDownloader::StartBlacklistUpdate(
242 const std::string& version, 241 const std::string& version,
243 const ManifestFetchData::PingData& ping_data, 242 const ManifestFetchData::PingData& ping_data,
244 int request_id) { 243 int request_id) {
245 // Note: it is very important that we use the https version of the update 244 // Note: it is very important that we use the https version of the update
246 // url here to avoid DNS hijacking of the blacklist, which is not validated 245 // url here to avoid DNS hijacking of the blacklist, which is not validated
247 // by a public key signature like .crx files are. 246 // by a public key signature like .crx files are.
248 scoped_ptr<ManifestFetchData> blacklist_fetch( 247 scoped_ptr<ManifestFetchData> blacklist_fetch(
249 new ManifestFetchData(extension_urls::GetWebstoreUpdateUrl(), 248 new ManifestFetchData(extension_urls::GetWebstoreUpdateUrl(),
250 request_id)); 249 request_id));
251 DCHECK(blacklist_fetch->base_url().SchemeIsSecure()); 250 DCHECK(blacklist_fetch->base_url().SchemeIsSecure());
252 blacklist_fetch->AddExtension(kBlacklistAppID, version, &ping_data, "", 251 blacklist_fetch->AddExtension(kBlacklistAppID,
252 version,
253 &ping_data,
254 std::string(),
253 kDefaultInstallSource); 255 kDefaultInstallSource);
254 StartUpdateCheck(blacklist_fetch.Pass()); 256 StartUpdateCheck(blacklist_fetch.Pass());
255 } 257 }
256 258
257 bool ExtensionDownloader::AddExtensionData(const std::string& id, 259 bool ExtensionDownloader::AddExtensionData(const std::string& id,
258 const Version& version, 260 const Version& version,
259 Manifest::Type extension_type, 261 Manifest::Type extension_type,
260 const GURL& extension_update_url, 262 const GURL& extension_update_url,
261 const std::string& update_url_data, 263 const std::string& update_url_data,
262 int request_id) { 264 int request_id) {
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 void ExtensionDownloader::NotifyUpdateFound(const std::string& id, 774 void ExtensionDownloader::NotifyUpdateFound(const std::string& id,
773 const std::string& version) { 775 const std::string& version) {
774 UpdateDetails updateInfo(id, Version(version)); 776 UpdateDetails updateInfo(id, Version(version));
775 content::NotificationService::current()->Notify( 777 content::NotificationService::current()->Notify(
776 chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND, 778 chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND,
777 content::NotificationService::AllBrowserContextsAndSources(), 779 content::NotificationService::AllBrowserContextsAndSources(),
778 content::Details<UpdateDetails>(&updateInfo)); 780 content::Details<UpdateDetails>(&updateInfo));
779 } 781 }
780 782
781 } // namespace extensions 783 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/tab_helper.cc ('k') | chrome/browser/extensions/updater/extension_updater.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698