OLD | NEW |
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 #ifndef PPAPI_CPP_INSTANCE_H_ | 5 #ifndef PPAPI_CPP_INSTANCE_H_ |
6 #define PPAPI_CPP_INSTANCE_H_ | 6 #define PPAPI_CPP_INSTANCE_H_ |
7 | 7 |
8 /// @file | 8 /// @file |
9 /// This file defines the C++ wrapper for an instance. | 9 /// This file defines the C++ wrapper for an instance. |
10 | 10 |
11 #include <map> | 11 #include <map> |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "ppapi/c/pp_instance.h" | 14 #include "ppapi/c/pp_instance.h" |
15 #include "ppapi/c/pp_resource.h" | 15 #include "ppapi/c/pp_resource.h" |
16 #include "ppapi/c/pp_stdint.h" | 16 #include "ppapi/c/pp_stdint.h" |
17 | 17 |
18 struct PP_InputEvent; | 18 struct PP_InputEvent; |
19 | 19 |
20 /// The C++ interface to the Pepper API. | 20 /// The C++ interface to the Pepper API. |
21 namespace pp { | 21 namespace pp { |
22 | 22 |
23 class Graphics2D; | 23 class Graphics2D; |
24 class Graphics3D; | 24 class Graphics3D; |
25 class InputEvent; | 25 class InputEvent; |
26 class Rect; | 26 class Rect; |
27 class Surface3D_Dev; | |
28 class URLLoader; | 27 class URLLoader; |
29 class Var; | 28 class Var; |
30 | 29 |
31 class Instance { | 30 class Instance { |
32 public: | 31 public: |
33 /// Default constructor. Construction of an instance should only be done in | 32 /// Default constructor. Construction of an instance should only be done in |
34 /// response to a browser request in <code>Module::CreateInstance</code>. | 33 /// response to a browser request in <code>Module::CreateInstance</code>. |
35 /// Otherwise, the instance will lack the proper bookkeeping in the browser | 34 /// Otherwise, the instance will lack the proper bookkeeping in the browser |
36 /// and in the C++ wrapper. | 35 /// and in the C++ wrapper. |
37 /// | 36 /// |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 /// Refer to <code>BindGraphics(const Graphics2D& graphics)</code> for | 270 /// Refer to <code>BindGraphics(const Graphics2D& graphics)</code> for |
272 /// further information. | 271 /// further information. |
273 /// | 272 /// |
274 /// @param[in] graphics A <code>Graphics3D</code> to bind. | 273 /// @param[in] graphics A <code>Graphics3D</code> to bind. |
275 /// | 274 /// |
276 /// @return true if bind was successful or false if the device was not the | 275 /// @return true if bind was successful or false if the device was not the |
277 /// correct type. On success, a reference to the device will be held by the | 276 /// correct type. On success, a reference to the device will be held by the |
278 /// instance, so the caller can release its reference if it chooses. | 277 /// instance, so the caller can release its reference if it chooses. |
279 bool BindGraphics(const Graphics3D& graphics); | 278 bool BindGraphics(const Graphics3D& graphics); |
280 | 279 |
281 /// Binds the given Surface3D as the current display surface. | |
282 /// Refer to <code>BindGraphics(const Graphics2D& graphics)</code> for | |
283 /// further information. | |
284 /// | |
285 /// @param[in] graphics A <code>Surface3D_Dev</code> to bind. | |
286 /// | |
287 /// @return true if bind was successful or false if the device was not the | |
288 /// correct type. On success, a reference to the device will be held by the | |
289 /// instance, so the caller can release its reference if it chooses. | |
290 bool BindGraphics(const Surface3D_Dev& graphics); | |
291 | |
292 /// IsFullFrame() determines if the instance is full-frame (repr). | 280 /// IsFullFrame() determines if the instance is full-frame (repr). |
293 /// Such an instance represents the entire document in a frame rather than an | 281 /// Such an instance represents the entire document in a frame rather than an |
294 /// embedded resource. This can happen if the user does a top-level | 282 /// embedded resource. This can happen if the user does a top-level |
295 /// navigation or the page specifies an iframe to a resource with a MIME | 283 /// navigation or the page specifies an iframe to a resource with a MIME |
296 /// type registered by the module. | 284 /// type registered by the module. |
297 /// | 285 /// |
298 /// @return true if the instance is full-frame, false if not. | 286 /// @return true if the instance is full-frame, false if not. |
299 bool IsFullFrame(); | 287 bool IsFullFrame(); |
300 | 288 |
301 /// RequestInputEvents() requests that input events corresponding to the | 289 /// RequestInputEvents() requests that input events corresponding to the |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 private: | 495 private: |
508 PP_Instance pp_instance_; | 496 PP_Instance pp_instance_; |
509 | 497 |
510 typedef std::map<std::string, void*> InterfaceNameToObjectMap; | 498 typedef std::map<std::string, void*> InterfaceNameToObjectMap; |
511 InterfaceNameToObjectMap interface_name_to_objects_; | 499 InterfaceNameToObjectMap interface_name_to_objects_; |
512 }; | 500 }; |
513 | 501 |
514 } // namespace pp | 502 } // namespace pp |
515 | 503 |
516 #endif // PPAPI_CPP_INSTANCE_H_ | 504 #endif // PPAPI_CPP_INSTANCE_H_ |
OLD | NEW |