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

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

Issue 7743004: Move extension/webstore-related URL getters to the extension_urls namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review feedback. Created 9 years, 4 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) 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/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 return; 374 return;
375 } 375 }
376 376
377 if (update_url.DomainIs("google.com")) { 377 if (update_url.DomainIs("google.com")) {
378 url_stats_.google_url_count++; 378 url_stats_.google_url_count++;
379 } else if (update_url.is_empty()) { 379 } else if (update_url.is_empty()) {
380 url_stats_.no_url_count++; 380 url_stats_.no_url_count++;
381 // Fill in default update URL. 381 // Fill in default update URL.
382 // 382 //
383 // TODO(akalin): Figure out if we should use the HTTPS version. 383 // TODO(akalin): Figure out if we should use the HTTPS version.
384 update_url = Extension::GalleryUpdateUrl(false); 384 update_url = extension_urls::GetWebstoreUpdateUrl(false);
385 } else { 385 } else {
386 url_stats_.other_url_count++; 386 url_stats_.other_url_count++;
387 } 387 }
388 388
389 switch (extension_type) { 389 switch (extension_type) {
390 case Extension::TYPE_THEME: 390 case Extension::TYPE_THEME:
391 ++url_stats_.theme_count; 391 ++url_stats_.theme_count;
392 break; 392 break;
393 case Extension::TYPE_EXTENSION: 393 case Extension::TYPE_EXTENSION:
394 case Extension::TYPE_USER_SCRIPT: 394 case Extension::TYPE_USER_SCRIPT:
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 fetches_builder.ReportStats(); 1031 fetches_builder.ReportStats();
1032 1032
1033 std::vector<ManifestFetchData*> fetches(fetches_builder.GetFetches()); 1033 std::vector<ManifestFetchData*> fetches(fetches_builder.GetFetches());
1034 1034
1035 // Start a fetch of the blacklist if needed. 1035 // Start a fetch of the blacklist if needed.
1036 if (blacklist_checks_enabled_) { 1036 if (blacklist_checks_enabled_) {
1037 // Note: it is very important that we use the https version of the update 1037 // Note: it is very important that we use the https version of the update
1038 // url here to avoid DNS hijacking of the blacklist, which is not validated 1038 // url here to avoid DNS hijacking of the blacklist, which is not validated
1039 // by a public key signature like .crx files are. 1039 // by a public key signature like .crx files are.
1040 ManifestFetchData* blacklist_fetch = 1040 ManifestFetchData* blacklist_fetch =
1041 new ManifestFetchData(Extension::GalleryUpdateUrl(true)); 1041 new ManifestFetchData(extension_urls::GetWebstoreUpdateUrl(true));
1042 std::string version = prefs_->GetString(kExtensionBlacklistUpdateVersion); 1042 std::string version = prefs_->GetString(kExtensionBlacklistUpdateVersion);
1043 ManifestFetchData::PingData ping_data; 1043 ManifestFetchData::PingData ping_data;
1044 ping_data.rollcall_days = 1044 ping_data.rollcall_days =
1045 CalculatePingDays(extension_prefs_->BlacklistLastPingDay()); 1045 CalculatePingDays(extension_prefs_->BlacklistLastPingDay());
1046 blacklist_fetch->AddExtension(kBlacklistAppID, version, ping_data, ""); 1046 blacklist_fetch->AddExtension(kBlacklistAppID, version, ping_data, "");
1047 StartUpdateCheck(blacklist_fetch); 1047 StartUpdateCheck(blacklist_fetch);
1048 } 1048 }
1049 1049
1050 // Now start fetching regular extension updates 1050 // Now start fetching regular extension updates
1051 for (std::vector<ManifestFetchData*>::const_iterator it = fetches.begin(); 1051 for (std::vector<ManifestFetchData*>::const_iterator it = fetches.begin();
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 std::set<std::string>::const_iterator i; 1242 std::set<std::string>::const_iterator i;
1243 for (i = ids.begin(); i != ids.end(); ++i) 1243 for (i = ids.begin(); i != ids.end(); ++i)
1244 in_progress_ids_.insert(*i); 1244 in_progress_ids_.insert(*i);
1245 } 1245 }
1246 1246
1247 void ExtensionUpdater::RemoveFromInProgress(const std::set<std::string>& ids) { 1247 void ExtensionUpdater::RemoveFromInProgress(const std::set<std::string>& ids) {
1248 std::set<std::string>::const_iterator i; 1248 std::set<std::string>::const_iterator i;
1249 for (i = ids.begin(); i != ids.end(); ++i) 1249 for (i = ids.begin(); i != ids.end(); ++i)
1250 in_progress_ids_.erase(*i); 1250 in_progress_ids_.erase(*i);
1251 } 1251 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_tab_helper.cc ('k') | chrome/browser/extensions/extension_updater_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698