OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_path.h" | 5 #include "ppapi/shared_impl/file_path.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
yzshen1
2012/11/21 00:38:59
this is not needed.
raymes
2012/11/21 22:44:53
Done.
| |
8 | 8 |
9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
yzshen1
2012/11/21 00:38:59
this is not needed.
raymes
2012/11/21 22:44:53
Done.
| |
11 #endif | 11 #endif |
12 | 12 |
13 namespace ppapi { | 13 namespace ppapi { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 FilePath GetFilePathFromUTF8(const std::string& utf8_path) { | 17 FilePath GetFilePathFromUTF8(const std::string& utf8_path) { |
yzshen1
2012/11/21 00:38:59
this is not needed.
raymes
2012/11/21 22:44:53
Done.
| |
18 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
19 return FilePath(UTF8ToUTF16(utf8_path)); | 19 return FilePath(UTF8ToUTF16(utf8_path)); |
20 #else | 20 #else |
21 return FilePath(utf8_path); | 21 return FilePath(utf8_path); |
22 #endif | 22 #endif |
23 } | 23 } |
24 | 24 |
25 } // namespace | 25 } // namespace |
26 | 26 |
27 PepperFilePath::PepperFilePath() | 27 PepperFilePath::PepperFilePath() |
28 : domain_(DOMAIN_INVALID), | 28 : domain_(DOMAIN_INVALID), |
29 path_() { | 29 path_() { |
30 } | 30 } |
31 | 31 |
32 PepperFilePath::PepperFilePath(Domain domain, const FilePath& path) | 32 PepperFilePath::PepperFilePath(Domain domain, const FilePath& path) |
33 : domain_(domain), | 33 : domain_(domain), |
34 path_(path) { | 34 path_(path) { |
35 // TODO(viettrungluu): Should we DCHECK() some things here? | 35 // TODO(viettrungluu): Should we DCHECK() some things here? |
36 } | 36 } |
37 | 37 |
38 // static | |
39 PepperFilePath PepperFilePath::MakeAbsolute(const FilePath& path) { | |
40 return PepperFilePath(DOMAIN_ABSOLUTE, path); | |
41 } | |
42 | |
43 // static | |
44 PepperFilePath PepperFilePath::MakeModuleLocal(const std::string& name, | |
45 const char* utf8_path) { | |
46 FilePath full_path = GetFilePathFromUTF8(name).Append( | |
47 GetFilePathFromUTF8(utf8_path)); | |
48 return PepperFilePath(DOMAIN_MODULE_LOCAL, full_path); | |
49 } | |
50 | |
51 } // namespace ppapi | 38 } // namespace ppapi |
OLD | NEW |