• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef CHROME_BROWSER_SAFE_BROWSING_PATH_SANITIZER_H_
6 #define CHROME_BROWSER_SAFE_BROWSING_PATH_SANITIZER_H_
7 
8 #include "base/files/file_path.h"
9 #include "base/macros.h"
10 
11 namespace safe_browsing {
12 
13 // A helper class to sanitize any number of file paths by replacing the portion
14 // that represents the current user's home directory with "~".
15 class PathSanitizer {
16  public:
17   PathSanitizer();
18 
19   const base::FilePath& GetHomeDirectory() const;
20 
21   void StripHomeDirectory(base::FilePath* file_path) const;
22 
23  private:
24   base::FilePath home_path_;
25 
26   DISALLOW_COPY_AND_ASSIGN(PathSanitizer);
27 };
28 
29 }  // namespace safe_browsing
30 
31 #endif  // CHROME_BROWSER_SAFE_BROWSING_PATH_SANITIZER_H_
32