Home | History | Annotate | Download | only in shared_impl
      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 #ifndef PPAPI_SHARED_IMPL_PPB_IMAGE_DATA_SHARED_H_
      6 #define PPAPI_SHARED_IMPL_PPB_IMAGE_DATA_SHARED_H_
      7 
      8 #include "ppapi/c/pp_bool.h"
      9 #include "ppapi/c/ppb_image_data.h"
     10 #include "ppapi/shared_impl/ppapi_shared_export.h"
     11 
     12 namespace ppapi {
     13 
     14 // Contains the implementation of some simple image data functions that are
     15 // shared between the proxy and Chrome's implementation. Since these functions
     16 // are just lists of what we support, it's much easier to just have the same
     17 // code run in the plugin process than to proxy it.
     18 //
     19 // It's possible the implementation will get more complex. In this case, it's
     20 // probably best to have some kind of "configuration" message that the renderer
     21 // sends to the plugin process on startup that contains all of these kind of
     22 // settings.
     23 class PPAPI_SHARED_EXPORT PPB_ImageData_Shared {
     24  public:
     25   enum ImageDataType {
     26     // An ImageData backed by a PlatformCanvas. You must create this type if
     27     // you intend the ImageData to be usable in platform-specific APIs (like
     28     // font rendering or rendering widgets like scrollbars). This type is not
     29     // available in untrusted (NaCl) plugins.
     30     PLATFORM,
     31     // An ImageData that doesn't need access to the platform-specific canvas.
     32     // This is backed by a simple shared memory buffer. This is the only type
     33     // of ImageData that can be used by untrusted (NaCl) plugins.
     34     SIMPLE
     35   };
     36 
     37   static PP_ImageDataFormat GetNativeImageDataFormat();
     38   static PP_Bool IsImageDataFormatSupported(PP_ImageDataFormat format);
     39   static PP_Bool IsImageDataDescValid(const PP_ImageDataDesc& desc);
     40 };
     41 
     42 }  // namespace ppapi
     43 
     44 #endif  // PPAPI_SHARED_IMPL_PPB_IMAGE_DATA_SHARED_H_
     45