blob: bcf253312dadc2185f3bdc32d2e2fa67253caaf8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "webkit/glue/plugins/pepper_directory_reader.h"
#include "base/logging.h"
#include "third_party/ppapi/c/pp_completion_callback.h"
#include "third_party/ppapi/c/dev/ppb_directory_reader_dev.h"
#include "third_party/ppapi/c/pp_errors.h"
#include "webkit/glue/plugins/pepper_file_ref.h"
#include "webkit/glue/plugins/pepper_resource_tracker.h"
namespace pepper {
namespace {
PP_Resource Create(PP_Resource directory_ref_id) {
scoped_refptr<FileRef> directory_ref(
Resource::GetAs<FileRef>(directory_ref_id));
if (!directory_ref)
return 0;
DirectoryReader* reader = new DirectoryReader(directory_ref);
return reader->GetReference();
}
bool IsDirectoryReader(PP_Resource resource) {
return !!Resource::GetAs<DirectoryReader>(resource);
}
int32_t GetNextEntry(PP_Resource reader_id,
PP_DirectoryEntry_Dev* entry,
PP_CompletionCallback callback) {
scoped_refptr<DirectoryReader> reader(
Resource::GetAs<DirectoryReader>(reader_id));
if (!reader)
return PP_ERROR_BADRESOURCE;
return reader->GetNextEntry(entry, callback);
}
const PPB_DirectoryReader_Dev ppb_directoryreader = {
&Create,
&IsDirectoryReader,
&GetNextEntry
};
} // namespace
DirectoryReader::DirectoryReader(FileRef* directory_ref)
: Resource(directory_ref->module()),
directory_ref_(directory_ref) {
}
DirectoryReader::~DirectoryReader() {
}
const PPB_DirectoryReader_Dev* DirectoryReader::GetInterface() {
return &ppb_directoryreader;
}
int32_t DirectoryReader::GetNextEntry(PP_DirectoryEntry_Dev* entry,
PP_CompletionCallback callback) {
NOTIMPLEMENTED(); // TODO(darin): Implement me!
return PP_ERROR_FAILED;
}
} // namespace pepper
|