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

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

Issue 6805019: Move crypto files out of base, to a top level directory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fixes comments by eroman Created 9 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) 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"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/file_util.h" 12 #include "base/file_util.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "base/rand_util.h" 14 #include "base/rand_util.h"
15 #include "base/sha2.h"
16 #include "base/stl_util-inl.h" 15 #include "base/stl_util-inl.h"
17 #include "base/string_number_conversions.h" 16 #include "base/string_number_conversions.h"
18 #include "base/string_split.h" 17 #include "base/string_split.h"
19 #include "base/string_util.h" 18 #include "base/string_util.h"
20 #include "base/time.h" 19 #include "base/time.h"
21 #include "base/threading/thread.h" 20 #include "base/threading/thread.h"
22 #include "base/version.h" 21 #include "base/version.h"
22 #include "crypto/sha2.h"
23 #include "content/common/notification_service.h" 23 #include "content/common/notification_service.h"
24 #include "chrome/browser/browser_process.h" 24 #include "chrome/browser/browser_process.h"
25 #include "chrome/browser/extensions/extension_error_reporter.h" 25 #include "chrome/browser/extensions/extension_error_reporter.h"
26 #include "chrome/browser/extensions/extension_service.h" 26 #include "chrome/browser/extensions/extension_service.h"
27 #include "chrome/browser/prefs/pref_service.h" 27 #include "chrome/browser/prefs/pref_service.h"
28 #include "chrome/browser/profiles/profile.h" 28 #include "chrome/browser/profiles/profile.h"
29 #include "chrome/browser/utility_process_host.h" 29 #include "chrome/browser/utility_process_host.h"
30 #include "chrome/common/chrome_switches.h" 30 #include "chrome/common/chrome_switches.h"
31 #include "chrome/common/chrome_version_info.h" 31 #include "chrome/common/chrome_version_info.h"
32 #include "chrome/common/extensions/extension.h" 32 #include "chrome/common/extensions/extension.h"
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 extension_prefs_->SetLastActivePingDay(*i, daystart); 777 extension_prefs_->SetLastActivePingDay(*i, daystart);
778 } 778 }
779 } 779 }
780 } 780 }
781 NotifyIfFinished(); 781 NotifyIfFinished();
782 } 782 }
783 783
784 void ExtensionUpdater::ProcessBlacklist(const std::string& data) { 784 void ExtensionUpdater::ProcessBlacklist(const std::string& data) {
785 DCHECK(alive_); 785 DCHECK(alive_);
786 // Verify sha256 hash value. 786 // Verify sha256 hash value.
787 char sha256_hash_value[base::SHA256_LENGTH]; 787 char sha256_hash_value[crypto::SHA256_LENGTH];
788 base::SHA256HashString(data, sha256_hash_value, base::SHA256_LENGTH); 788 crypto::SHA256HashString(data, sha256_hash_value, crypto::SHA256_LENGTH);
789 std::string hash_in_hex = base::HexEncode(sha256_hash_value, 789 std::string hash_in_hex = base::HexEncode(sha256_hash_value,
790 base::SHA256_LENGTH); 790 crypto::SHA256_LENGTH);
791 791
792 if (current_extension_fetch_.package_hash != hash_in_hex) { 792 if (current_extension_fetch_.package_hash != hash_in_hex) {
793 NOTREACHED() << "Fetched blacklist checksum is not as expected. " 793 NOTREACHED() << "Fetched blacklist checksum is not as expected. "
794 << "Expected: " << current_extension_fetch_.package_hash 794 << "Expected: " << current_extension_fetch_.package_hash
795 << " Actual: " << hash_in_hex; 795 << " Actual: " << hash_in_hex;
796 return; 796 return;
797 } 797 }
798 std::vector<std::string> blacklist; 798 std::vector<std::string> blacklist;
799 base::SplitString(data, '\n', &blacklist); 799 base::SplitString(data, '\n', &blacklist);
800 800
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 std::set<std::string>::const_iterator i; 1140 std::set<std::string>::const_iterator i;
1141 for (i = ids.begin(); i != ids.end(); ++i) 1141 for (i = ids.begin(); i != ids.end(); ++i)
1142 in_progress_ids_.insert(*i); 1142 in_progress_ids_.insert(*i);
1143 } 1143 }
1144 1144
1145 void ExtensionUpdater::RemoveFromInProgress(const std::set<std::string>& ids) { 1145 void ExtensionUpdater::RemoveFromInProgress(const std::set<std::string>& ids) {
1146 std::set<std::string>::const_iterator i; 1146 std::set<std::string>::const_iterator i;
1147 for (i = ids.begin(); i != ids.end(); ++i) 1147 for (i = ids.begin(); i != ids.end(); ++i)
1148 in_progress_ids_.erase(*i); 1148 in_progress_ids_.erase(*i);
1149 } 1149 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_creator.cc ('k') | chrome/browser/extensions/sandboxed_extension_unpacker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698