| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 The Native Client Authors. All rights reserved. | 2 * Copyright 2010 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can | 3 * Use of this source code is governed by a BSD-style license that can |
| 4 * be found in the LICENSE file. | 4 * be found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 // PPAPI-based implementation of the interface for a NaCl plugin instance. | 7 // PPAPI-based implementation of the interface for a NaCl plugin instance. |
| 8 | 8 |
| 9 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PPAPI_PLUGIN_PPAPI_H_ | 9 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PPAPI_PLUGIN_PPAPI_H_ |
| 10 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PPAPI_PLUGIN_PPAPI_H_ | 10 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PPAPI_PLUGIN_PPAPI_H_ |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 bool UrlAsNaClDesc(const nacl::string& url, pp::Var js_callback); | 84 bool UrlAsNaClDesc(const nacl::string& url, pp::Var js_callback); |
| 85 // Requests a URL asynchronously resulting in a call to pp_callback with | 85 // Requests a URL asynchronously resulting in a call to pp_callback with |
| 86 // a PP_Error indicating status. On success an open file descriptor | 86 // a PP_Error indicating status. On success an open file descriptor |
| 87 // corresponding to the url body is recorded for further lookup. | 87 // corresponding to the url body is recorded for further lookup. |
| 88 // This is used by SRPC-based StreamAsFile(). | 88 // This is used by SRPC-based StreamAsFile(). |
| 89 bool StreamAsFile(const nacl::string& url, PP_CompletionCallback pp_callback); | 89 bool StreamAsFile(const nacl::string& url, PP_CompletionCallback pp_callback); |
| 90 // Returns an open POSIX file descriptor retrieved by StreamAsFile() | 90 // Returns an open POSIX file descriptor retrieved by StreamAsFile() |
| 91 // or NACL_NO_FILE_DESC. The caller must take ownership of the descriptor. | 91 // or NACL_NO_FILE_DESC. The caller must take ownership of the descriptor. |
| 92 int32_t GetPOSIXFileDesc(const nacl::string& url); | 92 int32_t GetPOSIXFileDesc(const nacl::string& url); |
| 93 | 93 |
| 94 // The MIME type used to instantiate this instance of the NaCl plugin. |
| 95 // Typically, the MIME type will be application/x-nacl. However, if the NEXE |
| 96 // is being used as a content type handler for another content type (such as |
| 97 // PDF), then this function will return that type. |
| 98 const nacl::string& mime_type() const { return mime_type_; } |
| 99 |
| 100 // The default MIME type for the NaCl plugin. |
| 101 static const char* const kNaClMIMEType; |
| 102 |
| 94 private: | 103 private: |
| 95 NACL_DISALLOW_COPY_AND_ASSIGN(PluginPpapi); | 104 NACL_DISALLOW_COPY_AND_ASSIGN(PluginPpapi); |
| 96 // Prevent construction and destruction from outside the class: | 105 // Prevent construction and destruction from outside the class: |
| 97 // must use factory New() method instead. | 106 // must use factory New() method instead. |
| 98 explicit PluginPpapi(PP_Instance instance); | 107 explicit PluginPpapi(PP_Instance instance); |
| 99 // The browser will invoke the destructor via the pp::Instance | 108 // The browser will invoke the destructor via the pp::Instance |
| 100 // pointer to this object, not from base's Delete(). | 109 // pointer to this object, not from base's Delete(). |
| 101 virtual ~PluginPpapi(); | 110 virtual ~PluginPpapi(); |
| 102 | 111 |
| 103 // File download support. |nexe_downloader_| can be opened with a specific | 112 // File download support. |nexe_downloader_| can be opened with a specific |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 // (InitializeModule, Shutdown, and GetInterface). | 183 // (InitializeModule, Shutdown, and GetInterface). |
| 175 // TODO(sehr): this should be a scoped_ptr for shutdown. | 184 // TODO(sehr): this should be a scoped_ptr for shutdown. |
| 176 ppapi_proxy::BrowserPpp* ppapi_proxy_; | 185 ppapi_proxy::BrowserPpp* ppapi_proxy_; |
| 177 | 186 |
| 178 // If we get a DidChangeView event before the nexe is loaded, we store it and | 187 // If we get a DidChangeView event before the nexe is loaded, we store it and |
| 179 // replay it to nexe after it's loaded. | 188 // replay it to nexe after it's loaded. |
| 180 bool replayDidChangeView; | 189 bool replayDidChangeView; |
| 181 pp::Rect replayDidChangeViewPosition; | 190 pp::Rect replayDidChangeViewPosition; |
| 182 pp::Rect replayDidChangeViewClip; | 191 pp::Rect replayDidChangeViewClip; |
| 183 | 192 |
| 193 nacl::string mime_type_; |
| 194 |
| 184 // Keep track of the FileDownloaders created to fetch urls. | 195 // Keep track of the FileDownloaders created to fetch urls. |
| 185 std::set<FileDownloader*> url_downloaders_; | 196 std::set<FileDownloader*> url_downloaders_; |
| 186 // Keep track of file descriptors opened by StreamAsFile(). | 197 // Keep track of file descriptors opened by StreamAsFile(). |
| 187 // These are owned by the browser. | 198 // These are owned by the browser. |
| 188 std::map<nacl::string, int32_t> url_fd_map_; | 199 std::map<nacl::string, int32_t> url_fd_map_; |
| 189 }; | 200 }; |
| 190 | 201 |
| 191 } // namespace plugin | 202 } // namespace plugin |
| 192 | 203 |
| 193 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PPAPI_PLUGIN_PPAPI_H_ | 204 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PPAPI_PLUGIN_PPAPI_H_ |
| OLD | NEW |