OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "webkit/plugins/ppapi/file_path.h" | |
6 | |
7 #include <string> | |
8 | |
9 #include "webkit/plugins/ppapi/plugin_module.h" | |
10 | |
11 #if defined(OS_WIN) | |
12 #include "base/utf_string_conversions.h" | |
13 #endif | |
14 | |
15 namespace webkit { | |
16 namespace ppapi { | |
17 | |
18 namespace { | |
19 | |
20 FilePath GetFilePathFromUTF8(const std::string& utf8_path) { | |
21 #if defined(OS_WIN) | |
22 return FilePath(UTF8ToUTF16(utf8_path)); | |
23 #else | |
24 return FilePath(utf8_path); | |
25 #endif | |
26 } | |
27 | |
28 } // namespace | |
29 | |
30 PepperFilePath::PepperFilePath() | |
31 : domain_(DOMAIN_INVALID), | |
32 path_() { | |
33 } | |
34 | |
35 PepperFilePath::PepperFilePath(Domain domain, const FilePath& path) | |
36 : domain_(domain), | |
37 path_(path) { | |
38 // TODO(viettrungluu): Should we DCHECK() some things here? | |
39 } | |
40 | |
41 // static | |
42 PepperFilePath PepperFilePath::MakeAbsolute(const FilePath& path) { | |
43 return PepperFilePath(DOMAIN_ABSOLUTE, path); | |
44 } | |
45 | |
46 // static | |
47 PepperFilePath PepperFilePath::MakeModuleLocal(PluginModule* module, | |
48 const char* utf8_path) { | |
49 FilePath full_path = GetFilePathFromUTF8(module->name()).Append( | |
50 GetFilePathFromUTF8(utf8_path)); | |
51 return PepperFilePath(DOMAIN_MODULE_LOCAL, full_path); | |
52 } | |
53 | |
54 } // namespace ppapi | |
55 } // namespace webkit | |
OLD | NEW |