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

Side by Side Diff: components/safe_browsing_db/util.cc

Issue 1420053005: Move code in components/safe_browsing_db and chrome/browser/s_b/ under the safe_browsing namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@02_components_move
Patch Set: Merging the latest changes from trunk. Created 5 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
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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 "components/safe_browsing_db/util.h" 5 #include "components/safe_browsing_db/util.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "crypto/sha2.h" 8 #include "crypto/sha2.h"
9 #include "net/base/escape.h" 9 #include "net/base/escape.h"
10 #include "url/gurl.h" 10 #include "url/gurl.h"
11 #include "url/url_util.h" 11 #include "url/url_util.h"
12 12
13 // Utility functions ----------------------------------------------------------- 13 // Utility functions -----------------------------------------------------------
14 14
15 namespace { 15 namespace {
16 bool IsKnownList(const std::string& name) { 16 bool IsKnownList(const std::string& name) {
17 for (size_t i = 0; i < arraysize(safe_browsing::kAllLists); ++i) { 17 for (size_t i = 0; i < arraysize(safe_browsing::kAllLists); ++i) {
Nathan Parker 2015/11/05 22:00:53 Can put this anon-namespace inside safe_browsing,
vakh (old account. dont use) 2015/11/07 01:22:57 The function is only used in this file so to be co
18 if (!strcmp(safe_browsing::kAllLists[i], name.c_str())) { 18 if (!strcmp(safe_browsing::kAllLists[i], name.c_str())) {
19 return true; 19 return true;
20 } 20 }
21 } 21 }
22 return false; 22 return false;
23 } 23 }
24 } // namespace 24 } // namespace
25 25
26 namespace safe_browsing {
26 27
27 // SBCachedFullHashResult ------------------------------------------------------ 28 // SBCachedFullHashResult ------------------------------------------------------
28 29
29 SBCachedFullHashResult::SBCachedFullHashResult() {} 30 SBCachedFullHashResult::SBCachedFullHashResult() {}
30 31
31 SBCachedFullHashResult::SBCachedFullHashResult( 32 SBCachedFullHashResult::SBCachedFullHashResult(
32 const base::Time& in_expire_after) 33 const base::Time& in_expire_after)
33 : expire_after(in_expire_after) {} 34 : expire_after(in_expire_after) {}
34 35
35 SBCachedFullHashResult::~SBCachedFullHashResult() {} 36 SBCachedFullHashResult::~SBCachedFullHashResult() {}
36 37
37 38
38 namespace safe_browsing {
39
40 // Listnames that browser can process. 39 // Listnames that browser can process.
41 const char kMalwareList[] = "goog-malware-shavar"; 40 const char kMalwareList[] = "goog-malware-shavar";
42 const char kPhishingList[] = "goog-phish-shavar"; 41 const char kPhishingList[] = "goog-phish-shavar";
43 const char kBinUrlList[] = "goog-badbinurl-shavar"; 42 const char kBinUrlList[] = "goog-badbinurl-shavar";
44 const char kCsdWhiteList[] = "goog-csdwhite-sha256"; 43 const char kCsdWhiteList[] = "goog-csdwhite-sha256";
45 const char kDownloadWhiteList[] = "goog-downloadwhite-digest256"; 44 const char kDownloadWhiteList[] = "goog-downloadwhite-digest256";
46 const char kExtensionBlacklist[] = "goog-badcrxids-digestvar"; 45 const char kExtensionBlacklist[] = "goog-badcrxids-digestvar";
47 const char kIPBlacklist[] = "goog-badip-digest256"; 46 const char kIPBlacklist[] = "goog-badip-digest256";
48 const char kUnwantedUrlList[] = "goog-unwanted-shavar"; 47 const char kUnwantedUrlList[] = "goog-unwanted-shavar";
49 const char kInclusionWhitelist[] = "goog-csdinclusionwhite-sha256"; 48 const char kInclusionWhitelist[] = "goog-csdinclusionwhite-sha256";
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 GenerateHostsToCheck(url, &hosts); 361 GenerateHostsToCheck(url, &hosts);
363 GeneratePathsToCheck(url, &paths); 362 GeneratePathsToCheck(url, &paths);
364 for (size_t h = 0; h < hosts.size(); ++h) { 363 for (size_t h = 0; h < hosts.size(); ++h) {
365 for (size_t p = 0; p < paths.size(); ++p) { 364 for (size_t p = 0; p < paths.size(); ++p) {
366 urls->push_back(hosts[h] + paths[p]); 365 urls->push_back(hosts[h] + paths[p]);
367 } 366 }
368 } 367 }
369 } 368 }
370 369
371 } // namespace safe_browsing 370 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698