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

Side by Side Diff: webkit/plugins/ppapi/file_path.cc

Issue 10387195: Open pepper files directly in browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 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
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698