summaryrefslogtreecommitdiff
path: root/chromium/components/safe_browsing/common/utils.h
blob: ca6495542ab9ae3d93a3ceb2fc9d5092d21ccd1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Safe Browsing utility functions.

#ifndef COMPONENTS_SAFE_BROWSING_COMMON_UTILS_H_
#define COMPONENTS_SAFE_BROWSING_COMMON_UTILS_H_

#include "base/time/time.h"
#include "url/gurl.h"

namespace safe_browsing {

// Shorten URL by replacing its contents with its SHA256 hash if it has data
// scheme.
std::string ShortURLForReporting(const GURL& url);

// UMA histogram helper for logging "SB2.NoUserActionResourceLoadingDelay".
// Logs the total delay caused by SafeBrowsing for a resource load, if the
// SafeBrowsing interstitial page is not showed. At most one value is reported
// for each resource load. If SafeBrowsing causes delays at different stages of
// a load, the sum of all the delays will be reported.
void LogNoUserActionResourceLoadingDelay(base::TimeDelta time);

}  // namespace safe_browsing

#endif  // COMPONENTS_SAFE_BROWSING_COMMON_UTILS_H_