• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
2 //
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
5 // met:
6 //
7 //    * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 //    * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following disclaimer
11 // in the documentation and/or other materials provided with the
12 // distribution.
13 //    * Neither the name of Google Inc. nor the name Chromium Embedded
14 // Framework nor the names of its contributors may be used to endorse
15 // or promote products derived from this software without specific prior
16 // written permission.
17 //
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // ---------------------------------------------------------------------------
31 //
32 // This file was generated by the CEF translator tool and should not edited
33 // by hand. See the translator.README.txt file in the tools directory for
34 // more information.
35 //
36 // $hash=fcfe34c1517ebdb3f00c1f737b91361e771b820d$
37 //
38 
39 #ifndef CEF_INCLUDE_CAPI_CEF_EXTENSION_CAPI_H_
40 #define CEF_INCLUDE_CAPI_CEF_EXTENSION_CAPI_H_
41 #pragma once
42 
43 #include "include/capi/cef_base_capi.h"
44 #include "include/capi/cef_values_capi.h"
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
50 struct _cef_extension_handler_t;
51 struct _cef_request_context_t;
52 
53 ///
54 // Object representing an extension. Methods may be called on any thread unless
55 // otherwise indicated.
56 ///
57 typedef struct _cef_extension_t {
58   ///
59   // Base structure.
60   ///
61   cef_base_ref_counted_t base;
62 
63   ///
64   // Returns the unique extension identifier. This is calculated based on the
65   // extension public key, if available, or on the extension path. See
66   // https://developer.chrome.com/extensions/manifest/key for details.
67   ///
68   // The resulting string must be freed by calling cef_string_userfree_free().
69   cef_string_userfree_t(CEF_CALLBACK* get_identifier)(
70       struct _cef_extension_t* self);
71 
72   ///
73   // Returns the absolute path to the extension directory on disk. This value
74   // will be prefixed with PK_DIR_RESOURCES if a relative path was passed to
75   // cef_request_context_t::LoadExtension.
76   ///
77   // The resulting string must be freed by calling cef_string_userfree_free().
78   cef_string_userfree_t(CEF_CALLBACK* get_path)(struct _cef_extension_t* self);
79 
80   ///
81   // Returns the extension manifest contents as a cef_dictionary_value_t object.
82   // See https://developer.chrome.com/extensions/manifest for details.
83   ///
84   struct _cef_dictionary_value_t*(CEF_CALLBACK* get_manifest)(
85       struct _cef_extension_t* self);
86 
87   ///
88   // Returns true (1) if this object is the same extension as |that| object.
89   // Extensions are considered the same if identifier, path and loader context
90   // match.
91   ///
92   int(CEF_CALLBACK* is_same)(struct _cef_extension_t* self,
93                              struct _cef_extension_t* that);
94 
95   ///
96   // Returns the handler for this extension. Will return NULL for internal
97   // extensions or if no handler was passed to
98   // cef_request_context_t::LoadExtension.
99   ///
100   struct _cef_extension_handler_t*(CEF_CALLBACK* get_handler)(
101       struct _cef_extension_t* self);
102 
103   ///
104   // Returns the request context that loaded this extension. Will return NULL
105   // for internal extensions or if the extension has been unloaded. See the
106   // cef_request_context_t::LoadExtension documentation for more information
107   // about loader contexts. Must be called on the browser process UI thread.
108   ///
109   struct _cef_request_context_t*(CEF_CALLBACK* get_loader_context)(
110       struct _cef_extension_t* self);
111 
112   ///
113   // Returns true (1) if this extension is currently loaded. Must be called on
114   // the browser process UI thread.
115   ///
116   int(CEF_CALLBACK* is_loaded)(struct _cef_extension_t* self);
117 
118   ///
119   // Unload this extension if it is not an internal extension and is currently
120   // loaded. Will result in a call to
121   // cef_extension_handler_t::OnExtensionUnloaded on success.
122   ///
123   void(CEF_CALLBACK* unload)(struct _cef_extension_t* self);
124 } cef_extension_t;
125 
126 #ifdef __cplusplus
127 }
128 #endif
129 
130 #endif  // CEF_INCLUDE_CAPI_CEF_EXTENSION_CAPI_H_
131