Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / chrome / browser / safe_browsing / path_sanitizer.cc
blobd4b00f5b8f53a1b68b1188c7ebf1dbd25e9c4cbd
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.
5 #include "chrome/browser/safe_browsing/path_sanitizer.h"
7 #include "base/logging.h"
8 #include "base/path_service.h"
10 namespace safe_browsing {
12 PathSanitizer::PathSanitizer() {
13 // Get the home directory path.
14 if (!PathService::Get(base::DIR_HOME, &home_path_))
15 NOTREACHED();
18 const base::FilePath& PathSanitizer::GetHomeDirectory() const {
19 return home_path_;
22 void PathSanitizer::StripHomeDirectory(base::FilePath* file_path) const {
23 base::FilePath sanitized_path(FILE_PATH_LITERAL("~"));
25 // The |file_path| is overwritten only if a relative path is found.
26 if (home_path_.AppendRelativePath(*file_path, &sanitized_path))
27 *file_path = sanitized_path;
30 } // namespace safe_browsing