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

Side by Side Diff: third_party/WebKit/Source/platform/exported/FilePathConversion.cpp

Issue 2586483002: Use explicit WebString <-> string16 conversion methods in storage API files (Closed)
Patch Set: '' Created 4 years 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "public/platform/FilePathConversion.h" 5 #include "public/platform/FilePathConversion.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "public/platform/WebString.h" 8 #include "public/platform/WebString.h"
9 #include "wtf/text/StringUTF8Adaptor.h" 9 #include "wtf/text/StringUTF8Adaptor.h"
10 #include "wtf/text/WTFString.h" 10 #include "wtf/text/WTFString.h"
(...skipping 13 matching lines...) Expand all
24 #if OS(POSIX) 24 #if OS(POSIX)
25 StringUTF8Adaptor utf8(str); 25 StringUTF8Adaptor utf8(str);
26 return base::FilePath::FromUTF8Unsafe(utf8.asStringPiece()); 26 return base::FilePath::FromUTF8Unsafe(utf8.asStringPiece());
27 #else 27 #else
28 const LChar* data8 = str.characters8(); 28 const LChar* data8 = str.characters8();
29 return base::FilePath::FromUTF16Unsafe( 29 return base::FilePath::FromUTF16Unsafe(
30 base::string16(data8, data8 + str.length())); 30 base::string16(data8, data8 + str.length()));
31 #endif 31 #endif
32 } 32 }
33 33
34 WebString FilePathToWebString(const base::FilePath& path) {
35 if (path.empty())
36 return WebString();
37
38 #if OS(POSIX)
39 return WebString::fromUTF8(path.value());
40 #else
41 return WebString::fromUTF16(path.AsUTF16Unsafe());
42 #endif
43 }
44
34 } // namespace blink 45 } // namespace blink
OLDNEW
« no previous file with comments | « content/child/webfileutilities_impl.cc ('k') | third_party/WebKit/Source/platform/exported/FilePathConversionTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698