1f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
2f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// found in the LICENSE file.
4f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
5f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include "ppapi/cpp/private/isolated_file_system_private.h"
6f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
7f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include "ppapi/cpp/module_impl.h"
8f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
9f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)namespace pp {
10f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
11f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)namespace {
12f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
13f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)template <> const char* interface_name<PPB_IsolatedFileSystem_Private_0_2>() {
14f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  return PPB_ISOLATEDFILESYSTEM_PRIVATE_INTERFACE_0_2;
15f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)}
16f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
17f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)}  // namespace
18f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
19f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)IsolatedFileSystemPrivate::IsolatedFileSystemPrivate()
20f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)    : instance_(0), type_(PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_INVALID) {
21f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)}
22f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
23f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)IsolatedFileSystemPrivate::IsolatedFileSystemPrivate(
24f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)    const InstanceHandle& instance,
25f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)    PP_IsolatedFileSystemType_Private type)
26f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)    : instance_(instance.pp_instance()), type_(type) {
27f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)}
28f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
29f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)IsolatedFileSystemPrivate::~IsolatedFileSystemPrivate() {
30f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)}
31f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
32f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)int32_t IsolatedFileSystemPrivate::Open(
33f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)    const CompletionCallbackWithOutput<pp::FileSystem>& cc) {
34f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  if (!has_interface<PPB_IsolatedFileSystem_Private_0_2>())
35f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)    return cc.MayForce(PP_ERROR_NOINTERFACE);
36f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  return get_interface<PPB_IsolatedFileSystem_Private_0_2>()->
37f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)      Open(instance_, type_, cc.output(), cc.pp_completion_callback());
38f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)}
39f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
40f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)}  // namespace pp
41