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

Side by Side Diff: chrome/browser/net/url_fixer_upper.cc

Issue 18286004: Move PathExists to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/net/url_fixer_upper.h" 5 #include "chrome/browser/net/url_fixer_upper.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #if defined(OS_POSIX) 9 #if defined(OS_POSIX)
10 #include "base/environment.h" 10 #include "base/environment.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 // Tries to create a full path from |text|. If the result is valid and the 101 // Tries to create a full path from |text|. If the result is valid and the
102 // file exists, returns true and sets |full_path| to the result. Otherwise, 102 // file exists, returns true and sets |full_path| to the result. Otherwise,
103 // returns false and leaves |full_path| unchanged. 103 // returns false and leaves |full_path| unchanged.
104 bool ValidPathForFile(const base::FilePath::StringType& text, 104 bool ValidPathForFile(const base::FilePath::StringType& text,
105 base::FilePath* full_path) { 105 base::FilePath* full_path) {
106 base::FilePath file_path = base::MakeAbsoluteFilePath(base::FilePath(text)); 106 base::FilePath file_path = base::MakeAbsoluteFilePath(base::FilePath(text));
107 if (file_path.empty()) 107 if (file_path.empty())
108 return false; 108 return false;
109 109
110 if (!file_util::PathExists(file_path)) 110 if (!base::PathExists(file_path))
111 return false; 111 return false;
112 112
113 *full_path = file_path; 113 *full_path = file_path;
114 return true; 114 return true;
115 } 115 }
116 116
117 #if defined(OS_POSIX) 117 #if defined(OS_POSIX)
118 // Given a path that starts with ~, return a path that starts with an 118 // Given a path that starts with ~, return a path that starts with an
119 // expanded-out /user/foobar directory. 119 // expanded-out /user/foobar directory.
120 std::string FixupHomedir(const std::string& text) { 120 std::string FixupHomedir(const std::string& text) {
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 636
637 if (part->is_valid()) { 637 if (part->is_valid()) {
638 // Offset the location of this component. 638 // Offset the location of this component.
639 part->begin += offset; 639 part->begin += offset;
640 640
641 // This part might not have existed in the original text. 641 // This part might not have existed in the original text.
642 if (part->begin < 0) 642 if (part->begin < 0)
643 part->reset(); 643 part->reset();
644 } 644 }
645 } 645 }
OLDNEW
« no previous file with comments | « chrome/browser/net/sqlite_server_bound_cert_store.cc ('k') | chrome/browser/page_cycler/page_cycler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698