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