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 #include "ppapi/cpp/view.h" |
17 | 18 |
18 struct PP_InputEvent; | 19 struct PP_InputEvent; |
19 | 20 |
20 /// The C++ interface to the Pepper API. | 21 /// The C++ interface to the Pepper API. |
21 namespace pp { | 22 namespace pp { |
22 | 23 |
23 class Graphics2D; | 24 class Graphics2D; |
24 class Graphics3D; | 25 class Graphics3D; |
25 class InputEvent; | 26 class InputEvent; |
26 class Rect; | 27 class Rect; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 /// argument values: "nacl_module" and "2". The indices of these values | 84 /// argument values: "nacl_module" and "2". The indices of these values |
84 /// match the indices of the corresponding names in <code>argn</code>. | 85 /// match the indices of the corresponding names in <code>argn</code>. |
85 /// | 86 /// |
86 /// @return true on success. Returning false causes the instance to be | 87 /// @return true on success. Returning false causes the instance to be |
87 /// instance to be deleted and no other functions to be called. | 88 /// instance to be deleted and no other functions to be called. |
88 virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]); | 89 virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]); |
89 | 90 |
90 /// @{ | 91 /// @{ |
91 /// @name PPP_Instance methods for the module to override: | 92 /// @name PPP_Instance methods for the module to override: |
92 | 93 |
93 /// DidChangeView() is called when the position, the size, or the clip | 94 /// DidChangeView() is called when the view information for the Instance |
94 /// rectangle of the element in the browser that corresponds to this | 95 /// has changed. See the <code>View</code> object for information. |
95 /// instance has changed. | 96 /// |
| 97 /// Most implementations will want to check if the size and user visibility |
| 98 /// changed, and either resize themselves or start/stop generating updates. |
| 99 /// |
| 100 /// You should not call the default implementation. For |
| 101 /// backwards-compatibility, it will call the deprecated version of |
| 102 /// DidChangeView below. |
| 103 virtual void DidChangeView(const View& view); |
| 104 |
| 105 /// Deprecated backwards-compatible version of <code>DidChangeView()</code>. |
| 106 /// New code should derive from the version that takes a |
| 107 /// <code>ViewChanged</code> object rather than this version. This function |
| 108 /// is called by the default implementation of the newer |
| 109 /// <code>DidChangeView</code> function for source compatibility with older |
| 110 /// code. |
96 /// | 111 /// |
97 /// A typical implementation will check the size of the <code>position</code> | 112 /// A typical implementation will check the size of the <code>position</code> |
98 /// argument and reallocate the graphics context when a different size is | 113 /// argument and reallocate the graphics context when a different size is |
99 /// received. Note that this function will be called for scroll events where | 114 /// received. Note that this function will be called for scroll events where |
100 /// the size doesn't change, so you should always check that the size is | 115 /// the size doesn't change, so you should always check that the size is |
101 /// actually different before doing any reallocations. | 116 /// actually different before doing any reallocations. |
102 /// | 117 /// |
103 /// @param[in] position The location on the page of the instance. The | 118 /// @param[in] position The location on the page of the instance. The |
104 /// position is relative to the top left corner of the viewport, which changes | 119 /// position is relative to the top left corner of the viewport, which changes |
105 /// as the page is scrolled. Generally the size of this value will be used to | 120 /// as the page is scrolled. Generally the size of this value will be used to |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 private: | 510 private: |
496 PP_Instance pp_instance_; | 511 PP_Instance pp_instance_; |
497 | 512 |
498 typedef std::map<std::string, void*> InterfaceNameToObjectMap; | 513 typedef std::map<std::string, void*> InterfaceNameToObjectMap; |
499 InterfaceNameToObjectMap interface_name_to_objects_; | 514 InterfaceNameToObjectMap interface_name_to_objects_; |
500 }; | 515 }; |
501 | 516 |
502 } // namespace pp | 517 } // namespace pp |
503 | 518 |
504 #endif // PPAPI_CPP_INSTANCE_H_ | 519 #endif // PPAPI_CPP_INSTANCE_H_ |
OLD | NEW |