mirror of
				https://bitbucket.org/chromiumembedded/cef
				synced 2025-06-05 21:39:12 +02:00 
			
		
		
		
	Add NUM_VALUES for enums and size for structs (see #3836)
API versioning requires that enumerations end with a count value (`*_NUM_VALUES`) and structs begin with a size value (`size_t size`). Wrapper templates are updated to support structs with different size values indicating different versions. To test: Run `ceftests --gtest_filter=ApiVersionTest.StructVersion*`
This commit is contained in:
		| @@ -1,39 +1,39 @@ | ||||
| { | ||||
|   "hashes": { | ||||
|     "13300": { | ||||
|       "comment": "Added January 08, 2025.", | ||||
|       "linux": "b28dd2bc398c54520f53918858d9859566133148", | ||||
|       "mac": "86f8d4989d208aac7dd3541bbc6ff88075616745", | ||||
|       "universal": "c14218e22e93d74f5027f1e0cbc86d6da98a0fac", | ||||
|       "windows": "da92cdf7a73d538aa6cfc4e29cf2a66934de01eb" | ||||
|       "comment": "Added January 09, 2025.", | ||||
|       "linux": "e1587dc51f661b5b04e62d6bf0bd843fa5eac11a", | ||||
|       "mac": "17d3b6eb33f5ed22cdacef535964126791059610", | ||||
|       "universal": "ff64648f9227db22b066b00af9e47e18b96b30ae", | ||||
|       "windows": "3c76176c289ff30bb52096d429ded4377edd9a0f" | ||||
|     }, | ||||
|     "13301": { | ||||
|       "comment": "Added January 08, 2025.", | ||||
|       "linux": "e53cef3578ebd6a94d94e0565259fb2a995d26f7", | ||||
|       "mac": "14e6580ffb351e088f12dda8c7b814ceb69da858", | ||||
|       "universal": "53b9b1a678dbf6b53e3c0c42baf2b35641872e82", | ||||
|       "windows": "b8391372b2fc5f79d6b1587c4ba25790f037c130" | ||||
|       "comment": "Added January 09, 2025.", | ||||
|       "linux": "180a9e77de7dad07c7352610f3f363144c45280e", | ||||
|       "mac": "a86b5dcffa3b9e4757ef16b20d91f6d0daa2e403", | ||||
|       "universal": "13935bdd9681f992dccff2e55d518b20baa3a239", | ||||
|       "windows": "db5f66a241482203f533eb267f4f5224408d277c" | ||||
|     }, | ||||
|     "13302": { | ||||
|       "comment": "Added January 08, 2025.", | ||||
|       "linux": "9b659891361935e5b4bf8a6562826c86431bde12", | ||||
|       "mac": "00892ce55726d571257198e923f81dace7a9a699", | ||||
|       "universal": "960ead4be4a039fe627ae851e816e68795b638e8", | ||||
|       "windows": "328d094ce8bac0243ec1efe2fc3ba803d72b77f7" | ||||
|       "comment": "Added January 09, 2025.", | ||||
|       "linux": "580ba12aeafc536cfbf9251110ff1f3e15d87aac", | ||||
|       "mac": "54a20f4ac36bd15ad10218f0068d18af3d04efe8", | ||||
|       "universal": "a3b248f23d3af14fd24851cbeb28697fef046f2c", | ||||
|       "windows": "fcf4556bf50e6d4cd59377271321cee6522fd3c2" | ||||
|     }, | ||||
|     "13303": { | ||||
|       "comment": "Added January 08, 2025.", | ||||
|       "linux": "087718083cd2da67c62b6288a4fe7ba632d113b6", | ||||
|       "mac": "4120f6e2c9a995e1c9fca90c9ab2c400507042e7", | ||||
|       "universal": "53c66d866967adc7449e48bb8e51946058b57245", | ||||
|       "windows": "5a403169280dc4c2f95354c05295adbdbb211c36" | ||||
|       "comment": "Added January 09, 2025.", | ||||
|       "linux": "24d10153ac286784204ea35c640e53d4bc937095", | ||||
|       "mac": "e4e2be4902e6c8bbeb53d53459be2aa2b4f8e940", | ||||
|       "universal": "b24a4ce14563c5863ed6bc43dcaf589ec78756a9", | ||||
|       "windows": "036217a6a9474322be0833079258c0375238c65c" | ||||
|     }, | ||||
|     "13304": { | ||||
|       "comment": "Added January 08, 2025.", | ||||
|       "linux": "01fa50f5adec33fd7e8ca6014a7ffcc61d400d16", | ||||
|       "mac": "3e8fe4fb648744f7463cc93cb2792a4257cf444b", | ||||
|       "universal": "add8483d49535805c27aa3e7411d6cd95f859d17", | ||||
|       "windows": "f9543142fec64abfb3b5b6229e1c482d7fc00d64" | ||||
|       "comment": "Added January 09, 2025.", | ||||
|       "linux": "8a0265bdf5375d9506cd6178265d8d77e02c9211", | ||||
|       "mac": "ba00fa76a7a14e529a1f157cefc74a9e81fb9fc8", | ||||
|       "universal": "c01bd6cb26be588948b0c16dde26324461b9e0b6", | ||||
|       "windows": "fb0eb5ac0461ea2d549808450017e87aeca74b94" | ||||
|     } | ||||
|   }, | ||||
|   "last": "13304", | ||||
|   | ||||
| @@ -186,6 +186,8 @@ if(OS_LINUX) | ||||
|   if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") | ||||
|     list(APPEND CEF_CXX_COMPILER_FLAGS | ||||
|       -Wno-attributes             # The cfi-icall attribute is not supported by the GNU C++ compiler | ||||
|       -Wno-array-bounds           # Silence "is partly outside array bounds" errors with runtime size check in wrapper | ||||
|       -Wno-stringop-overflow      # Silence "overflows the destination" errors with runtime size check in wrapper | ||||
|       ) | ||||
|   endif() | ||||
|  | ||||
|   | ||||
| @@ -53,7 +53,7 @@ class CefMainArgs : public cef_main_args_t { | ||||
| struct CefWindowInfoTraits { | ||||
|   typedef cef_window_info_t struct_type; | ||||
|  | ||||
|   static inline void init(struct_type* s) {} | ||||
|   static inline void init(struct_type* s) { s->size = sizeof(struct_type); } | ||||
|  | ||||
|   static inline void clear(struct_type* s) { | ||||
|     cef_string_clear(&s->window_name); | ||||
|   | ||||
| @@ -53,7 +53,7 @@ class CefMainArgs : public cef_main_args_t { | ||||
| struct CefWindowInfoTraits { | ||||
|   typedef cef_window_info_t struct_type; | ||||
|  | ||||
|   static inline void init(struct_type* s) {} | ||||
|   static inline void init(struct_type* s) { s->size = sizeof(struct_type); } | ||||
|  | ||||
|   static inline void clear(struct_type* s) { | ||||
|     cef_string_clear(&s->window_name); | ||||
|   | ||||
| @@ -83,6 +83,13 @@ typedef uint32_t cef_color_t; | ||||
| #define CefInt64GetHigh(int64_val) \ | ||||
|   static_cast<int32_t>((static_cast<int64_t>(int64_val) >> 32) & 0xFFFFFFFFL) | ||||
|  | ||||
| // Check that the structure |s|, which is defined with a `size_t size` member | ||||
| // at the top, is large enough to contain the specified member |f|. | ||||
| #define CEF_MEMBER_EXISTS(s, f)                                     \ | ||||
|   (reinterpret_cast<intptr_t>(&((s)->f)) -                          \ | ||||
|        reinterpret_cast<intptr_t>(&((s)->size)) + sizeof((s)->f) <= \ | ||||
|    (s)->size) | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
| @@ -726,6 +733,11 @@ typedef enum { | ||||
| /// URL component parts. | ||||
| /// | ||||
| typedef struct _cef_urlparts_t { | ||||
|   /// | ||||
|   /// Size of this structure. | ||||
|   /// | ||||
|   size_t size; | ||||
|  | ||||
|   /// | ||||
|   /// The complete URL specification. | ||||
|   /// | ||||
| @@ -798,12 +810,18 @@ typedef enum { | ||||
|   CEF_COOKIE_SAME_SITE_NO_RESTRICTION, | ||||
|   CEF_COOKIE_SAME_SITE_LAX_MODE, | ||||
|   CEF_COOKIE_SAME_SITE_STRICT_MODE, | ||||
|   CEF_COOKIE_SAME_SITE_NUM_VALUES, | ||||
| } cef_cookie_same_site_t; | ||||
|  | ||||
| /// | ||||
| /// Cookie information. | ||||
| /// | ||||
| typedef struct _cef_cookie_t { | ||||
|   /// | ||||
|   /// Size of this structure. | ||||
|   /// | ||||
|   size_t size; | ||||
|  | ||||
|   /// | ||||
|   /// The cookie name. | ||||
|   /// | ||||
| @@ -899,6 +917,8 @@ typedef enum { | ||||
|   /// On Windows, the OS terminated the process due to code integrity failure. | ||||
|   /// | ||||
|   TS_INTEGRITY_FAILURE, | ||||
|  | ||||
|   TS_NUM_VALUES, | ||||
| } cef_termination_status_t; | ||||
|  | ||||
| /// | ||||
| @@ -953,6 +973,8 @@ typedef enum { | ||||
|   /// CefSettings.resources_dir_path. | ||||
|   /// | ||||
|   PK_DIR_RESOURCES, | ||||
|  | ||||
|   PK_NUM_VALUES, | ||||
| } cef_path_key_t; | ||||
|  | ||||
| /// | ||||
| @@ -1104,6 +1126,8 @@ typedef enum { | ||||
|   CEF_RESULT_CODE_SANDBOX_FATAL_BROKER_SHUTDOWN_HUNG, | ||||
|  | ||||
|   CEF_RESULT_CODE_SANDBOX_FATAL_LAST, | ||||
|  | ||||
|   CEF_RESULT_CODE_NUM_VALUES, | ||||
| } cef_resultcode_t; | ||||
|  | ||||
| /// | ||||
| @@ -1174,7 +1198,7 @@ typedef enum { | ||||
|   /// | ||||
|   CEF_WOD_NEW_PICTURE_IN_PICTURE, | ||||
|  | ||||
|   CEF_WOD_MAX_VALUE = CEF_WOD_NEW_PICTURE_IN_PICTURE, | ||||
|   CEF_WOD_NUM_VALUES, | ||||
| } cef_window_open_disposition_t; | ||||
|  | ||||
| /// | ||||
| @@ -1209,7 +1233,7 @@ typedef enum { | ||||
|   CEF_TEXT_INPUT_MODE_DECIMAL, | ||||
|   CEF_TEXT_INPUT_MODE_SEARCH, | ||||
|  | ||||
|   CEF_TEXT_INPUT_MODE_MAX = CEF_TEXT_INPUT_MODE_SEARCH, | ||||
|   CEF_TEXT_INPUT_MODE_NUM_VALUES, | ||||
| } cef_text_input_mode_t; | ||||
|  | ||||
| /// | ||||
| @@ -1244,6 +1268,8 @@ typedef enum { | ||||
|   PDE_TYPE_EMPTY = 0, | ||||
|   PDE_TYPE_BYTES, | ||||
|   PDE_TYPE_FILE, | ||||
|  | ||||
|   PDF_TYPE_NUM_VALUES, | ||||
| } cef_postdataelement_type_t; | ||||
|  | ||||
| /// | ||||
| @@ -1351,6 +1377,8 @@ typedef enum { | ||||
|   /// A sub-frame service worker navigation preload request. | ||||
|   /// | ||||
|   RT_NAVIGATION_PRELOAD_SUB_FRAME, | ||||
|  | ||||
|   RT_NUM_VALUES, | ||||
| } cef_resource_type_t; | ||||
|  | ||||
| /// | ||||
| @@ -1363,20 +1391,20 @@ typedef enum { | ||||
|   /// also the default value for requests like sub-resource loads that are not | ||||
|   /// navigations. | ||||
|   /// | ||||
|   TT_LINK = 0, | ||||
|   TT_LINK, | ||||
|  | ||||
|   /// | ||||
|   /// Source is some other "explicit" navigation. This is the default value for | ||||
|   /// navigations where the actual type is unknown. See also | ||||
|   /// TT_DIRECT_LOAD_FLAG. | ||||
|   /// | ||||
|   TT_EXPLICIT = 1, | ||||
|   TT_EXPLICIT, | ||||
|  | ||||
|   /// | ||||
|   /// User got to this page through a suggestion in the UI (for example, via the | ||||
|   /// destinations page). Chrome style only. | ||||
|   /// | ||||
|   TT_AUTO_BOOKMARK = 2, | ||||
|   TT_AUTO_BOOKMARK, | ||||
|  | ||||
|   /// | ||||
|   /// Source is a subframe navigation. This is any content that is automatically | ||||
| @@ -1385,7 +1413,7 @@ typedef enum { | ||||
|   /// The user may not even realize the content in these pages is a separate | ||||
|   /// frame, so may not care about the URL. | ||||
|   /// | ||||
|   TT_AUTO_SUBFRAME = 3, | ||||
|   TT_AUTO_SUBFRAME, | ||||
|  | ||||
|   /// | ||||
|   /// Source is a subframe navigation explicitly requested by the user that will | ||||
| @@ -1394,7 +1422,7 @@ typedef enum { | ||||
|   /// the background because the user probably cares about the fact that this | ||||
|   /// link was loaded. | ||||
|   /// | ||||
|   TT_MANUAL_SUBFRAME = 4, | ||||
|   TT_MANUAL_SUBFRAME, | ||||
|  | ||||
|   /// | ||||
|   /// User got to this page by typing in the URL bar and selecting an entry | ||||
| @@ -1404,7 +1432,7 @@ typedef enum { | ||||
|   /// didn't type or see the destination URL. Chrome style only. | ||||
|   /// See also TT_KEYWORD. | ||||
|   /// | ||||
|   TT_GENERATED = 5, | ||||
|   TT_GENERATED, | ||||
|  | ||||
|   /// | ||||
|   /// This is a toplevel navigation. This is any content that is automatically | ||||
| @@ -1413,21 +1441,21 @@ typedef enum { | ||||
|   /// browsing warning, opening web-based dialog boxes are examples of | ||||
|   /// AUTO_TOPLEVEL navigations. Chrome style only. | ||||
|   /// | ||||
|   TT_AUTO_TOPLEVEL = 6, | ||||
|   TT_AUTO_TOPLEVEL, | ||||
|  | ||||
|   /// | ||||
|   /// Source is a form submission by the user. NOTE: In some situations | ||||
|   /// submitting a form does not result in this transition type. This can happen | ||||
|   /// if the form uses a script to submit the contents. | ||||
|   /// | ||||
|   TT_FORM_SUBMIT = 7, | ||||
|   TT_FORM_SUBMIT, | ||||
|  | ||||
|   /// | ||||
|   /// Source is a "reload" of the page via the Reload function or by re-visiting | ||||
|   /// the same URL. NOTE: This is distinct from the concept of whether a | ||||
|   /// particular load uses "reload semantics" (i.e. bypasses cached data). | ||||
|   /// | ||||
|   TT_RELOAD = 8, | ||||
|   TT_RELOAD, | ||||
|  | ||||
|   /// | ||||
|   /// The url was generated from a replaceable keyword other than the default | ||||
| @@ -1440,13 +1468,15 @@ typedef enum { | ||||
|   /// TT_KEYWORD, and TemplateURLModel generates a visit for 'wikipedia.org' | ||||
|   /// with a transition type of TT_KEYWORD_GENERATED. Chrome style only. | ||||
|   /// | ||||
|   TT_KEYWORD = 9, | ||||
|   TT_KEYWORD, | ||||
|  | ||||
|   /// | ||||
|   /// Corresponds to a visit generated for a keyword. See description of | ||||
|   /// TT_KEYWORD for more details. Chrome style only. | ||||
|   /// | ||||
|   TT_KEYWORD_GENERATED = 10, | ||||
|   TT_KEYWORD_GENERATED, | ||||
|  | ||||
|   TT_NUM_VALUES, | ||||
|  | ||||
|   /// | ||||
|   /// General mask defining the bits used for the source values. | ||||
| @@ -1586,7 +1616,7 @@ typedef enum { | ||||
|   /// | ||||
|   /// Unknown status. | ||||
|   /// | ||||
|   UR_UNKNOWN = 0, | ||||
|   UR_UNKNOWN, | ||||
|  | ||||
|   /// | ||||
|   /// Request succeeded. | ||||
| @@ -1608,6 +1638,8 @@ typedef enum { | ||||
|   /// Request failed for some reason. | ||||
|   /// | ||||
|   UR_FAILED, | ||||
|  | ||||
|   UR_NUM_VALUES, | ||||
| } cef_urlrequest_status_t; | ||||
|  | ||||
| /// Structure representing a draggable region. | ||||
| @@ -1707,6 +1739,8 @@ typedef enum { | ||||
|   /// time without warning). | ||||
|   /// | ||||
|   TID_RENDERER, | ||||
|  | ||||
|   TID_NUM_VALUES, | ||||
| } cef_thread_id_t; | ||||
|  | ||||
| /// | ||||
| @@ -1732,6 +1766,8 @@ typedef enum { | ||||
|   /// Suitable for low-latency, glitch-resistant audio. | ||||
|   /// | ||||
|   TP_REALTIME_AUDIO, | ||||
|  | ||||
|   TP_NUM_VALUES, | ||||
| } cef_thread_priority_t; | ||||
|  | ||||
| /// | ||||
| @@ -1753,6 +1789,8 @@ typedef enum { | ||||
|   /// Supports tasks, timers and asynchronous IO events. | ||||
|   /// | ||||
|   ML_TYPE_IO, | ||||
|  | ||||
|   ML_NUM_VALUES, | ||||
| } cef_message_loop_type_t; | ||||
|  | ||||
| /// | ||||
| @@ -1780,7 +1818,7 @@ typedef enum { | ||||
| /// Supported value types. | ||||
| /// | ||||
| typedef enum { | ||||
|   VTYPE_INVALID = 0, | ||||
|   VTYPE_INVALID, | ||||
|   VTYPE_NULL, | ||||
|   VTYPE_BOOL, | ||||
|   VTYPE_INT, | ||||
| @@ -1789,15 +1827,19 @@ typedef enum { | ||||
|   VTYPE_BINARY, | ||||
|   VTYPE_DICTIONARY, | ||||
|   VTYPE_LIST, | ||||
|  | ||||
|   VTYPE_NUM_VALUES, | ||||
| } cef_value_type_t; | ||||
|  | ||||
| /// | ||||
| /// Supported JavaScript dialog types. | ||||
| /// | ||||
| typedef enum { | ||||
|   JSDIALOGTYPE_ALERT = 0, | ||||
|   JSDIALOGTYPE_ALERT, | ||||
|   JSDIALOGTYPE_CONFIRM, | ||||
|   JSDIALOGTYPE_PROMPT, | ||||
|  | ||||
|   JSDIALOGTYPE_NUM_VALUES, | ||||
| } cef_jsdialog_type_t; | ||||
|  | ||||
| /// | ||||
| @@ -1806,6 +1848,11 @@ typedef enum { | ||||
| /// filled in by the client. | ||||
| /// | ||||
| typedef struct _cef_screen_info_t { | ||||
|   /// | ||||
|   /// Size of this structure. | ||||
|   /// | ||||
|   size_t size; | ||||
|  | ||||
|   /// | ||||
|   /// Device scale factor. Specifies the ratio between physical and logical | ||||
|   /// pixels. | ||||
| @@ -1863,6 +1910,11 @@ typedef struct _cef_screen_info_t { | ||||
| /// display the application's information (e.g., icons). | ||||
| /// | ||||
| typedef struct _cef_linux_window_properties_t { | ||||
|   /// | ||||
|   /// Size of this structure. | ||||
|   /// | ||||
|   size_t size; | ||||
|  | ||||
|   /// | ||||
|   /// Main window's Wayland's app_id | ||||
|   /// | ||||
| @@ -2157,6 +2209,8 @@ typedef enum { | ||||
|   /// A plugin node is selected. | ||||
|   /// | ||||
|   CM_MEDIATYPE_PLUGIN, | ||||
|  | ||||
|   CM_MEDIATYPE_NUM_VALUES, | ||||
| } cef_context_menu_media_type_t; | ||||
|  | ||||
| /// | ||||
| @@ -2243,6 +2297,11 @@ typedef enum { | ||||
| /// Structure representing keyboard event information. | ||||
| /// | ||||
| typedef struct _cef_key_event_t { | ||||
|   /// | ||||
|   /// Size of this structure. | ||||
|   /// | ||||
|   size_t size; | ||||
|  | ||||
|   /// | ||||
|   /// The type of keyboard event. | ||||
|   /// | ||||
| @@ -2299,23 +2358,26 @@ typedef enum { | ||||
|   /// | ||||
|   /// The source is explicit navigation via the API (LoadURL(), etc). | ||||
|   /// | ||||
|   FOCUS_SOURCE_NAVIGATION = 0, | ||||
|   FOCUS_SOURCE_NAVIGATION, | ||||
|   /// | ||||
|   /// The source is a system-generated focus event. | ||||
|   /// | ||||
|   FOCUS_SOURCE_SYSTEM, | ||||
|  | ||||
|   FOCUS_SOURCE_NUM_VALUES, | ||||
| } cef_focus_source_t; | ||||
|  | ||||
| /// | ||||
| /// Navigation types. | ||||
| /// | ||||
| typedef enum { | ||||
|   NAVIGATION_LINK_CLICKED = 0, | ||||
|   NAVIGATION_LINK_CLICKED, | ||||
|   NAVIGATION_FORM_SUBMITTED, | ||||
|   NAVIGATION_BACK_FORWARD, | ||||
|   NAVIGATION_RELOAD, | ||||
|   NAVIGATION_FORM_RESUBMITTED, | ||||
|   NAVIGATION_OTHER, | ||||
|   NAVIGATION_NUM_VALUES, | ||||
| } cef_navigation_type_t; | ||||
|  | ||||
| /// | ||||
| @@ -2325,18 +2387,19 @@ typedef enum { | ||||
| /// decoder is available then that decoder will be used automatically. | ||||
| /// | ||||
| typedef enum { | ||||
|   XML_ENCODING_NONE = 0, | ||||
|   XML_ENCODING_NONE, | ||||
|   XML_ENCODING_UTF8, | ||||
|   XML_ENCODING_UTF16LE, | ||||
|   XML_ENCODING_UTF16BE, | ||||
|   XML_ENCODING_ASCII, | ||||
|   XML_ENCODING_NUM_VALUES, | ||||
| } cef_xml_encoding_type_t; | ||||
|  | ||||
| /// | ||||
| /// XML node types. | ||||
| /// | ||||
| typedef enum { | ||||
|   XML_NODE_UNSUPPORTED = 0, | ||||
|   XML_NODE_UNSUPPORTED, | ||||
|   XML_NODE_PROCESSING_INSTRUCTION, | ||||
|   XML_NODE_DOCUMENT_TYPE, | ||||
|   XML_NODE_ELEMENT_START, | ||||
| @@ -2347,12 +2410,18 @@ typedef enum { | ||||
|   XML_NODE_ENTITY_REFERENCE, | ||||
|   XML_NODE_WHITESPACE, | ||||
|   XML_NODE_COMMENT, | ||||
|   XML_NODE_NUM_VALUES, | ||||
| } cef_xml_node_type_t; | ||||
|  | ||||
| /// | ||||
| /// Popup window features. | ||||
| /// | ||||
| typedef struct _cef_popup_features_t { | ||||
|   /// | ||||
|   /// Size of this structure. | ||||
|   /// | ||||
|   size_t size; | ||||
|  | ||||
|   int x; | ||||
|   int xSet; | ||||
|   int y; | ||||
| @@ -2362,7 +2431,9 @@ typedef struct _cef_popup_features_t { | ||||
|   int height; | ||||
|   int heightSet; | ||||
|  | ||||
|   /// | ||||
|   /// True (1) if browser interface elements should be hidden. | ||||
|   /// | ||||
|   int isPopup; | ||||
| } cef_popup_features_t; | ||||
|  | ||||
| @@ -2370,10 +2441,11 @@ typedef struct _cef_popup_features_t { | ||||
| /// DOM document types. | ||||
| /// | ||||
| typedef enum { | ||||
|   DOM_DOCUMENT_TYPE_UNKNOWN = 0, | ||||
|   DOM_DOCUMENT_TYPE_UNKNOWN, | ||||
|   DOM_DOCUMENT_TYPE_HTML, | ||||
|   DOM_DOCUMENT_TYPE_XHTML, | ||||
|   DOM_DOCUMENT_TYPE_PLUGIN, | ||||
|   DOM_DOCUMENT_TYPE_NUM_VALUES, | ||||
| } cef_dom_document_type_t; | ||||
|  | ||||
| /// | ||||
| @@ -2403,17 +2475,18 @@ typedef enum { | ||||
| /// DOM event processing phases. | ||||
| /// | ||||
| typedef enum { | ||||
|   DOM_EVENT_PHASE_UNKNOWN = 0, | ||||
|   DOM_EVENT_PHASE_UNKNOWN, | ||||
|   DOM_EVENT_PHASE_CAPTURING, | ||||
|   DOM_EVENT_PHASE_AT_TARGET, | ||||
|   DOM_EVENT_PHASE_BUBBLING, | ||||
|   DOM_EVENT_PHASE_NUM_VALUES, | ||||
| } cef_dom_event_phase_t; | ||||
|  | ||||
| /// | ||||
| /// DOM node types. | ||||
| /// | ||||
| typedef enum { | ||||
|   DOM_NODE_TYPE_UNSUPPORTED = 0, | ||||
|   DOM_NODE_TYPE_UNSUPPORTED, | ||||
|   DOM_NODE_TYPE_ELEMENT, | ||||
|   DOM_NODE_TYPE_ATTRIBUTE, | ||||
|   DOM_NODE_TYPE_TEXT, | ||||
| @@ -2423,6 +2496,7 @@ typedef enum { | ||||
|   DOM_NODE_TYPE_DOCUMENT, | ||||
|   DOM_NODE_TYPE_DOCUMENT_TYPE, | ||||
|   DOM_NODE_TYPE_DOCUMENT_FRAGMENT, | ||||
|   DOM_NODE_TYPE_NUM_VALUES, | ||||
| } cef_dom_node_type_t; | ||||
|  | ||||
| /// | ||||
| @@ -2430,7 +2504,7 @@ typedef enum { | ||||
| /// blink::mojom::FormControlType type. | ||||
| /// | ||||
| typedef enum { | ||||
|   DOM_FORM_CONTROL_TYPE_UNSUPPORTED = 0, | ||||
|   DOM_FORM_CONTROL_TYPE_UNSUPPORTED, | ||||
|   DOM_FORM_CONTROL_TYPE_BUTTON_BUTTON, | ||||
|   DOM_FORM_CONTROL_TYPE_BUTTON_SUBMIT, | ||||
|   DOM_FORM_CONTROL_TYPE_BUTTON_RESET, | ||||
| @@ -2462,6 +2536,7 @@ typedef enum { | ||||
|   DOM_FORM_CONTROL_TYPE_SELECT_ONE, | ||||
|   DOM_FORM_CONTROL_TYPE_SELECT_MULTIPLE, | ||||
|   DOM_FORM_CONTROL_TYPE_TEXT_AREA, | ||||
|   DOM_FORM_CONTROL_TYPE_NUM_VALUES, | ||||
| } cef_dom_form_control_type_t; | ||||
|  | ||||
| /// | ||||
| @@ -2471,7 +2546,7 @@ typedef enum { | ||||
|   /// | ||||
|   /// Requires that the file exists before allowing the user to pick it. | ||||
|   /// | ||||
|   FILE_DIALOG_OPEN = 0, | ||||
|   FILE_DIALOG_OPEN, | ||||
|  | ||||
|   /// | ||||
|   /// Like Open, but allows picking multiple files to open. | ||||
| @@ -2488,6 +2563,8 @@ typedef enum { | ||||
|   /// already exists. | ||||
|   /// | ||||
|   FILE_DIALOG_SAVE, | ||||
|  | ||||
|   FILE_DIALOG_NUM_VALUES, | ||||
| } cef_file_dialog_mode_t; | ||||
|  | ||||
| /// | ||||
| @@ -2515,6 +2592,7 @@ typedef enum { | ||||
|   COLOR_MODEL_PROCESSCOLORMODEL_CMYK,       // Used in canon printer ppds. | ||||
|   COLOR_MODEL_PROCESSCOLORMODEL_GREYSCALE,  // Used in canon printer ppds. | ||||
|   COLOR_MODEL_PROCESSCOLORMODEL_RGB,        // Used in canon printer ppds | ||||
|   COLOR_MODEL_NUM_VALUES, | ||||
| } cef_color_model_t; | ||||
|  | ||||
| /// | ||||
| @@ -2525,13 +2603,14 @@ typedef enum { | ||||
|   DUPLEX_MODE_SIMPLEX, | ||||
|   DUPLEX_MODE_LONG_EDGE, | ||||
|   DUPLEX_MODE_SHORT_EDGE, | ||||
|   DUPLEX_MODE_NUM_VALUES, | ||||
| } cef_duplex_mode_t; | ||||
|  | ||||
| /// | ||||
| /// Cursor type values. | ||||
| /// | ||||
| typedef enum { | ||||
|   CT_POINTER = 0, | ||||
|   CT_POINTER, | ||||
|   CT_CROSS, | ||||
|   CT_HAND, | ||||
|   CT_IBEAM, | ||||
| @@ -2581,6 +2660,7 @@ typedef enum { | ||||
|   CT_DND_MOVE, | ||||
|   CT_DND_COPY, | ||||
|   CT_DND_LINK, | ||||
|   CT_NUM_VALUES, | ||||
| } cef_cursor_type_t; | ||||
|  | ||||
| /// | ||||
| @@ -2721,6 +2801,11 @@ typedef enum { | ||||
| /// https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-printToPDF | ||||
| /// | ||||
| typedef struct _cef_pdf_print_settings_t { | ||||
|   /// | ||||
|   /// Size of this structure. | ||||
|   /// | ||||
|   size_t size; | ||||
|  | ||||
|   /// | ||||
|   /// Set to true (1) for landscape mode or false (0) for portrait mode. | ||||
|   /// | ||||
| @@ -2823,7 +2908,7 @@ typedef struct _cef_pdf_print_settings_t { | ||||
| /// can be used for any scale factors (such as wallpapers). | ||||
| /// | ||||
| typedef enum { | ||||
|   SCALE_FACTOR_NONE = 0, | ||||
|   SCALE_FACTOR_NONE, | ||||
|   SCALE_FACTOR_100P, | ||||
|   SCALE_FACTOR_125P, | ||||
|   SCALE_FACTOR_133P, | ||||
| @@ -2833,6 +2918,7 @@ typedef enum { | ||||
|   SCALE_FACTOR_200P, | ||||
|   SCALE_FACTOR_250P, | ||||
|   SCALE_FACTOR_300P, | ||||
|   SCALE_FACTOR_NUM_VALUES, | ||||
| } cef_scale_factor_t; | ||||
|  | ||||
| /// | ||||
| @@ -2893,7 +2979,7 @@ typedef enum { | ||||
|   REFERRER_POLICY_NO_REFERRER, | ||||
|  | ||||
|   /// Always the last value in this enumeration. | ||||
|   REFERRER_POLICY_LAST_VALUE = REFERRER_POLICY_NO_REFERRER, | ||||
|   REFERRER_POLICY_NUM_VALUES, | ||||
| } cef_referrer_policy_t; | ||||
|  | ||||
| /// | ||||
| @@ -2947,6 +3033,7 @@ typedef enum { | ||||
|   CEF_TEXT_STYLE_STRIKE, | ||||
|   CEF_TEXT_STYLE_DIAGONAL_STRIKE, | ||||
|   CEF_TEXT_STYLE_UNDERLINE, | ||||
|   CEF_TEXT_STYLE_NUM_VALUES, | ||||
| } cef_text_style_t; | ||||
|  | ||||
| /// | ||||
| @@ -2965,12 +3052,19 @@ typedef enum { | ||||
|  | ||||
|   /// Child views will be stretched to fit. | ||||
|   CEF_AXIS_ALIGNMENT_STRETCH, | ||||
|  | ||||
|   CEF_AXIS_ALIGNMENT_NUM_VALUES, | ||||
| } cef_axis_alignment_t; | ||||
|  | ||||
| /// | ||||
| /// Settings used when initializing a CefBoxLayout. | ||||
| /// | ||||
| typedef struct _cef_box_layout_settings_t { | ||||
|   /// | ||||
|   /// Size of this structure. | ||||
|   /// | ||||
|   size_t size; | ||||
|  | ||||
|   /// | ||||
|   /// If true (1) the layout will be horizontal, otherwise the layout will be | ||||
|   /// vertical. | ||||
| @@ -3033,6 +3127,7 @@ typedef enum { | ||||
|   CEF_BUTTON_STATE_HOVERED, | ||||
|   CEF_BUTTON_STATE_PRESSED, | ||||
|   CEF_BUTTON_STATE_DISABLED, | ||||
|   CEF_BUTTON_STATE_NUM_VALUES, | ||||
| } cef_button_state_t; | ||||
|  | ||||
| /// | ||||
| @@ -3063,6 +3158,7 @@ typedef enum { | ||||
|   CEF_MENU_ANCHOR_TOPLEFT, | ||||
|   CEF_MENU_ANCHOR_TOPRIGHT, | ||||
|   CEF_MENU_ANCHOR_BOTTOMCENTER, | ||||
|   CEF_MENU_ANCHOR_NUM_VALUES, | ||||
| } cef_menu_anchor_position_t; | ||||
|  | ||||
| /// | ||||
| @@ -3075,20 +3171,22 @@ typedef enum { | ||||
|   CEF_MENU_COLOR_TEXT_ACCELERATOR_HOVERED, | ||||
|   CEF_MENU_COLOR_BACKGROUND, | ||||
|   CEF_MENU_COLOR_BACKGROUND_HOVERED, | ||||
|   CEF_MENU_COLOR_COUNT, | ||||
|   CEF_MENU_COLOR_NUM_VALUES, | ||||
| } cef_menu_color_type_t; | ||||
|  | ||||
| /// Supported SSL version values. See net/ssl/ssl_connection_status_flags.h | ||||
| /// for more information. | ||||
| typedef enum { | ||||
|   SSL_CONNECTION_VERSION_UNKNOWN = 0,  // Unknown SSL version. | ||||
|   SSL_CONNECTION_VERSION_SSL2 = 1, | ||||
|   SSL_CONNECTION_VERSION_SSL3 = 2, | ||||
|   SSL_CONNECTION_VERSION_TLS1 = 3, | ||||
|   SSL_CONNECTION_VERSION_TLS1_1 = 4, | ||||
|   SSL_CONNECTION_VERSION_TLS1_2 = 5, | ||||
|   SSL_CONNECTION_VERSION_TLS1_3 = 6, | ||||
|   SSL_CONNECTION_VERSION_QUIC = 7, | ||||
|   /// Unknown SSL version. | ||||
|   SSL_CONNECTION_VERSION_UNKNOWN, | ||||
|   SSL_CONNECTION_VERSION_SSL2, | ||||
|   SSL_CONNECTION_VERSION_SSL3, | ||||
|   SSL_CONNECTION_VERSION_TLS1, | ||||
|   SSL_CONNECTION_VERSION_TLS1_1, | ||||
|   SSL_CONNECTION_VERSION_TLS1_2, | ||||
|   SSL_CONNECTION_VERSION_TLS1_3, | ||||
|   SSL_CONNECTION_VERSION_QUIC, | ||||
|   SSL_CONNECTION_VERSION_NUM_VALUES, | ||||
| } cef_ssl_version_t; | ||||
|  | ||||
| /// Supported SSL content status flags. See content/public/common/ssl_status.h | ||||
| @@ -3200,6 +3298,7 @@ typedef enum { | ||||
|   CEF_CUS_DOT, | ||||
|   CEF_CUS_DASH, | ||||
|   CEF_CUS_NONE, | ||||
|   CEF_CUS_NUM_VALUES, | ||||
| } cef_composition_underline_style_t; | ||||
|  | ||||
| /// | ||||
| @@ -3208,6 +3307,11 @@ typedef enum { | ||||
| /// sync with that. | ||||
| /// | ||||
| typedef struct _cef_composition_underline_t { | ||||
|   /// | ||||
|   /// Size of this structure. | ||||
|   /// | ||||
|   size_t size; | ||||
|  | ||||
|   /// | ||||
|   /// Underline character range. | ||||
|   /// | ||||
| @@ -3240,122 +3344,121 @@ typedef struct _cef_composition_underline_t { | ||||
| /// See media\base\channel_layout.h | ||||
| /// | ||||
| typedef enum { | ||||
|   CEF_CHANNEL_LAYOUT_NONE = 0, | ||||
|   CEF_CHANNEL_LAYOUT_UNSUPPORTED = 1, | ||||
|   CEF_CHANNEL_LAYOUT_NONE, | ||||
|   CEF_CHANNEL_LAYOUT_UNSUPPORTED, | ||||
|  | ||||
|   /// Front C | ||||
|   CEF_CHANNEL_LAYOUT_MONO = 2, | ||||
|   CEF_CHANNEL_LAYOUT_MONO, | ||||
|  | ||||
|   /// Front L, Front R | ||||
|   CEF_CHANNEL_LAYOUT_STEREO = 3, | ||||
|   CEF_CHANNEL_LAYOUT_STEREO, | ||||
|  | ||||
|   /// Front L, Front R, Back C | ||||
|   CEF_CHANNEL_LAYOUT_2_1 = 4, | ||||
|   CEF_CHANNEL_LAYOUT_2_1, | ||||
|  | ||||
|   /// Front L, Front R, Front C | ||||
|   CEF_CHANNEL_LAYOUT_SURROUND = 5, | ||||
|   CEF_CHANNEL_LAYOUT_SURROUND, | ||||
|  | ||||
|   /// Front L, Front R, Front C, Back C | ||||
|   CEF_CHANNEL_LAYOUT_4_0 = 6, | ||||
|   CEF_CHANNEL_LAYOUT_4_0, | ||||
|  | ||||
|   /// Front L, Front R, Side L, Side R | ||||
|   CEF_CHANNEL_LAYOUT_2_2 = 7, | ||||
|   CEF_CHANNEL_LAYOUT_2_2, | ||||
|  | ||||
|   /// Front L, Front R, Back L, Back R | ||||
|   CEF_CHANNEL_LAYOUT_QUAD = 8, | ||||
|   CEF_CHANNEL_LAYOUT_QUAD, | ||||
|  | ||||
|   /// Front L, Front R, Front C, Side L, Side R | ||||
|   CEF_CHANNEL_LAYOUT_5_0 = 9, | ||||
|   CEF_CHANNEL_LAYOUT_5_0, | ||||
|  | ||||
|   /// Front L, Front R, Front C, LFE, Side L, Side R | ||||
|   CEF_CHANNEL_LAYOUT_5_1 = 10, | ||||
|   CEF_CHANNEL_LAYOUT_5_1, | ||||
|  | ||||
|   /// Front L, Front R, Front C, Back L, Back R | ||||
|   CEF_CHANNEL_LAYOUT_5_0_BACK = 11, | ||||
|   CEF_CHANNEL_LAYOUT_5_0_BACK, | ||||
|  | ||||
|   /// Front L, Front R, Front C, LFE, Back L, Back R | ||||
|   CEF_CHANNEL_LAYOUT_5_1_BACK = 12, | ||||
|   CEF_CHANNEL_LAYOUT_5_1_BACK, | ||||
|  | ||||
|   /// Front L, Front R, Front C, Back L, Back R, Side L, Side R | ||||
|   CEF_CHANNEL_LAYOUT_7_0 = 13, | ||||
|   CEF_CHANNEL_LAYOUT_7_0, | ||||
|  | ||||
|   /// Front L, Front R, Front C, LFE, Back L, Back R, Side L, Side R | ||||
|   CEF_CHANNEL_LAYOUT_7_1 = 14, | ||||
|   CEF_CHANNEL_LAYOUT_7_1, | ||||
|  | ||||
|   /// Front L, Front R, Front C, LFE, Front LofC, Front RofC, Side L, Side R | ||||
|   CEF_CHANNEL_LAYOUT_7_1_WIDE = 15, | ||||
|   CEF_CHANNEL_LAYOUT_7_1_WIDE, | ||||
|  | ||||
|   /// Front L, Front R | ||||
|   CEF_CHANNEL_LAYOUT_STEREO_DOWNMIX = 16, | ||||
|   CEF_CHANNEL_LAYOUT_STEREO_DOWNMIX, | ||||
|  | ||||
|   /// Front L, Front R, LFE | ||||
|   CEF_CHANNEL_LAYOUT_2POINT1 = 17, | ||||
|   CEF_CHANNEL_LAYOUT_2POINT1, | ||||
|  | ||||
|   /// Front L, Front R, Front C, LFE | ||||
|   CEF_CHANNEL_LAYOUT_3_1 = 18, | ||||
|   CEF_CHANNEL_LAYOUT_3_1, | ||||
|  | ||||
|   /// Front L, Front R, Front C, LFE, Back C | ||||
|   CEF_CHANNEL_LAYOUT_4_1 = 19, | ||||
|   CEF_CHANNEL_LAYOUT_4_1, | ||||
|  | ||||
|   /// Front L, Front R, Front C, Back C, Side L, Side R | ||||
|   CEF_CHANNEL_LAYOUT_6_0 = 20, | ||||
|   CEF_CHANNEL_LAYOUT_6_0, | ||||
|  | ||||
|   /// Front L, Front R, Front LofC, Front RofC, Side L, Side R | ||||
|   CEF_CHANNEL_LAYOUT_6_0_FRONT = 21, | ||||
|   CEF_CHANNEL_LAYOUT_6_0_FRONT, | ||||
|  | ||||
|   /// Front L, Front R, Front C, Back L, Back R, Back C | ||||
|   CEF_CHANNEL_LAYOUT_HEXAGONAL = 22, | ||||
|   CEF_CHANNEL_LAYOUT_HEXAGONAL, | ||||
|  | ||||
|   /// Front L, Front R, Front C, LFE, Back C, Side L, Side R | ||||
|   CEF_CHANNEL_LAYOUT_6_1 = 23, | ||||
|   CEF_CHANNEL_LAYOUT_6_1, | ||||
|  | ||||
|   /// Front L, Front R, Front C, LFE, Back L, Back R, Back C | ||||
|   CEF_CHANNEL_LAYOUT_6_1_BACK = 24, | ||||
|   CEF_CHANNEL_LAYOUT_6_1_BACK, | ||||
|  | ||||
|   /// Front L, Front R, LFE, Front LofC, Front RofC, Side L, Side R | ||||
|   CEF_CHANNEL_LAYOUT_6_1_FRONT = 25, | ||||
|   CEF_CHANNEL_LAYOUT_6_1_FRONT, | ||||
|  | ||||
|   /// Front L, Front R, Front C, Front LofC, Front RofC, Side L, Side R | ||||
|   CEF_CHANNEL_LAYOUT_7_0_FRONT = 26, | ||||
|   CEF_CHANNEL_LAYOUT_7_0_FRONT, | ||||
|  | ||||
|   /// Front L, Front R, Front C, LFE, Back L, Back R, Front LofC, Front RofC | ||||
|   CEF_CHANNEL_LAYOUT_7_1_WIDE_BACK = 27, | ||||
|   CEF_CHANNEL_LAYOUT_7_1_WIDE_BACK, | ||||
|  | ||||
|   /// Front L, Front R, Front C, Back L, Back R, Back C, Side L, Side R | ||||
|   CEF_CHANNEL_LAYOUT_OCTAGONAL = 28, | ||||
|   CEF_CHANNEL_LAYOUT_OCTAGONAL, | ||||
|  | ||||
|   /// Channels are not explicitly mapped to speakers. | ||||
|   CEF_CHANNEL_LAYOUT_DISCRETE = 29, | ||||
|   CEF_CHANNEL_LAYOUT_DISCRETE, | ||||
|  | ||||
|   /// Deprecated, but keeping the enum value for UMA consistency. | ||||
|   /// Front L, Front R, Front C. Front C contains the keyboard mic audio. This | ||||
|   /// layout is only intended for input for WebRTC. The Front C channel | ||||
|   /// is stripped away in the WebRTC audio input pipeline and never seen outside | ||||
|   /// of that. | ||||
|   CEF_CHANNEL_LAYOUT_STEREO_AND_KEYBOARD_MIC = 30, | ||||
|   CEF_CHANNEL_LAYOUT_STEREO_AND_KEYBOARD_MIC, | ||||
|  | ||||
|   /// Front L, Front R, LFE, Side L, Side R | ||||
|   CEF_CHANNEL_LAYOUT_4_1_QUAD_SIDE = 31, | ||||
|   CEF_CHANNEL_LAYOUT_4_1_QUAD_SIDE, | ||||
|  | ||||
|   /// Actual channel layout is specified in the bitstream and the actual channel | ||||
|   /// count is unknown at Chromium media pipeline level (useful for audio | ||||
|   /// pass-through mode). | ||||
|   CEF_CHANNEL_LAYOUT_BITSTREAM = 32, | ||||
|   CEF_CHANNEL_LAYOUT_BITSTREAM, | ||||
|  | ||||
|   /// Front L, Front R, Front C, LFE, Side L, Side R, | ||||
|   /// Front Height L, Front Height R, Rear Height L, Rear Height R | ||||
|   /// Will be represented as six channels (5.1) due to eight channel limit | ||||
|   /// kMaxConcurrentChannels | ||||
|   CEF_CHANNEL_LAYOUT_5_1_4_DOWNMIX = 33, | ||||
|   CEF_CHANNEL_LAYOUT_5_1_4_DOWNMIX, | ||||
|  | ||||
|   /// Front C, LFE | ||||
|   CEF_CHANNEL_LAYOUT_1_1 = 34, | ||||
|   CEF_CHANNEL_LAYOUT_1_1, | ||||
|  | ||||
|   /// Front L, Front R, LFE, Back C | ||||
|   CEF_CHANNEL_LAYOUT_3_1_BACK = 35, | ||||
|   CEF_CHANNEL_LAYOUT_3_1_BACK, | ||||
|  | ||||
|   /// Max value, must always equal the largest entry ever logged. | ||||
|   CEF_CHANNEL_LAYOUT_MAX = CEF_CHANNEL_LAYOUT_3_1_BACK | ||||
|   CEF_CHANNEL_NUM_VALUES, | ||||
| } cef_channel_layout_t; | ||||
|  | ||||
| /// | ||||
| @@ -3363,6 +3466,11 @@ typedef enum { | ||||
| /// handler. | ||||
| /// | ||||
| typedef struct _cef_audio_parameters_t { | ||||
|   /// | ||||
|   /// Size of this structure. | ||||
|   /// | ||||
|   size_t size; | ||||
|  | ||||
|   /// | ||||
|   /// Layout of the audio channels | ||||
|   /// | ||||
| @@ -3384,27 +3492,35 @@ typedef struct _cef_audio_parameters_t { | ||||
| /// Chromium's media_router::mojom::RouteRequestResultCode type. | ||||
| /// | ||||
| typedef enum { | ||||
|   CEF_MRCR_UNKNOWN_ERROR = 0, | ||||
|   CEF_MRCR_OK = 1, | ||||
|   CEF_MRCR_TIMED_OUT = 2, | ||||
|   CEF_MRCR_ROUTE_NOT_FOUND = 3, | ||||
|   CEF_MRCR_SINK_NOT_FOUND = 4, | ||||
|   CEF_MRCR_INVALID_ORIGIN = 5, | ||||
|   CEF_MRCR_NO_SUPPORTED_PROVIDER = 7, | ||||
|   CEF_MRCR_CANCELLED = 8, | ||||
|   CEF_MRCR_ROUTE_ALREADY_EXISTS = 9, | ||||
|   CEF_MRCR_ROUTE_ALREADY_TERMINATED = 11, | ||||
|   CEF_MRCR_UNKNOWN_ERROR, | ||||
|   CEF_MRCR_OK, | ||||
|   CEF_MRCR_TIMED_OUT, | ||||
|   CEF_MRCR_ROUTE_NOT_FOUND, | ||||
|   CEF_MRCR_SINK_NOT_FOUND, | ||||
|   CEF_MRCR_INVALID_ORIGIN, | ||||
|   CEF_MRCR_OFF_THE_RECORD_MISMATCH_DEPRECATED, | ||||
|   CEF_MRCR_NO_SUPPORTED_PROVIDER, | ||||
|   CEF_MRCR_CANCELLED, | ||||
|   CEF_MRCR_ROUTE_ALREADY_EXISTS, | ||||
|   CEF_MRCR_DESKTOP_PICKER_FAILED, | ||||
|   CEF_MRCR_ROUTE_ALREADY_TERMINATED, | ||||
|   CEF_MRCR_REDUNDANT_REQUEST, | ||||
|   CEF_MRCR_USER_NOT_ALLOWED, | ||||
|   CEF_MRCR_NOTIFICATION_DISABLED, | ||||
|   CEF_MRCR_NUM_VALUES, | ||||
| } cef_media_route_create_result_t; | ||||
|  | ||||
| /// | ||||
| /// Connection state for a MediaRoute object. | ||||
| /// Connection state for a MediaRoute object. Should be kept in sync with | ||||
| /// Chromium's blink::mojom::PresentationConnectionState type. | ||||
| /// | ||||
| typedef enum { | ||||
|   CEF_MRCS_UNKNOWN, | ||||
|   CEF_MRCS_UNKNOWN = -1, | ||||
|   CEF_MRCS_CONNECTING, | ||||
|   CEF_MRCS_CONNECTED, | ||||
|   CEF_MRCS_CLOSED, | ||||
|   CEF_MRCS_TERMINATED, | ||||
|   CEF_MRCS_NUM_VALUES, | ||||
| } cef_media_route_connection_state_t; | ||||
|  | ||||
| /// | ||||
| @@ -3420,38 +3536,48 @@ typedef enum { | ||||
|   CEF_MSIT_EDUCATION, | ||||
|   CEF_MSIT_WIRED_DISPLAY, | ||||
|   CEF_MSIT_GENERIC, | ||||
|  | ||||
|   CEF_MSIT_TOTAL_COUNT,  // The total number of values. | ||||
|   CEF_MSIT_NUM_VALUES, | ||||
| } cef_media_sink_icon_type_t; | ||||
|  | ||||
| /// | ||||
| /// Device information for a MediaSink object. | ||||
| /// | ||||
| typedef struct _cef_media_sink_device_info_t { | ||||
|   /// | ||||
|   /// Size of this structure. | ||||
|   /// | ||||
|   size_t size; | ||||
|  | ||||
|   cef_string_t ip_address; | ||||
|   int port; | ||||
|   cef_string_t model_name; | ||||
| } cef_media_sink_device_info_t; | ||||
|  | ||||
| /// | ||||
| /// Represents commands available to TextField. | ||||
| /// Represents commands available to TextField. Should be kept in sync with | ||||
| /// Chromium's views::TextField::MenuCommands type. | ||||
| /// | ||||
| typedef enum { | ||||
|   CEF_TFC_CUT = 1, | ||||
|   CEF_TFC_UNKNOWN, | ||||
|   CEF_TFC_CUT, | ||||
|   CEF_TFC_COPY, | ||||
|   CEF_TFC_PASTE, | ||||
|   CEF_TFC_SELECT_ALL, | ||||
|   CEF_TFC_SELECT_WORD, | ||||
|   CEF_TFC_UNDO, | ||||
|   CEF_TFC_DELETE, | ||||
|   CEF_TFC_SELECT_ALL, | ||||
|   CEF_TFC_NUM_VALUES, | ||||
| } cef_text_field_commands_t; | ||||
|  | ||||
| /// | ||||
| /// Chrome toolbar types. | ||||
| /// | ||||
| typedef enum { | ||||
|   CEF_CTT_NONE = 1, | ||||
|   CEF_CTT_UNKNOWN, | ||||
|   CEF_CTT_NONE, | ||||
|   CEF_CTT_NORMAL, | ||||
|   CEF_CTT_LOCATION, | ||||
|   CEF_CTT_NUM_VALUES, | ||||
| } cef_chrome_toolbar_type_t; | ||||
|  | ||||
| /// | ||||
| @@ -3459,7 +3585,7 @@ typedef enum { | ||||
| /// PageActionIconType type. | ||||
| /// | ||||
| typedef enum { | ||||
|   CEF_CPAIT_BOOKMARK_STAR = 0, | ||||
|   CEF_CPAIT_BOOKMARK_STAR, | ||||
|   CEF_CPAIT_CLICK_TO_CALL, | ||||
|   CEF_CPAIT_COOKIE_CONTROLS, | ||||
|   CEF_CPAIT_FILE_SYSTEM_ACCESS, | ||||
| @@ -3494,7 +3620,7 @@ typedef enum { | ||||
| #if CEF_API_ADDED(13304) | ||||
|   CEF_CPAIT_COLLABORATION_MESSAGING, | ||||
| #endif | ||||
|   CEF_CPAIT_LAST_VALUE, | ||||
|   CEF_CPAIT_NUM_VALUES, | ||||
| } cef_chrome_page_action_icon_type_t; | ||||
|  | ||||
| /// | ||||
| @@ -3502,22 +3628,23 @@ typedef enum { | ||||
| /// ToolbarButtonType type. | ||||
| /// | ||||
| typedef enum { | ||||
|   CEF_CTBT_CAST = 0, | ||||
|   CEF_CTBT_CAST, | ||||
|   CEF_CTBT_DOWNLOAD, | ||||
|   CEF_CTBT_SEND_TAB_TO_SELF, | ||||
|   CEF_CTBT_SIDE_PANEL, | ||||
|   CEF_CTBT_MAX_VALUE = CEF_CTBT_SIDE_PANEL, | ||||
|   CEF_CTBT_NUM_VALUES, | ||||
| } cef_chrome_toolbar_button_type_t; | ||||
|  | ||||
| /// | ||||
| /// Docking modes supported by CefWindow::AddOverlay. | ||||
| /// | ||||
| typedef enum { | ||||
|   CEF_DOCKING_MODE_TOP_LEFT = 1, | ||||
|   CEF_DOCKING_MODE_TOP_LEFT, | ||||
|   CEF_DOCKING_MODE_TOP_RIGHT, | ||||
|   CEF_DOCKING_MODE_BOTTOM_LEFT, | ||||
|   CEF_DOCKING_MODE_BOTTOM_RIGHT, | ||||
|   CEF_DOCKING_MODE_CUSTOM, | ||||
|   CEF_DOCKING_MODE_NUM_VALUES, | ||||
| } cef_docking_mode_t; | ||||
|  | ||||
| /// | ||||
| @@ -3525,7 +3652,7 @@ typedef enum { | ||||
| /// | ||||
| typedef enum { | ||||
|   // Show the window as normal. | ||||
|   CEF_SHOW_STATE_NORMAL = 1, | ||||
|   CEF_SHOW_STATE_NORMAL, | ||||
|  | ||||
|   // Show the window as minimized. | ||||
|   CEF_SHOW_STATE_MINIMIZED, | ||||
| @@ -3539,6 +3666,8 @@ typedef enum { | ||||
|   // Show the window as hidden (no dock thumbnail). | ||||
|   // Only supported on MacOS. | ||||
|   CEF_SHOW_STATE_HIDDEN, | ||||
|  | ||||
|   CEF_SHOW_STATE_NUM_VALUES, | ||||
| } cef_show_state_t; | ||||
|  | ||||
| /// | ||||
| @@ -3553,6 +3682,11 @@ typedef enum { | ||||
| } cef_touch_handle_state_flags_t; | ||||
|  | ||||
| typedef struct _cef_touch_handle_state_t { | ||||
|   /// | ||||
|   /// Size of this structure. | ||||
|   /// | ||||
|   size_t size; | ||||
|  | ||||
|   /// | ||||
|   /// Touch handle id. Increments for each new touch handle. | ||||
|   /// | ||||
| @@ -3676,6 +3810,8 @@ typedef enum { | ||||
|   /// UI) then any related promises may remain unresolved. | ||||
|   /// | ||||
|   CEF_PERMISSION_RESULT_IGNORE, | ||||
|  | ||||
|   CEF_PERMISSION_RESULT_NUM_VALUES, | ||||
| } cef_permission_request_result_t; | ||||
|  | ||||
| /// | ||||
| @@ -3693,6 +3829,8 @@ typedef enum { | ||||
|  | ||||
|   /// Expired certificate. Loads the "expired_cert.pem" file. | ||||
|   CEF_TEST_CERT_EXPIRED, | ||||
|  | ||||
|   CEF_TEST_CERT_NUM_VALUES, | ||||
| } cef_test_cert_type_t; | ||||
|  | ||||
| /// | ||||
| @@ -3706,6 +3844,8 @@ typedef enum { | ||||
|   /// Request context preferences registered each time a new CefRequestContext | ||||
|   /// is created. | ||||
|   CEF_PREFERENCES_TYPE_REQUEST_CONTEXT, | ||||
|  | ||||
|   CEF_PREFERENCES_TYPE_NUM_VALUES, | ||||
| } cef_preferences_type_t; | ||||
|  | ||||
| /// | ||||
| @@ -3854,6 +3994,7 @@ typedef enum { | ||||
|   CEF_COLOR_VARIANT_NEUTRAL, | ||||
|   CEF_COLOR_VARIANT_VIBRANT, | ||||
|   CEF_COLOR_VARIANT_EXPRESSIVE, | ||||
|   CEF_COLOR_VARIANT_NUM_VALUES, | ||||
| } cef_color_variant_t; | ||||
|  | ||||
| /// | ||||
| @@ -3861,7 +4002,7 @@ typedef enum { | ||||
| /// Should be kept in sync with Chromium's task_manager::Task::Type type. | ||||
| /// | ||||
| typedef enum { | ||||
|   CEF_TASK_TYPE_UNKNOWN = 0, | ||||
|   CEF_TASK_TYPE_UNKNOWN, | ||||
|   /// The main browser process. | ||||
|   CEF_TASK_TYPE_BROWSER, | ||||
|   /// A graphics process. | ||||
| @@ -3886,12 +4027,19 @@ typedef enum { | ||||
|   CEF_TASK_TYPE_SHARED_WORKER, | ||||
|   /// A service worker running on the renderer process. | ||||
|   CEF_TASK_TYPE_SERVICE_WORKER, | ||||
|  | ||||
|   CEF_TASK_TYPE_NUM_VALUES, | ||||
| } cef_task_type_t; | ||||
|  | ||||
| /// | ||||
| /// Structure representing task information provided by CefTaskManager. | ||||
| /// | ||||
| typedef struct _cef_task_info_t { | ||||
|   /// | ||||
|   /// Size of this structure. | ||||
|   /// | ||||
|   size_t size; | ||||
|  | ||||
|   /// The task ID. | ||||
|   int64_t id; | ||||
|   /// The task type. | ||||
|   | ||||
| @@ -48,6 +48,8 @@ typedef enum { | ||||
|   /// BGRA with 8 bits per pixel (32bits total). | ||||
|   /// | ||||
|   CEF_COLOR_TYPE_BGRA_8888, | ||||
|  | ||||
|   CEF_COLOR_TYPE_NUM_VALUES, | ||||
| } cef_color_type_t; | ||||
|  | ||||
| #ifdef __cplusplus | ||||
|   | ||||
| @@ -45,7 +45,7 @@ typedef enum { | ||||
|   /// provided context. However, it may be overridden by other settings. This | ||||
|   /// enum should NOT be read directly to determine whether cookies are enabled; | ||||
|   /// the client should instead rely on the CookieSettings API. | ||||
|   CEF_CONTENT_SETTING_TYPE_COOKIES = 0, | ||||
|   CEF_CONTENT_SETTING_TYPE_COOKIES, | ||||
|   CEF_CONTENT_SETTING_TYPE_IMAGES, | ||||
|   CEF_CONTENT_SETTING_TYPE_JAVASCRIPT, | ||||
|  | ||||
| @@ -483,6 +483,8 @@ typedef enum { | ||||
|   /// Checks whether cookies scope is handled according to origin-bound cookies | ||||
|   /// or legacy behavior. | ||||
|   CEF_CONTENT_SETTING_TYPE_LEGACY_COOKIE_SCOPE, | ||||
|  | ||||
|   CEF_CONTENT_SETTING_TYPE_NUM_VALUES, | ||||
| } cef_content_setting_types_t; | ||||
|  | ||||
| /// | ||||
| @@ -490,14 +492,14 @@ typedef enum { | ||||
| /// ContentSetting type. | ||||
| /// | ||||
| typedef enum { | ||||
|   CEF_CONTENT_SETTING_VALUE_DEFAULT = 0, | ||||
|   CEF_CONTENT_SETTING_VALUE_DEFAULT, | ||||
|   CEF_CONTENT_SETTING_VALUE_ALLOW, | ||||
|   CEF_CONTENT_SETTING_VALUE_BLOCK, | ||||
|   CEF_CONTENT_SETTING_VALUE_ASK, | ||||
|   CEF_CONTENT_SETTING_VALUE_SESSION_ONLY, | ||||
|   CEF_CONTENT_SETTING_VALUE_DETECT_IMPORTANT_CONTENT, | ||||
|  | ||||
|   CEF_CONTENT_SETTING_VALUE_NUM_VALUES | ||||
|   CEF_CONTENT_SETTING_VALUE_NUM_VALUES, | ||||
| } cef_content_setting_values_t; | ||||
|  | ||||
| #ifdef __cplusplus | ||||
|   | ||||
| @@ -86,6 +86,11 @@ typedef struct _cef_main_args_t { | ||||
| /// Class representing window information. | ||||
| /// | ||||
| typedef struct _cef_window_info_t { | ||||
|   /// | ||||
|   /// Size of this structure. | ||||
|   /// | ||||
|   size_t size; | ||||
|  | ||||
|   /// | ||||
|   /// The initial title of the window, to be set when the window is created. | ||||
|   /// Some layout managers (e.g., Compiz) can look at the window title | ||||
| @@ -174,6 +179,11 @@ typedef struct _cef_accelerated_paint_native_pixmap_plane_info_t { | ||||
| /// the callback returns from client code. | ||||
| /// | ||||
| typedef struct _cef_accelerated_paint_info_t { | ||||
|   /// | ||||
|   /// Size of this structure. | ||||
|   /// | ||||
|   size_t size; | ||||
|  | ||||
|   /// | ||||
|   /// Planes of the shared texture, usually file descriptors of dmabufs. | ||||
|   /// | ||||
|   | ||||
| @@ -90,6 +90,11 @@ typedef struct _cef_main_args_t { | ||||
| /// Class representing window information. | ||||
| /// | ||||
| typedef struct _cef_window_info_t { | ||||
|   /// | ||||
|   /// Size of this structure. | ||||
|   /// | ||||
|   size_t size; | ||||
|  | ||||
|   cef_string_t window_name; | ||||
|  | ||||
|   /// | ||||
| @@ -154,6 +159,11 @@ typedef struct _cef_window_info_t { | ||||
| /// the callback returns from client code. | ||||
| /// | ||||
| typedef struct _cef_accelerated_paint_info_t { | ||||
|   /// | ||||
|   /// Size of this structure. | ||||
|   /// | ||||
|   size_t size; | ||||
|  | ||||
|   /// | ||||
|   /// Handle for the shared texture IOSurface. | ||||
|   /// | ||||
|   | ||||
| @@ -39,6 +39,11 @@ | ||||
| /// src/media/base/video_frame_metadata.h for actual details. | ||||
| /// | ||||
| typedef struct _cef_accelerated_paint_info_common_t { | ||||
|   /// | ||||
|   /// Size of this structure. | ||||
|   /// | ||||
|   size_t size; | ||||
|  | ||||
|   /// | ||||
|   /// Timestamp of the frame in microseconds since capture start. | ||||
|   /// | ||||
|   | ||||
| @@ -67,6 +67,11 @@ typedef struct _cef_main_args_t { | ||||
| /// Structure representing window information. | ||||
| /// | ||||
| typedef struct _cef_window_info_t { | ||||
|   /// | ||||
|   /// Size of this structure. | ||||
|   /// | ||||
|   size_t size; | ||||
|  | ||||
|   // Standard parameters required by CreateWindowEx() | ||||
|   DWORD ex_style; | ||||
|   cef_string_t window_name; | ||||
| @@ -121,6 +126,11 @@ typedef struct _cef_window_info_t { | ||||
| /// the callback returns from client code. | ||||
| /// | ||||
| typedef struct _cef_accelerated_paint_info_t { | ||||
|   /// | ||||
|   /// Size of this structure. | ||||
|   /// | ||||
|   size_t size; | ||||
|  | ||||
|   /// | ||||
|   /// Handle for the shared texture. The shared texture is instantiated | ||||
|   /// without a keyed mutex. | ||||
|   | ||||
| @@ -31,6 +31,7 @@ | ||||
| #define CEF_INCLUDE_INTERNAL_CEF_TYPES_WRAPPERS_H_ | ||||
| #pragma once | ||||
|  | ||||
| #include <algorithm> | ||||
| #include <limits> | ||||
|  | ||||
| #include "include/internal/cef_string.h" | ||||
| @@ -38,16 +39,16 @@ | ||||
| #include "include/internal/cef_types.h" | ||||
|  | ||||
| /// | ||||
| /// Template class that provides common functionality for CEF structure | ||||
| /// wrapping. Use only with non-POD types that benefit from referencing unowned | ||||
| /// members. | ||||
| /// Template class that provides common functionality for complex CEF structure | ||||
| /// wrapping. Use only with non-POD types that begin with a `size_t size` member | ||||
| /// and can benefit from referencing unowned members. | ||||
| /// | ||||
| template <class traits> | ||||
| class CefStructBase : public traits::struct_type { | ||||
|  public: | ||||
|   using struct_type = typename traits::struct_type; | ||||
|  | ||||
|   CefStructBase() : attached_to_(NULL) { Init(); } | ||||
|   CefStructBase() { Init(); } | ||||
|   virtual ~CefStructBase() { | ||||
|     // Only clear this object's data if it isn't currently attached to a | ||||
|     // structure. | ||||
| @@ -79,8 +80,12 @@ class CefStructBase : public traits::struct_type { | ||||
|     // This object is now attached to the new structure. | ||||
|     attached_to_ = &source; | ||||
|  | ||||
|     // Transfer ownership of the values from the source structure. | ||||
|     memcpy(static_cast<struct_type*>(this), &source, sizeof(struct_type)); | ||||
|     // Source structure may be smaller size. | ||||
|     const size_t source_size = std::min(source.size, sizeof(struct_type)); | ||||
|  | ||||
|     // Reference values from the source structure, and keep the same size. | ||||
|     memcpy(static_cast<struct_type*>(this), &source, source_size); | ||||
|     this->size = source_size; | ||||
|   } | ||||
|  | ||||
|   /// | ||||
| @@ -93,10 +98,20 @@ class CefStructBase : public traits::struct_type { | ||||
|       Clear(&target); | ||||
|     } | ||||
|  | ||||
|     // Transfer ownership of the values to the target structure. | ||||
|     memcpy(&target, static_cast<struct_type*>(this), sizeof(struct_type)); | ||||
|     // Target structure may be smaller size. | ||||
|     const size_t target_size = std::min(target.size, sizeof(struct_type)); | ||||
|  | ||||
|     // Remove the references from this object. | ||||
|     // Transfer ownership of the values to the target structure. | ||||
|     memcpy(&target, static_cast<struct_type*>(this), target_size); | ||||
|  | ||||
|     if (target_size < sizeof(struct_type)) { | ||||
|       // Zero the transferred portion and clear the remainder. | ||||
|       memset(static_cast<struct_type*>(this), 0, target_size); | ||||
|       this->size = sizeof(struct_type); | ||||
|       Clear(this); | ||||
|     } | ||||
|  | ||||
|     // Zero everything. We return to the default size. | ||||
|     Init(); | ||||
|   } | ||||
|  | ||||
| @@ -105,6 +120,10 @@ class CefStructBase : public traits::struct_type { | ||||
|   /// will be copied instead of referenced. | ||||
|   /// | ||||
|   void Set(const struct_type& source, bool copy) { | ||||
|     if (source.size < sizeof(struct_type)) { | ||||
|       // Clear newer members that won't be set. | ||||
|       Clear(this); | ||||
|     } | ||||
|     traits::set(&source, this, copy); | ||||
|   } | ||||
|  | ||||
| @@ -126,7 +145,25 @@ class CefStructBase : public traits::struct_type { | ||||
|  | ||||
|   static void Clear(struct_type* s) { traits::clear(s); } | ||||
|  | ||||
|   struct_type* attached_to_; | ||||
|   struct_type* attached_to_ = nullptr; | ||||
| }; | ||||
|  | ||||
| /// | ||||
| /// Template class that provides common functionality for simple CEF structure | ||||
| /// wrapping. Use only with POD types that begin with a `size_t size` member. | ||||
| /// | ||||
| template <class struct_type> | ||||
| class CefStructBaseSimple final : public struct_type { | ||||
|  public: | ||||
|   CefStructBaseSimple() : struct_type{sizeof(struct_type)} {} | ||||
|   CefStructBaseSimple(const struct_type& r) { *this = r; } | ||||
|  | ||||
|   CefStructBaseSimple& operator=(const struct_type& r) { | ||||
|     memcpy(static_cast<struct_type*>(this), &r, | ||||
|            std::min(r.size, sizeof(struct_type))); | ||||
|     this->size = sizeof(struct_type); | ||||
|     return *this; | ||||
|   } | ||||
| }; | ||||
|  | ||||
| /// | ||||
| @@ -291,16 +328,29 @@ inline bool operator!=(const CefDraggableRegion& a, | ||||
| /// | ||||
| class CefScreenInfo : public cef_screen_info_t { | ||||
|  public: | ||||
|   CefScreenInfo() : cef_screen_info_t{} {} | ||||
|   CefScreenInfo(const cef_screen_info_t& r) : cef_screen_info_t(r) {} | ||||
|   CefScreenInfo() : cef_screen_info_t{sizeof(cef_screen_info_t)} {} | ||||
|   CefScreenInfo(const cef_screen_info_t& r) { *this = r; } | ||||
|  | ||||
|   CefScreenInfo& operator=(const cef_screen_info_t& r) { | ||||
|     memcpy(static_cast<cef_screen_info_t*>(this), &r, | ||||
|            std::min(r.size, sizeof(cef_screen_info_t))); | ||||
|     this->size = sizeof(cef_screen_info_t); | ||||
|     return *this; | ||||
|   } | ||||
|  | ||||
|   CefScreenInfo(float device_scale_factor, | ||||
|                 int depth, | ||||
|                 int depth_per_component, | ||||
|                 bool is_monochrome, | ||||
|                 const cef_rect_t& rect, | ||||
|                 const cef_rect_t& available_rect) | ||||
|       : cef_screen_info_t{device_scale_factor, depth, depth_per_component, | ||||
|                           is_monochrome,       rect,  available_rect} {} | ||||
|       : cef_screen_info_t{sizeof(cef_screen_info_t), | ||||
|                           device_scale_factor, | ||||
|                           depth, | ||||
|                           depth_per_component, | ||||
|                           is_monochrome, | ||||
|                           rect, | ||||
|                           available_rect} {} | ||||
|  | ||||
|   void Set(float device_scale_factor_val, | ||||
|            int depth_val, | ||||
| @@ -320,11 +370,7 @@ class CefScreenInfo : public cef_screen_info_t { | ||||
| /// | ||||
| /// Class representing a a keyboard event. | ||||
| /// | ||||
| class CefKeyEvent : public cef_key_event_t { | ||||
|  public: | ||||
|   CefKeyEvent() : cef_key_event_t{} {} | ||||
|   CefKeyEvent(const cef_key_event_t& r) : cef_key_event_t(r) {} | ||||
| }; | ||||
| using CefKeyEvent = CefStructBaseSimple<cef_key_event_t>; | ||||
|  | ||||
| /// | ||||
| /// Class representing a mouse event. | ||||
| @@ -347,11 +393,7 @@ class CefTouchEvent : public cef_touch_event_t { | ||||
| /// | ||||
| /// Class representing popup window features. | ||||
| /// | ||||
| class CefPopupFeatures : public cef_popup_features_t { | ||||
|  public: | ||||
|   CefPopupFeatures() : cef_popup_features_t{} {} | ||||
|   CefPopupFeatures(const cef_popup_features_t& r) : cef_popup_features_t(r) {} | ||||
| }; | ||||
| using CefPopupFeatures = CefStructBaseSimple<cef_popup_features_t>; | ||||
|  | ||||
| struct CefSettingsTraits { | ||||
|   using struct_type = cef_settings_t; | ||||
| @@ -553,7 +595,7 @@ using CefBrowserSettings = CefStructBase<CefBrowserSettingsTraits>; | ||||
| struct CefURLPartsTraits { | ||||
|   using struct_type = cef_urlparts_t; | ||||
|  | ||||
|   static inline void init(struct_type* s) {} | ||||
|   static inline void init(struct_type* s) { s->size = sizeof(struct_type); } | ||||
|  | ||||
|   static inline void clear(struct_type* s) { | ||||
|     cef_string_clear(&s->spec); | ||||
| @@ -595,17 +637,12 @@ using CefURLParts = CefStructBase<CefURLPartsTraits>; | ||||
| /// | ||||
| /// Class representing the state of a touch handle. | ||||
| /// | ||||
| class CefTouchHandleState : public cef_touch_handle_state_t { | ||||
|  public: | ||||
|   CefTouchHandleState() : cef_touch_handle_state_t{} {} | ||||
|   CefTouchHandleState(const cef_touch_handle_state_t& r) | ||||
|       : cef_touch_handle_state_t(r) {} | ||||
| }; | ||||
| using CefTouchHandleState = CefStructBaseSimple<cef_touch_handle_state_t>; | ||||
|  | ||||
| struct CefCookieTraits { | ||||
|   using struct_type = cef_cookie_t; | ||||
|  | ||||
|   static inline void init(struct_type* s) {} | ||||
|   static inline void init(struct_type* s) { s->size = sizeof(struct_type); } | ||||
|  | ||||
|   static inline void clear(struct_type* s) { | ||||
|     cef_string_clear(&s->name); | ||||
| @@ -649,7 +686,7 @@ class CefCursorInfo : public cef_cursor_info_t { | ||||
| struct CefPdfPrintSettingsTraits { | ||||
|   using struct_type = cef_pdf_print_settings_t; | ||||
|  | ||||
|   static inline void init(struct_type* s) {} | ||||
|   static inline void init(struct_type* s) { s->size = sizeof(struct_type); } | ||||
|  | ||||
|   static inline void clear(struct_type* s) { | ||||
|     cef_string_clear(&s->page_ranges); | ||||
| @@ -697,37 +734,35 @@ using CefPdfPrintSettings = CefStructBase<CefPdfPrintSettingsTraits>; | ||||
| /// | ||||
| class CefBoxLayoutSettings : public cef_box_layout_settings_t { | ||||
|  public: | ||||
|   CefBoxLayoutSettings() : cef_box_layout_settings_t{} { | ||||
|   CefBoxLayoutSettings() | ||||
|       : cef_box_layout_settings_t{sizeof(cef_box_layout_settings_t)} { | ||||
|     cross_axis_alignment = CEF_AXIS_ALIGNMENT_STRETCH; | ||||
|   } | ||||
|   CefBoxLayoutSettings(const cef_box_layout_settings_t& r) | ||||
|       : cef_box_layout_settings_t(r) {} | ||||
|   CefBoxLayoutSettings(const cef_box_layout_settings_t& r) { *this = r; } | ||||
|  | ||||
|   CefBoxLayoutSettings& operator=(const cef_box_layout_settings_t& r) { | ||||
|     memcpy(static_cast<cef_box_layout_settings_t*>(this), &r, | ||||
|            std::min(r.size, sizeof(cef_box_layout_settings_t))); | ||||
|     this->size = sizeof(cef_box_layout_settings_t); | ||||
|     return *this; | ||||
|   } | ||||
| }; | ||||
|  | ||||
| /// | ||||
| /// Class representing IME composition underline. | ||||
| /// | ||||
| class CefCompositionUnderline : public cef_composition_underline_t { | ||||
|  public: | ||||
|   CefCompositionUnderline() : cef_composition_underline_t{} {} | ||||
|   CefCompositionUnderline(const cef_composition_underline_t& r) | ||||
|       : cef_composition_underline_t(r) {} | ||||
| }; | ||||
| using CefCompositionUnderline = | ||||
|     CefStructBaseSimple<cef_composition_underline_t>; | ||||
|  | ||||
| /// | ||||
| /// Class representing CefAudioParameters settings | ||||
| /// | ||||
| class CefAudioParameters : public cef_audio_parameters_t { | ||||
|  public: | ||||
|   CefAudioParameters() : cef_audio_parameters_t{} {} | ||||
|   CefAudioParameters(const cef_audio_parameters_t& r) | ||||
|       : cef_audio_parameters_t(r) {} | ||||
| }; | ||||
| using CefAudioParameters = CefStructBaseSimple<cef_audio_parameters_t>; | ||||
|  | ||||
| struct CefMediaSinkDeviceInfoTraits { | ||||
|   using struct_type = cef_media_sink_device_info_t; | ||||
|  | ||||
|   static inline void init(struct_type* s) {} | ||||
|   static inline void init(struct_type* s) { s->size = sizeof(struct_type); } | ||||
|  | ||||
|   static inline void clear(struct_type* s) { | ||||
|     cef_string_clear(&s->ip_address); | ||||
| @@ -753,17 +788,13 @@ using CefMediaSinkDeviceInfo = CefStructBase<CefMediaSinkDeviceInfoTraits>; | ||||
| /// | ||||
| /// Class representing accelerated paint info. | ||||
| /// | ||||
| class CefAcceleratedPaintInfo : public cef_accelerated_paint_info_t { | ||||
|  public: | ||||
|   CefAcceleratedPaintInfo() : cef_accelerated_paint_info_t{} {} | ||||
|   CefAcceleratedPaintInfo(const cef_accelerated_paint_info_t& r) | ||||
|       : cef_accelerated_paint_info_t(r) {} | ||||
| }; | ||||
| using CefAcceleratedPaintInfo = | ||||
|     CefStructBaseSimple<cef_accelerated_paint_info_t>; | ||||
|  | ||||
| struct CefTaskInfoTraits { | ||||
|   using struct_type = cef_task_info_t; | ||||
|  | ||||
|   static inline void init(struct_type* s) {} | ||||
|   static inline void init(struct_type* s) { s->size = sizeof(struct_type); } | ||||
|  | ||||
|   static inline void clear(struct_type* s) { cef_string_clear(&s->title); } | ||||
|  | ||||
| @@ -790,7 +821,7 @@ using CefTaskInfo = CefStructBase<CefTaskInfoTraits>; | ||||
| struct CefLinuxWindowPropertiesTraits { | ||||
|   using struct_type = cef_linux_window_properties_t; | ||||
|  | ||||
|   static inline void init(struct_type* s) {} | ||||
|   static inline void init(struct_type* s) { s->size = sizeof(struct_type); } | ||||
|  | ||||
|   static inline void clear(struct_type* s) { | ||||
|     cef_string_clear(&s->wayland_app_id); | ||||
|   | ||||
| @@ -53,7 +53,7 @@ class CefMainArgs : public cef_main_args_t { | ||||
| struct CefWindowInfoTraits { | ||||
|   typedef cef_window_info_t struct_type; | ||||
|  | ||||
|   static inline void init(struct_type* s) {} | ||||
|   static inline void init(struct_type* s) { s->size = sizeof(struct_type); } | ||||
|  | ||||
|   static inline void clear(struct_type* s) { | ||||
|     cef_string_clear(&s->window_name); | ||||
|   | ||||
| @@ -18,7 +18,7 @@ media::ChannelLayoutConfig TranslateChannelLayout( | ||||
|   // between those enums and existing values don't ever change, so it's enough | ||||
|   // to check that there are no new ones added. | ||||
|   static_assert( | ||||
|       static_cast<int>(CEF_CHANNEL_LAYOUT_MAX) == | ||||
|       static_cast<int>(CEF_CHANNEL_NUM_VALUES) - 1 == | ||||
|           static_cast<int>(media::CHANNEL_LAYOUT_MAX), | ||||
|       "cef_channel_layout_t must match the ChannelLayout enum in Chromium"); | ||||
|  | ||||
|   | ||||
| @@ -379,18 +379,22 @@ void CefBrowserContentsDelegate::PrimaryMainFrameRenderProcessGone( | ||||
|     base::TerminationStatus status) { | ||||
|   static_assert(static_cast<int>(CEF_RESULT_CODE_CHROME_FIRST) == | ||||
|                     static_cast<int>(chrome::RESULT_CODE_CHROME_START), | ||||
|                 "enum mismatch"); | ||||
|                 "CEF_RESULT_CODE_CHROME_FIRST must match " | ||||
|                 "chrome::RESULT_CODE_CHROME_START"); | ||||
|   static_assert(static_cast<int>(CEF_RESULT_CODE_CHROME_LAST) == | ||||
|                     static_cast<int>(chrome::RESULT_CODE_CHROME_LAST_CODE), | ||||
|                 "enum mismatch"); | ||||
|                 "CEF_RESULT_CODE_CHROME_LAST must match " | ||||
|                 "chrome::RESULT_CODE_CHROME_LAST_CODE"); | ||||
|  | ||||
| #if defined(OS_WIN) | ||||
|   static_assert(static_cast<int>(CEF_RESULT_CODE_SANDBOX_FATAL_FIRST) == | ||||
|                     static_cast<int>(sandbox::SBOX_FATAL_INTEGRITY), | ||||
|                 "enum mismatch"); | ||||
|   static_assert(static_cast<int>(CEF_RESULT_CODE_SANDBOX_FATAL_LAST) == | ||||
|                     static_cast<int>(sandbox::SBOX_FATAL_LAST), | ||||
|                 "enum mismatch"); | ||||
|                 "CEF_RESULT_CODE_SANDBOX_FATAL_FIRST must match " | ||||
|                 "sandbox::SBOX_FATAL_INTEGRITY"); | ||||
|   static_assert( | ||||
|       static_cast<int>(CEF_RESULT_CODE_SANDBOX_FATAL_LAST) == | ||||
|           static_cast<int>(sandbox::SBOX_FATAL_LAST), | ||||
|       "CEF_RESULT_CODE_SANDBOX_FATAL_LAST must match sandbox::SBOX_FATAL_LAST"); | ||||
| #endif | ||||
|  | ||||
|   cef_termination_status_t ts = TS_ABNORMAL_TERMINATION; | ||||
|   | ||||
| @@ -57,7 +57,7 @@ bool CefBrowserHost::CreateBrowser( | ||||
|   } | ||||
|  | ||||
|   // Verify that the settings structure is a valid size. | ||||
|   if (settings.size != sizeof(cef_browser_settings_t)) { | ||||
|   if (!CEF_MEMBER_EXISTS(&settings, chrome_zoom_bubble)) { | ||||
|     DCHECK(false) << "invalid CefBrowserSettings structure size"; | ||||
|     return false; | ||||
|   } | ||||
| @@ -115,7 +115,7 @@ CefRefPtr<CefBrowser> CefBrowserHost::CreateBrowserSync( | ||||
|   } | ||||
|  | ||||
|   // Verify that the settings structure is a valid size. | ||||
|   if (settings.size != sizeof(cef_browser_settings_t)) { | ||||
|   if (!CEF_MEMBER_EXISTS(&settings, chrome_zoom_bubble)) { | ||||
|     DCHECK(false) << "invalid CefBrowserSettings structure size"; | ||||
|     return nullptr; | ||||
|   } | ||||
|   | ||||
| @@ -292,9 +292,10 @@ bool ChromeBrowserDelegate::ShowStatusBubble(bool show_by_default) { | ||||
| bool ChromeBrowserDelegate::HandleCommand(int command_id, | ||||
|                                           WindowOpenDisposition disposition) { | ||||
|   // Verify that our enum matches Chromium's values. | ||||
|   static_assert(static_cast<int>(CEF_WOD_MAX_VALUE) == | ||||
|   static_assert(static_cast<int>(CEF_WOD_NUM_VALUES) - 1 == | ||||
|                     static_cast<int>(WindowOpenDisposition::MAX_VALUE), | ||||
|                 "enum mismatch"); | ||||
|                 "Enum values in cef_window_open_disposition_t must match " | ||||
|                 "WindowOpenDisposition"); | ||||
|  | ||||
|   if (auto browser = ChromeBrowserHostImpl::GetBrowserForBrowser(browser_)) { | ||||
|     if (auto client = browser->GetClient()) { | ||||
| @@ -333,9 +334,10 @@ bool ChromeBrowserDelegate::IsAppMenuItemEnabled(int command_id) { | ||||
| bool ChromeBrowserDelegate::IsPageActionIconVisible( | ||||
|     PageActionIconType icon_type) { | ||||
|   // Verify that our enum matches Chromium's values. | ||||
|   static_assert(static_cast<int>(CEF_CPAIT_LAST_VALUE) - 1 == | ||||
|   static_assert(static_cast<int>(CEF_CPAIT_NUM_VALUES) - 1 == | ||||
|                     static_cast<int>(PageActionIconType::kMaxValue), | ||||
|                 "enum mismatch"); | ||||
|                 "Enum values in cef_chrome_page_action_icon_type_t must match " | ||||
|                 "PageActionIconType"); | ||||
|  | ||||
|   if (auto client = create_params_.client) { | ||||
|     if (auto handler = client->GetCommandHandler()) { | ||||
| @@ -349,9 +351,10 @@ bool ChromeBrowserDelegate::IsPageActionIconVisible( | ||||
| bool ChromeBrowserDelegate::IsToolbarButtonVisible( | ||||
|     ToolbarButtonType button_type) { | ||||
|   // Verify that our enum matches BrowserDelegate's values. | ||||
|   static_assert(static_cast<int>(CEF_CTBT_MAX_VALUE) == | ||||
|   static_assert(static_cast<int>(CEF_CTBT_NUM_VALUES) - 1 == | ||||
|                     static_cast<int>(ToolbarButtonType::kMaxValue), | ||||
|                 "enum mismatch"); | ||||
|                 "Enum values in cef_chrome_toolbar_button_type_t must match " | ||||
|                 "ToolbarButtonType"); | ||||
|  | ||||
|   if (auto client = create_params_.client) { | ||||
|     if (auto handler = client->GetCommandHandler()) { | ||||
|   | ||||
| @@ -315,7 +315,7 @@ bool CefInitialize(const CefMainArgs& args, | ||||
|     return true; | ||||
|   } | ||||
|  | ||||
|   if (settings.size != sizeof(cef_settings_t)) { | ||||
|   if (!CEF_MEMBER_EXISTS(&settings, disable_signal_handlers)) { | ||||
|     DCHECK(false) << "invalid CefSettings structure size"; | ||||
|     return false; | ||||
|   } | ||||
|   | ||||
| @@ -300,6 +300,9 @@ void CefFileDialogManager::RunFileDialog( | ||||
|     case FILE_DIALOG_SAVE: | ||||
|       params.mode = blink::mojom::FileChooserParams::Mode::kSave; | ||||
|       break; | ||||
|     case FILE_DIALOG_NUM_VALUES: | ||||
|       DCHECK(false); | ||||
|       return; | ||||
|   } | ||||
|  | ||||
|   params.title = title; | ||||
|   | ||||
| @@ -120,6 +120,12 @@ class CefRegistrationImpl : public CefRegistration, | ||||
|  | ||||
|   static CefMediaObserver::ConnectionState ToConnectionState( | ||||
|       blink::mojom::PresentationConnectionState state) { | ||||
|     static_assert(static_cast<int>(CEF_MRCS_NUM_VALUES) - 1 == | ||||
|                       static_cast<int>( | ||||
|                           blink::mojom::PresentationConnectionState::kMaxValue), | ||||
|                   "Enum values in cef_media_route_connection_state_t must " | ||||
|                   "match blink::mojom::PresentationConnectionState"); | ||||
|  | ||||
|     switch (state) { | ||||
|       case blink::mojom::PresentationConnectionState::CONNECTING: | ||||
|         return CEF_MRCS_CONNECTING; | ||||
| @@ -284,6 +290,12 @@ void CefMediaRouterImpl::NotifyCurrentRoutesInternal() { | ||||
| void CefMediaRouterImpl::CreateRouteCallback( | ||||
|     CefRefPtr<CefMediaRouteCreateCallback> callback, | ||||
|     const media_router::RouteRequestResult& result) { | ||||
|   static_assert(static_cast<int>(CEF_MRCR_NUM_VALUES) - 1 == | ||||
|                     static_cast<int>( | ||||
|                         media_router::mojom::RouteRequestResultCode::kMaxValue), | ||||
|                 "Enum values in cef_media_route_create_result_t must match " | ||||
|                 "media_router::mojom::RouteRequestResultCode"); | ||||
|  | ||||
|   DCHECK(ValidContext()); | ||||
|  | ||||
|   if (result.result_code() != media_router::mojom::RouteRequestResultCode::OK) { | ||||
|   | ||||
| @@ -105,9 +105,10 @@ CefString CefMediaSinkImpl::GetName() { | ||||
|  | ||||
| CefMediaSink::IconType CefMediaSinkImpl::GetIconType() { | ||||
|   // Verify that our enum matches Chromium's values. | ||||
|   static_assert(static_cast<int>(CEF_MSIT_TOTAL_COUNT) == | ||||
|   static_assert(static_cast<int>(CEF_MSIT_NUM_VALUES) == | ||||
|                     static_cast<int>(media_router::SinkIconType::TOTAL_COUNT), | ||||
|                 "enum mismatch"); | ||||
|                 "Enum values in cef_media_sink_icon_type_t must match " | ||||
|                 "media_router::SinkIconType"); | ||||
|  | ||||
|   return static_cast<CefMediaSink::IconType>(sink_.icon_type()); | ||||
| } | ||||
|   | ||||
| @@ -240,7 +240,7 @@ struct CefMenuModelImpl::Item { | ||||
|   bool ctrl_pressed_ = false; | ||||
|   bool alt_pressed_ = false; | ||||
|  | ||||
|   cef_color_t colors_[CEF_MENU_COLOR_COUNT] = {0}; | ||||
|   cef_color_t colors_[CEF_MENU_COLOR_NUM_VALUES] = {0}; | ||||
|   gfx::FontList font_list_; | ||||
|   bool has_font_list_ = false; | ||||
| }; | ||||
| @@ -744,7 +744,7 @@ bool CefMenuModelImpl::SetColorAt(int index, | ||||
|     return false; | ||||
|   } | ||||
|  | ||||
|   if (color_type < 0 || color_type >= CEF_MENU_COLOR_COUNT) { | ||||
|   if (color_type < 0 || color_type >= CEF_MENU_COLOR_NUM_VALUES) { | ||||
|     return false; | ||||
|   } | ||||
|  | ||||
| @@ -775,7 +775,7 @@ bool CefMenuModelImpl::GetColorAt(int index, | ||||
|     return false; | ||||
|   } | ||||
|  | ||||
|   if (color_type < 0 || color_type >= CEF_MENU_COLOR_COUNT) { | ||||
|   if (color_type < 0 || color_type >= CEF_MENU_COLOR_NUM_VALUES) { | ||||
|     return false; | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -225,7 +225,7 @@ class CefMenuModelImpl : public CefMenuModel { | ||||
|   std::unique_ptr<ui::MenuModel> model_; | ||||
|  | ||||
|   // Style information. | ||||
|   cef_color_t default_colors_[CEF_MENU_COLOR_COUNT] = {0}; | ||||
|   cef_color_t default_colors_[CEF_MENU_COLOR_NUM_VALUES] = {0}; | ||||
|   gfx::FontList default_font_list_; | ||||
|   bool has_default_font_list_ = false; | ||||
|  | ||||
|   | ||||
| @@ -178,6 +178,8 @@ ui::ImeTextSpan::UnderlineStyle GetImeUnderlineStyle( | ||||
|       return ui::ImeTextSpan::UnderlineStyle::kDash; | ||||
|     case CEF_CUS_NONE: | ||||
|       return ui::ImeTextSpan::UnderlineStyle::kNone; | ||||
|     case CEF_CUS_NUM_VALUES: | ||||
|       break; | ||||
|   } | ||||
|  | ||||
|   DCHECK(false); | ||||
| @@ -1474,7 +1476,7 @@ void CefRenderWidgetHostViewOSR::OnUpdateTextInputStateCalled( | ||||
|   CefRenderHandler::TextInputMode mode = CEF_TEXT_INPUT_MODE_NONE; | ||||
|   if (state && state->type != ui::TEXT_INPUT_TYPE_NONE) { | ||||
|     static_assert( | ||||
|         static_cast<int>(CEF_TEXT_INPUT_MODE_MAX) == | ||||
|         static_cast<int>(CEF_TEXT_INPUT_MODE_NUM_VALUES) - 1 == | ||||
|             static_cast<int>(ui::TEXT_INPUT_MODE_MAX), | ||||
|         "Enum values in cef_text_input_mode_t must match ui::TextInputMode"); | ||||
|     mode = static_cast<CefRenderHandler::TextInputMode>(state->mode); | ||||
|   | ||||
| @@ -137,7 +137,8 @@ void CefVideoConsumerOSR::OnFrameCaptured( | ||||
|                             : CEF_COLOR_TYPE_BGRA_8888; | ||||
|  | ||||
|     // Build extra common info. | ||||
|     cef_accelerated_paint_info_common_t extra = {}; | ||||
|     cef_accelerated_paint_info_common_t extra = { | ||||
|         sizeof(cef_accelerated_paint_info_common_t)}; | ||||
|     extra.timestamp = info->timestamp.InMicroseconds(); | ||||
|     extra.coded_size = {info->coded_size.width(), info->coded_size.height()}; | ||||
|     extra.visible_rect = {info->visible_rect.x(), info->visible_rect.y(), | ||||
|   | ||||
| @@ -154,6 +154,9 @@ class CefPermissionPrompt : public permissions::PermissionPrompt { | ||||
|       case CEF_PERMISSION_RESULT_IGNORE: | ||||
|         delegate_->Ignore(); | ||||
|         break; | ||||
|       case CEF_PERMISSION_RESULT_NUM_VALUES: | ||||
|         DCHECK(false); | ||||
|         return; | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -58,6 +58,9 @@ class CefPreferenceRegistrarImpl : public CefPreferenceRegistrar { | ||||
|       case VTYPE_LIST: | ||||
|         RegisterComplexPref(nameStr, default_value); | ||||
|         return true; | ||||
|       case VTYPE_NUM_VALUES: | ||||
|         DCHECK(false); | ||||
|         return false; | ||||
|     }; | ||||
|  | ||||
|     LOG(ERROR) << "Invalid value type for preference: " << nameStr; | ||||
|   | ||||
| @@ -130,6 +130,12 @@ CefRefPtr<CefRequestContext> CefRequestContext::CreateContext( | ||||
|     return nullptr; | ||||
|   } | ||||
|  | ||||
|   // Verify that the settings structure is a valid size. | ||||
|   if (!CEF_MEMBER_EXISTS(&settings, cookieable_schemes_exclude_defaults)) { | ||||
|     DCHECK(false) << "invalid CefRequestContextSettings structure size"; | ||||
|     return nullptr; | ||||
|   } | ||||
|  | ||||
|   CefRequestContextImpl::Config config; | ||||
|   config.settings = settings; | ||||
|   config.handler = handler; | ||||
|   | ||||
| @@ -200,6 +200,9 @@ class CefTestServerImpl::Context { | ||||
|         case CEF_TEST_CERT_EXPIRED: | ||||
|           test_server_->SetSSLConfig(EmbeddedTestServer::CERT_EXPIRED); | ||||
|           break; | ||||
|         case CEF_TEST_CERT_NUM_VALUES: | ||||
|           DCHECK(false); | ||||
|           return false; | ||||
|       } | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -7,22 +7,36 @@ | ||||
| #include "cef/libcef/browser/thread_util.h" | ||||
|  | ||||
| namespace { | ||||
|  | ||||
| static int CefCommandIdToChromeId(cef_text_field_commands_t command_id) { | ||||
|   static_assert(static_cast<int>(CEF_TFC_NUM_VALUES) - 1 == | ||||
|                     static_cast<int>(views::Textfield::kLastCommandId), | ||||
|                 "Enum values in cef_text_field_commands_t must match " | ||||
|                 "views::Textfield::MenuCommands"); | ||||
|   switch (command_id) { | ||||
|     case cef_text_field_commands_t::CEF_TFC_CUT: | ||||
|     case CEF_TFC_UNKNOWN: | ||||
|       return 0; | ||||
|     case CEF_TFC_CUT: | ||||
|       return views::Textfield::kCut; | ||||
|     case cef_text_field_commands_t::CEF_TFC_COPY: | ||||
|     case CEF_TFC_COPY: | ||||
|       return views::Textfield::kCopy; | ||||
|     case cef_text_field_commands_t::CEF_TFC_PASTE: | ||||
|     case CEF_TFC_PASTE: | ||||
|       return views::Textfield::kPaste; | ||||
|     case cef_text_field_commands_t::CEF_TFC_UNDO: | ||||
|       return views::Textfield::kUndo; | ||||
|     case cef_text_field_commands_t::CEF_TFC_DELETE: | ||||
|       return views::Textfield::kDelete; | ||||
|     case cef_text_field_commands_t::CEF_TFC_SELECT_ALL: | ||||
|     case CEF_TFC_SELECT_ALL: | ||||
|       return views::Textfield::kSelectAll; | ||||
|     case CEF_TFC_SELECT_WORD: | ||||
|       return views::Textfield::kSelectWord; | ||||
|     case CEF_TFC_UNDO: | ||||
|       return views::Textfield::kUndo; | ||||
|     case CEF_TFC_DELETE: | ||||
|       return views::Textfield::kDelete; | ||||
|     case CEF_TFC_NUM_VALUES: | ||||
|       break; | ||||
|   } | ||||
|   DCHECK(false) << "Unsupported command ID " << command_id; | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| }  // namespace | ||||
|  | ||||
| // static | ||||
|   | ||||
| @@ -351,7 +351,7 @@ SkColor GetColor(const views::View* view, ui::ColorId id) { | ||||
|   // Verify that our enum matches Chromium's values. | ||||
|   static_assert(static_cast<int>(CEF_ChromeColorsEnd) == | ||||
|                     static_cast<int>(kChromeColorsEnd), | ||||
|                 "enum mismatch"); | ||||
|                 "Enum values in cef_color_id_t must match ChromeColorIds"); | ||||
|  | ||||
|   // |color_provider| will be nullptr if |view| has not yet been added to a | ||||
|   // Widget. | ||||
|   | ||||
| @@ -471,6 +471,9 @@ void CefWindowView::CreateWidget(gfx::AcceleratedWidget parent_widget) { | ||||
|           params.show_state = ui::mojom::WindowShowState::kMinimized; | ||||
| #endif | ||||
|           break; | ||||
|         case CEF_SHOW_STATE_NUM_VALUES: | ||||
|           DCHECK(false); | ||||
|           break; | ||||
|       } | ||||
|  | ||||
|       bool is_menu = false; | ||||
|   | ||||
| @@ -208,7 +208,12 @@ net::CookieSameSite MakeCookieSameSite(cef_cookie_same_site_t value) { | ||||
|       return net::CookieSameSite::LAX_MODE; | ||||
|     case CEF_COOKIE_SAME_SITE_STRICT_MODE: | ||||
|       return net::CookieSameSite::STRICT_MODE; | ||||
|     case CEF_COOKIE_SAME_SITE_NUM_VALUES: | ||||
|       break; | ||||
|   } | ||||
|  | ||||
|   DCHECK(false); | ||||
|   return net::CookieSameSite::UNSPECIFIED; | ||||
| } | ||||
|  | ||||
| net::CookiePriority MakeCookiePriority(cef_cookie_priority_t value) { | ||||
|   | ||||
| @@ -183,9 +183,10 @@ CefRefPtr<CefRequest> CefRequest::Create() { | ||||
|  | ||||
| CefRequestImpl::CefRequestImpl() { | ||||
|   // Verify that our enum matches Chromium's values. | ||||
|   static_assert(static_cast<int>(REFERRER_POLICY_LAST_VALUE) == | ||||
|                     static_cast<int>(net::ReferrerPolicy::MAX), | ||||
|                 "enum mismatch"); | ||||
|   static_assert( | ||||
|       static_cast<int>(REFERRER_POLICY_NUM_VALUES) - 1 == | ||||
|           static_cast<int>(net::ReferrerPolicy::MAX), | ||||
|       "Enum values in cef_referrer_policy_t must match net::ReferrerPolicy"); | ||||
|  | ||||
|   base::AutoLock lock_scope(lock_); | ||||
|   Reset(); | ||||
| @@ -751,6 +752,8 @@ CefRequestImpl::NetReferrerPolicyToBlinkReferrerPolicy( | ||||
|       return network::mojom::ReferrerPolicy::kStrictOrigin; | ||||
|     case REFERRER_POLICY_NO_REFERRER: | ||||
|       return network::mojom::ReferrerPolicy::kNever; | ||||
|     case REFERRER_POLICY_NUM_VALUES: | ||||
|       break; | ||||
|   } | ||||
|   DCHECK(false); | ||||
|   return network::mojom::ReferrerPolicy::kDefault; | ||||
|   | ||||
| @@ -393,6 +393,10 @@ void ClientDialogHandlerGtk::OnJSDialogContinue(const OnJSDialogParams& params, | ||||
|       gtk_message_type = GTK_MESSAGE_QUESTION; | ||||
|       title = "JavaScript Prompt"; | ||||
|       break; | ||||
|  | ||||
|     case JSDIALOGTYPE_NUM_VALUES: | ||||
|       NOTREACHED(); | ||||
|       return; | ||||
|   } | ||||
|  | ||||
|   js_dialog_callback_ = params.callback; | ||||
|   | ||||
| @@ -45,6 +45,9 @@ std::string TaskTypeToString(cef_task_type_t type) { | ||||
|       return "Shared Worker"; | ||||
|     case CEF_TASK_TYPE_SERVICE_WORKER: | ||||
|       return "Service Worker"; | ||||
|     case CEF_TASK_TYPE_NUM_VALUES: | ||||
|       NOTREACHED(); | ||||
|       break; | ||||
|   } | ||||
|   return "Unknown"; | ||||
| } | ||||
|   | ||||
| @@ -775,6 +775,8 @@ std::string GetErrorString(cef_termination_status_t status) { | ||||
|       return "LAUNCH_FAILED"; | ||||
|     case TS_INTEGRITY_FAILURE: | ||||
|       return "INTEGRITY_FAILURE"; | ||||
|     case TS_NUM_VALUES: | ||||
|       break; | ||||
|   } | ||||
|   NOTREACHED(); | ||||
|   return std::string(); | ||||
|   | ||||
| @@ -47,6 +47,7 @@ void ExtractUnderlines(NSAttributedString* string, | ||||
|             [colorAttr colorUsingColorSpace:NSColorSpace.deviceRGBColorSpace]); | ||||
|       } | ||||
|       cef_composition_underline_t line = { | ||||
|           sizeof(cef_composition_underline_t), | ||||
|           {static_cast<uint32_t>(range.location), | ||||
|            static_cast<uint32_t>(NSMaxRange(range))}, | ||||
|           color, | ||||
| @@ -145,7 +146,8 @@ extern NSString* NSTextInputReplacementRangeAttributeName; | ||||
|     ExtractUnderlines(aString, &underlines_); | ||||
|   } else { | ||||
|     // Use a thin black underline by default. | ||||
|     cef_composition_underline_t line = {{0, length}, ColorBLACK, 0, false}; | ||||
|     cef_composition_underline_t line = { | ||||
|         sizeof(cef_composition_underline_t), {0, length}, ColorBLACK, 0, false}; | ||||
|     underlines_.push_back(line); | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -866,3 +866,244 @@ TEST(ApiVersionTest, RawPtrClientList) { | ||||
|   // Only one reference to the object should exist. | ||||
|   EXPECT_TRUE(obj->HasOneRef()); | ||||
| } | ||||
|  | ||||
| namespace { | ||||
|  | ||||
| // Example of the same struct at different versions. | ||||
| struct test_struct_v1_t { | ||||
|   size_t size; | ||||
|   int val1; | ||||
| }; | ||||
|  | ||||
| struct test_struct_v2_t { | ||||
|   size_t size; | ||||
|   int val1; | ||||
|   cef_string_t val2; | ||||
| }; | ||||
|  | ||||
| // Example of a simple struct wrapper without traits. | ||||
| using TestClassV1 = CefStructBaseSimple<test_struct_v1_t>; | ||||
|  | ||||
| // Same example with traits. | ||||
| struct TestClassV1Traits { | ||||
|   using struct_type = test_struct_v1_t; | ||||
|  | ||||
|   static inline void init(struct_type* s) { s->size = sizeof(struct_type); } | ||||
|  | ||||
|   static inline void clear(struct_type* s) {} | ||||
|  | ||||
|   static inline void set(const struct_type* src, | ||||
|                          struct_type* target, | ||||
|                          bool copy) { | ||||
|     target->val1 = src->val1; | ||||
|   } | ||||
| }; | ||||
|  | ||||
| using TestClassV1Ex = CefStructBase<TestClassV1Traits>; | ||||
|  | ||||
| // Structs containing strings require traits. | ||||
| struct TestClassV2Traits { | ||||
|   using struct_type = test_struct_v2_t; | ||||
|  | ||||
|   static inline void init(struct_type* s) { s->size = sizeof(struct_type); } | ||||
|  | ||||
|   static inline void clear(struct_type* s) { cef_string_clear(&s->val2); } | ||||
|  | ||||
|   static inline void set(const struct_type* src, | ||||
|                          struct_type* target, | ||||
|                          bool copy) { | ||||
|     target->val1 = src->val1; | ||||
|  | ||||
|     // Need to check that the newer member exists before accessing. | ||||
|     if (CEF_MEMBER_EXISTS(src, val2)) { | ||||
|       cef_string_set(src->val2.str, src->val2.length, &target->val2, copy); | ||||
|     } | ||||
|   } | ||||
| }; | ||||
|  | ||||
| using TestClassV2 = CefStructBase<TestClassV2Traits>; | ||||
|  | ||||
| }  // namespace | ||||
|  | ||||
| // Test usage of struct and wrapper at the same version. | ||||
| TEST(ApiVersionTest, StructVersionSame) { | ||||
|   TestClassV1 classv1; | ||||
|   EXPECT_EQ(classv1.size, sizeof(test_struct_v1_t)); | ||||
|   EXPECT_EQ(classv1.val1, 0); | ||||
|  | ||||
|   test_struct_v1_t structv1{sizeof(test_struct_v1_t), 10}; | ||||
|   EXPECT_EQ(structv1.size, sizeof(test_struct_v1_t)); | ||||
|   EXPECT_EQ(structv1.val1, 10); | ||||
|  | ||||
|   classv1 = structv1; | ||||
|   EXPECT_EQ(classv1.size, sizeof(test_struct_v1_t)); | ||||
|   EXPECT_EQ(classv1.val1, 10); | ||||
|  | ||||
|   TestClassV2 classv2; | ||||
|   EXPECT_EQ(classv2.size, sizeof(test_struct_v2_t)); | ||||
|   EXPECT_EQ(classv2.val1, 0); | ||||
|   EXPECT_EQ(classv2.val2.length, 0U); | ||||
|  | ||||
|   const std::string testStr = "Test"; | ||||
|  | ||||
|   test_struct_v2_t structv2{sizeof(test_struct_v2_t), 10}; | ||||
|   EXPECT_EQ(structv2.size, sizeof(test_struct_v2_t)); | ||||
|   EXPECT_EQ(structv2.val1, 10); | ||||
|   EXPECT_EQ(structv2.val2.length, 0U); | ||||
|  | ||||
|   CefString(&(structv2.val2)) = testStr; | ||||
|   const auto* testStrPtr = structv2.val2.str; | ||||
|  | ||||
|   classv2.AttachTo(structv2); | ||||
|  | ||||
|   // Both |classv2| and |structv2| reference the same thing. | ||||
|   EXPECT_EQ(classv2.size, sizeof(test_struct_v2_t)); | ||||
|   EXPECT_EQ(classv2.val1, 10); | ||||
|   EXPECT_EQ(classv2.val2.str, testStrPtr); | ||||
|   EXPECT_EQ(structv2.size, sizeof(test_struct_v2_t)); | ||||
|   EXPECT_EQ(structv2.val1, 10); | ||||
|   EXPECT_EQ(structv2.val2.str, testStrPtr); | ||||
|  | ||||
|   classv2.DetachTo(structv2); | ||||
|  | ||||
|   // Now only |structv2| references it. | ||||
|   EXPECT_EQ(classv2.size, sizeof(test_struct_v2_t)); | ||||
|   EXPECT_EQ(classv2.val1, 0); | ||||
|   EXPECT_EQ(classv2.val2.length, 0U); | ||||
|   EXPECT_EQ(structv2.size, sizeof(test_struct_v2_t)); | ||||
|   EXPECT_EQ(structv2.val1, 10); | ||||
|   EXPECT_EQ(structv2.val2.str, testStrPtr); | ||||
|  | ||||
|   classv2 = structv2; | ||||
|  | ||||
|   // Now |classv2| has a copy of the string. | ||||
|   EXPECT_EQ(classv2.size, sizeof(test_struct_v2_t)); | ||||
|   EXPECT_EQ(classv2.val1, 10); | ||||
|   EXPECT_GT(classv2.val2.length, 0U); | ||||
|   EXPECT_NE(classv2.val2.str, testStrPtr); | ||||
|   EXPECT_STREQ(testStr.c_str(), CefString(&(classv2.val2)).ToString().c_str()); | ||||
|   EXPECT_EQ(structv2.size, sizeof(test_struct_v2_t)); | ||||
|   EXPECT_EQ(structv2.val1, 10); | ||||
|   EXPECT_EQ(structv2.val2.str, testStrPtr); | ||||
|  | ||||
|   // Cleanup the struct. | ||||
|   cef_string_clear(&(structv2.val2)); | ||||
| } | ||||
|  | ||||
| // Test usage of older wrapper with newer struct. | ||||
| TEST(ApiVersionTest, StructVersionNewer) { | ||||
|   // V1 starts at V1 size. | ||||
|   TestClassV1 classv1; | ||||
|   EXPECT_EQ(classv1.size, sizeof(test_struct_v1_t)); | ||||
|   EXPECT_EQ(classv1.val1, 0); | ||||
|  | ||||
|   // V2 starts at V2 size. | ||||
|   test_struct_v2_t structv2{sizeof(test_struct_v2_t), 10}; | ||||
|   EXPECT_EQ(structv2.size, sizeof(test_struct_v2_t)); | ||||
|   EXPECT_EQ(structv2.val1, 10); | ||||
|   EXPECT_EQ(structv2.val2.length, 0U); | ||||
|  | ||||
|   const std::string testStr = "Test"; | ||||
|   CefString(&(structv2.val2)) = testStr; | ||||
|  | ||||
|   classv1 = reinterpret_cast<test_struct_v1_t&>(structv2); | ||||
|  | ||||
|   // Now |classv1| has the same value (up to V1 size). | ||||
|   EXPECT_EQ(classv1.size, sizeof(test_struct_v1_t)); | ||||
|   EXPECT_EQ(classv1.val1, 10); | ||||
|  | ||||
|   // Cleanup the struct. | ||||
|   cef_string_clear(&(structv2.val2)); | ||||
| } | ||||
|  | ||||
| // Same as above, but with traits. | ||||
| TEST(ApiVersionTest, StructVersionNewerEx) { | ||||
|   // V1 starts at V1 size. | ||||
|   TestClassV1Ex classv1; | ||||
|   EXPECT_EQ(classv1.size, sizeof(test_struct_v1_t)); | ||||
|   EXPECT_EQ(classv1.val1, 0); | ||||
|  | ||||
|   // V2 starts at V2 size. | ||||
|   test_struct_v2_t structv2{sizeof(test_struct_v2_t), 10}; | ||||
|   EXPECT_EQ(structv2.size, sizeof(test_struct_v2_t)); | ||||
|   EXPECT_EQ(structv2.val1, 10); | ||||
|   EXPECT_EQ(structv2.val2.length, 0U); | ||||
|  | ||||
|   const std::string testStr = "Test"; | ||||
|   CefString(&(structv2.val2)) = testStr; | ||||
|   const auto* testStrPtr = structv2.val2.str; | ||||
|  | ||||
|   classv1.AttachTo(reinterpret_cast<test_struct_v1_t&>(structv2)); | ||||
|  | ||||
|   // Both |classv1| and |structv2| now reference the same thing (up to V1 size). | ||||
|   EXPECT_EQ(classv1.size, sizeof(test_struct_v1_t)); | ||||
|   EXPECT_EQ(classv1.val1, 10); | ||||
|   EXPECT_EQ(structv2.size, sizeof(test_struct_v2_t)); | ||||
|   EXPECT_EQ(structv2.val1, 10); | ||||
|   EXPECT_EQ(structv2.val2.str, testStrPtr); | ||||
|  | ||||
|   classv1.DetachTo(reinterpret_cast<test_struct_v1_t&>(structv2)); | ||||
|  | ||||
|   // Now only |structv1| references it (up to V1 size), and the rest is left | ||||
|   // alone. | ||||
|   EXPECT_EQ(classv1.size, sizeof(test_struct_v1_t)); | ||||
|   EXPECT_EQ(classv1.val1, 0); | ||||
|   EXPECT_EQ(structv2.size, sizeof(test_struct_v1_t)); | ||||
|   EXPECT_EQ(structv2.val1, 10); | ||||
|   EXPECT_EQ(structv2.val2.str, testStrPtr); | ||||
|  | ||||
|   classv1 = reinterpret_cast<test_struct_v1_t&>(structv2); | ||||
|  | ||||
|   // Now |classv1| has the same value (up to V1 size). | ||||
|   EXPECT_EQ(classv1.size, sizeof(test_struct_v1_t)); | ||||
|   EXPECT_EQ(classv1.val1, 10); | ||||
|  | ||||
|   // Cleanup the struct. | ||||
|   cef_string_clear(&(structv2.val2)); | ||||
| } | ||||
|  | ||||
| // Test usage of newer wrapper with older struct. | ||||
| TEST(ApiVersionTest, StructVersionOlder) { | ||||
|   // V1 starts at V1 size. | ||||
|   test_struct_v1_t structv1{sizeof(test_struct_v1_t), 10}; | ||||
|   EXPECT_EQ(structv1.size, sizeof(test_struct_v1_t)); | ||||
|   EXPECT_EQ(structv1.val1, 10); | ||||
|  | ||||
|   // V2 starts at V2 size. | ||||
|   TestClassV2 classv2; | ||||
|   EXPECT_EQ(classv2.size, sizeof(test_struct_v2_t)); | ||||
|   EXPECT_EQ(classv2.val1, 0); | ||||
|   EXPECT_EQ(classv2.val2.length, 0U); | ||||
|  | ||||
|   const std::string testStr = "Test"; | ||||
|   CefString(&(classv2.val2)) = testStr; | ||||
|  | ||||
|   classv2.AttachTo(reinterpret_cast<test_struct_v2_t&>(structv1)); | ||||
|  | ||||
|   // Both |classv2| and |structv1| now reference the same thing (up to V1 size), | ||||
|   // and the rest is cleared. | ||||
|   EXPECT_EQ(classv2.size, sizeof(test_struct_v1_t)); | ||||
|   EXPECT_EQ(classv2.val1, 10); | ||||
|   EXPECT_EQ(classv2.val2.length, 0U); | ||||
|   EXPECT_EQ(structv1.size, sizeof(test_struct_v1_t)); | ||||
|   EXPECT_EQ(structv1.val1, 10); | ||||
|  | ||||
|   classv2.DetachTo(reinterpret_cast<test_struct_v2_t&>(structv1)); | ||||
|  | ||||
|   // Now only |structv1| references it (up to V1 size). Note that |classv2| is | ||||
|   // back to V2 size. | ||||
|   EXPECT_EQ(classv2.size, sizeof(test_struct_v2_t)); | ||||
|   EXPECT_EQ(classv2.val1, 0); | ||||
|   EXPECT_EQ(classv2.val2.length, 0U); | ||||
|   EXPECT_EQ(structv1.size, sizeof(test_struct_v1_t)); | ||||
|   EXPECT_EQ(structv1.val1, 10); | ||||
|  | ||||
|   CefString(&(classv2.val2)) = testStr; | ||||
|  | ||||
|   classv2 = reinterpret_cast<test_struct_v2_t&>(structv1); | ||||
|  | ||||
|   // Now |classv1| has the same value (up to V1 size), and the rest is cleared. | ||||
|   EXPECT_EQ(classv2.size, sizeof(test_struct_v2_t)); | ||||
|   EXPECT_EQ(classv2.val1, 10); | ||||
|   EXPECT_EQ(classv2.val2.length, 0U); | ||||
| } | ||||
|   | ||||
| @@ -1629,7 +1629,8 @@ class OSRTestHandler : public RoutingTestHandler, | ||||
|  | ||||
|     // Use a thin black underline by default. | ||||
|     CefRange range(0, static_cast<uint32_t>(markedText.length())); | ||||
|     cef_composition_underline_t line = {range, 0xFF000000, 0, false}; | ||||
|     cef_composition_underline_t line = {sizeof(cef_composition_underline_t), | ||||
|                                         range, 0xFF000000, 0, false}; | ||||
|     underlines.push_back(line); | ||||
|  | ||||
|     CefRange replacement_range(0, static_cast<uint32_t>(markedText.length())); | ||||
| @@ -1654,7 +1655,8 @@ class OSRTestHandler : public RoutingTestHandler, | ||||
|  | ||||
|     // Use a thin black underline by default. | ||||
|     CefRange range(0, static_cast<uint32_t>(markedText.length())); | ||||
|     cef_composition_underline_t line = {range, 0xFF000000, 0, false}; | ||||
|     cef_composition_underline_t line = {sizeof(cef_composition_underline_t), | ||||
|                                         range, 0xFF000000, 0, false}; | ||||
|     underlines.push_back(line); | ||||
|  | ||||
|     CefRange replacement_range(0, static_cast<uint32_t>(markedText.length())); | ||||
|   | ||||
| @@ -219,6 +219,9 @@ void TestDictionaryEqual(CefRefPtr<CefDictionaryValue> val1, | ||||
|       case VTYPE_LIST: | ||||
|         TestListEqual(val1->GetList(key), val2->GetList(key)); | ||||
|         break; | ||||
|       case VTYPE_NUM_VALUES: | ||||
|         NOTREACHED(); | ||||
|         break; | ||||
|     } | ||||
|   } | ||||
| } | ||||
| @@ -261,6 +264,9 @@ void TestListEqual(CefRefPtr<CefListValue> val1, CefRefPtr<CefListValue> val2) { | ||||
|       case VTYPE_LIST: | ||||
|         TestListEqual(val1->GetList(i), val2->GetList(i)); | ||||
|         break; | ||||
|       case VTYPE_NUM_VALUES: | ||||
|         NOTREACHED(); | ||||
|         break; | ||||
|     } | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -338,7 +338,7 @@ class TestMenuButtonDelegate : public CefMenuButtonDelegate, | ||||
|     model->AddItem(kMenuItemID, kMenuItemLabel); | ||||
|  | ||||
|     // Verify color accessors. | ||||
|     for (int i = 0; i < CEF_MENU_COLOR_COUNT; ++i) { | ||||
|     for (int i = 0; i < CEF_MENU_COLOR_NUM_VALUES; ++i) { | ||||
|       cef_menu_color_type_t color_type = static_cast<cef_menu_color_type_t>(i); | ||||
|       cef_color_t color_out; | ||||
|       cef_color_t color = CefColorSetARGB(255, 255, 255, i); | ||||
|   | ||||
| @@ -118,6 +118,9 @@ void RunWindowShow(cef_show_state_t initial_show_state, | ||||
|       break; | ||||
|     case CEF_SHOW_STATE_HIDDEN: | ||||
|       break; | ||||
|     case CEF_SHOW_STATE_NUM_VALUES: | ||||
|       NOTREACHED(); | ||||
|       break; | ||||
|   } | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user