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

Side by Side Diff: ppapi/shared_impl/file_ref_util.cc

Issue 270183002: Move IsStringUTF8/ASCII to base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more minor nit Created 6 years, 7 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
« no previous file with comments | « ppapi/shared_impl/dictionary_var.cc ('k') | ppapi/shared_impl/var.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ppapi/shared_impl/file_ref_util.h" 5 #include "ppapi/shared_impl/file_ref_util.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 10
(...skipping 18 matching lines...) Expand all
29 #else 29 #else
30 #error "Unsupported platform." 30 #error "Unsupported platform."
31 #endif 31 #endif
32 } 32 }
33 33
34 bool IsValidInternalPath(const std::string& path) { 34 bool IsValidInternalPath(const std::string& path) {
35 // We check that: 35 // We check that:
36 // The path starts with '/' 36 // The path starts with '/'
37 // The path must contain valid UTF-8 characters. 37 // The path must contain valid UTF-8 characters.
38 // It must not FilePath::ReferencesParent(). 38 // It must not FilePath::ReferencesParent().
39 if (path.empty() || !IsStringUTF8(path) || path[0] != '/') 39 if (path.empty() || !base::IsStringUTF8(path) || path[0] != '/')
40 return false; 40 return false;
41 base::FilePath file_path = base::FilePath::FromUTF8Unsafe(path); 41 base::FilePath file_path = base::FilePath::FromUTF8Unsafe(path);
42 if (file_path.ReferencesParent()) 42 if (file_path.ReferencesParent())
43 return false; 43 return false;
44 return true; 44 return true;
45 } 45 }
46 46
47 bool IsValidExternalPath(const base::FilePath& path) { 47 bool IsValidExternalPath(const base::FilePath& path) {
48 return !path.empty() && !path.ReferencesParent(); 48 return !path.empty() && !path.ReferencesParent();
49 } 49 }
50 50
51 void NormalizeInternalPath(std::string* path) { 51 void NormalizeInternalPath(std::string* path) {
52 if (path->size() > 1 && path->at(path->size() - 1) == '/') 52 if (path->size() > 1 && path->at(path->size() - 1) == '/')
53 path->erase(path->size() - 1, 1); 53 path->erase(path->size() - 1, 1);
54 } 54 }
55 55
56 } // namespace ppapi 56 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/shared_impl/dictionary_var.cc ('k') | ppapi/shared_impl/var.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698