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

Unified Diff: chrome/browser/safe_browsing/safe_browsing_util.cc

Issue 1420143002: Revert of Move prefix_set and parts of s_b_util into a new component safe_browsing_db. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/safe_browsing/safe_browsing_util.cc
diff --git a/chrome/browser/safe_browsing/safe_browsing_util.cc b/chrome/browser/safe_browsing/safe_browsing_util.cc
index 3a5ba42464e87b273c6ef8195a6e932f39d60a6b..b4ff66f21827203ca0d393f6199a74d67680f1f6 100644
--- a/chrome/browser/safe_browsing/safe_browsing_util.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_util.cc
@@ -7,12 +7,25 @@
#include "base/logging.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
+#include "chrome/browser/browser_process.h"
#include "chrome/browser/safe_browsing/chunk.pb.h"
#include "components/google/core/browser/google_util.h"
#include "crypto/sha2.h"
#include "net/base/escape.h"
#include "url/gurl.h"
#include "url/url_util.h"
+
+#if defined(OS_WIN)
+#include "chrome/installer/util/browser_distribution.h"
+#endif
+
+static const char kReportParams[] = "?tpl=%s&url=%s";
+
+SBFullHash SBFullHashForString(const base::StringPiece& str) {
+ SBFullHash h;
+ crypto::SHA256HashString(str, &h.full_hash, sizeof(h.full_hash));
+ return h;
+}
// SBCachedFullHashResult ------------------------------------------------------
@@ -470,6 +483,28 @@
}
}
+GURL GeneratePhishingReportUrl(const std::string& report_page,
+ const std::string& url_to_report,
+ bool is_client_side_detection) {
+ const std::string current_esc = net::EscapeQueryParamValue(url_to_report,
+ true);
+
+#if defined(OS_WIN)
+ BrowserDistribution* dist = BrowserDistribution::GetDistribution();
+ std::string client_name(dist->GetSafeBrowsingName());
+#else
+ std::string client_name("googlechrome");
+#endif
+ if (is_client_side_detection)
+ client_name.append("_csd");
+
+ GURL report_url(report_page + base::StringPrintf(kReportParams,
+ client_name.c_str(),
+ current_esc.c_str()));
+ return google_util::AppendGoogleLocaleParam(
+ report_url, g_browser_process->GetApplicationLocale());
+}
+
SBFullHash StringToSBFullHash(const std::string& hash_in) {
DCHECK_EQ(crypto::kSHA256Length, hash_in.size());
SBFullHash hash_out;
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_util.h ('k') | chrome/browser/safe_browsing/safe_browsing_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698