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

Side by Side Diff: ppapi/shared_impl/file_path.cc

Issue 11359097: Refactored the PPB_Flash_File_ModuleLocal/FileRef to the new ppapi resource model (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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 | Annotate | Revision Log
« no previous file with comments | « ppapi/shared_impl/file_path.h ('k') | ppapi/shared_impl/ppb_flash_shared.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
8
9 #if defined(OS_WIN)
10 #include "base/utf_string_conversions.h"
11 #endif
12
13 namespace ppapi { 7 namespace ppapi {
14 8
15 namespace {
16
17 FilePath GetFilePathFromUTF8(const std::string& utf8_path) {
18 #if defined(OS_WIN)
19 return FilePath(UTF8ToUTF16(utf8_path));
20 #else
21 return FilePath(utf8_path);
22 #endif
23 }
24
25 } // namespace
26
27 PepperFilePath::PepperFilePath() 9 PepperFilePath::PepperFilePath()
28 : domain_(DOMAIN_INVALID), 10 : domain_(DOMAIN_INVALID),
29 path_() { 11 path_() {
30 } 12 }
31 13
32 PepperFilePath::PepperFilePath(Domain domain, const FilePath& path) 14 PepperFilePath::PepperFilePath(Domain domain, const FilePath& path)
33 : domain_(domain), 15 : domain_(domain),
34 path_(path) { 16 path_(path) {
35 // TODO(viettrungluu): Should we DCHECK() some things here? 17 // TODO(viettrungluu): Should we DCHECK() some things here?
36 } 18 }
37 19
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 20 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/shared_impl/file_path.h ('k') | ppapi/shared_impl/ppb_flash_shared.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698