Popular sites on the NTP: Try to keep the ordering constant
[chromium-blink-merge.git] / ppapi / shared_impl / ppp_instance_combined.h
bloba29b1bb5fa40fc07d4403300f0ee2f1e3be476c3
1 // Copyright (c) 2012 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.
5 #ifndef PPAPI_SHARED_IMPL_PPP_INSTANCE_COMBINED_H_
6 #define PPAPI_SHARED_IMPL_PPP_INSTANCE_COMBINED_H_
8 #include "base/basictypes.h"
9 #include "base/callback.h"
10 #include "ppapi/c/ppp_instance.h"
11 #include "ppapi/shared_impl/ppapi_shared_export.h"
13 namespace ppapi {
15 // This exposes the 1.1 interface and forwards it to the 1.0 interface is
16 // necessary.
17 struct PPAPI_SHARED_EXPORT PPP_Instance_Combined {
18 public:
19 // Create a PPP_Instance_Combined. Uses the given |get_interface_func| to
20 // query the plugin and find the most recent version of the PPP_Instance
21 // interface. If the plugin doesn't support any PPP_Instance interface,
22 // returns NULL.
23 static PPP_Instance_Combined* Create(
24 base::Callback<const void*(const char*)> get_plugin_if);
26 PP_Bool DidCreate(PP_Instance instance,
27 uint32_t argc,
28 const char* argn[],
29 const char* argv[]);
30 void DidDestroy(PP_Instance instance);
32 // This version of DidChangeView encapsulates all arguments for both 1.0
33 // and 1.1 versions of this function. Conversion from 1.1 -> 1.0 is easy,
34 // but this class doesn't have the necessary context (resource interfaces)
35 // to do the conversion, so the caller must do it.
36 void DidChangeView(PP_Instance instance,
37 PP_Resource view_changed_resource,
38 const struct PP_Rect* position,
39 const struct PP_Rect* clip);
41 void DidChangeFocus(PP_Instance instance, PP_Bool has_focus);
42 PP_Bool HandleDocumentLoad(PP_Instance instance, PP_Resource url_loader);
44 private:
45 explicit PPP_Instance_Combined(const PPP_Instance_1_0& instance_if);
46 explicit PPP_Instance_Combined(const PPP_Instance_1_1& instance_if);
48 // For version 1.0, DidChangeView will be NULL, and DidChangeView_1_0 will
49 // be set below.
50 PPP_Instance_1_1 instance_1_1_;
52 // Non-NULL when Instance 1.0 is used.
53 void (*did_change_view_1_0_)(PP_Instance instance,
54 const struct PP_Rect* position,
55 const struct PP_Rect* clip);
57 DISALLOW_COPY_AND_ASSIGN(PPP_Instance_Combined);
60 } // namespace ppapi
62 #endif // PPAPI_SHARED_IMPL_PPP_INSTANCE_COMBINED_H_