OLD | NEW |
1 // -*- c++ -*- | 1 // -*- c++ -*- |
2 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
5 | 5 |
6 // The portable representation of an instance and root scriptable object. | 6 // The portable representation of an instance and root scriptable object. |
7 // The PPAPI version of the plugin instantiates a subclass of this class. | 7 // The PPAPI version of the plugin instantiates a subclass of this class. |
8 | 8 |
9 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_H_ | 9 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_H_ |
10 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_H_ | 10 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_H_ |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 // Getter for PPAPI proxy interface. | 291 // Getter for PPAPI proxy interface. |
292 ppapi_proxy::BrowserPpp* ppapi_proxy() const { return ppapi_proxy_; } | 292 ppapi_proxy::BrowserPpp* ppapi_proxy() const { return ppapi_proxy_; } |
293 | 293 |
294 // Called back by CallOnMainThread. Dispatches the first enqueued progress | 294 // Called back by CallOnMainThread. Dispatches the first enqueued progress |
295 // event. | 295 // event. |
296 void DispatchProgressEvent(int32_t result); | 296 void DispatchProgressEvent(int32_t result); |
297 | 297 |
298 // Requests a URL asynchronously resulting in a call to pp_callback with | 298 // Requests a URL asynchronously resulting in a call to pp_callback with |
299 // a PP_Error indicating status. On success an open file descriptor | 299 // a PP_Error indicating status. On success an open file descriptor |
300 // corresponding to the url body is recorded for further lookup. | 300 // corresponding to the url body is recorded for further lookup. |
301 // This is used by SRPC-based StreamAsFile(). | 301 // permits_extension_urls determines whether a call to stream as file |
302 bool StreamAsFile(const nacl::string& url, PP_CompletionCallback pp_callback); | 302 // should be allowed to load URLs that are outside of the origin of the |
| 303 // plugin. This is used by, e.g., the pnacl coordinator, which loads |
| 304 // llc, ld, and various object files from a chrome extension URL. |
| 305 bool StreamAsFile(const nacl::string& url, |
| 306 bool permits_extension_urls, |
| 307 PP_CompletionCallback pp_callback); |
303 // Returns an open POSIX file descriptor retrieved by StreamAsFile() | 308 // Returns an open POSIX file descriptor retrieved by StreamAsFile() |
304 // or NACL_NO_FILE_DESC. The caller must take ownership of the descriptor. | 309 // or NACL_NO_FILE_DESC. The caller must take ownership of the descriptor. |
305 int32_t GetPOSIXFileDesc(const nacl::string& url); | 310 int32_t GetPOSIXFileDesc(const nacl::string& url); |
306 | 311 |
307 // A helper function that gets the scheme type for |url|. Uses URLUtil_Dev | 312 // A helper function that gets the scheme type for |url|. Uses URLUtil_Dev |
308 // interface which this class has as a member. | 313 // interface which this class has as a member. |
309 UrlSchemeType GetUrlScheme(const std::string& url); | 314 UrlSchemeType GetUrlScheme(const std::string& url); |
310 | 315 |
311 // Get the text description of the last error reported by the plugin. | 316 // Get the text description of the last error reported by the plugin. |
312 const nacl::string& last_error_string() const { return last_error_string_; } | 317 const nacl::string& last_error_string() const { return last_error_string_; } |
313 void set_last_error_string(const nacl::string& error) { | 318 void set_last_error_string(const nacl::string& error) { |
314 last_error_string_ = error; | 319 last_error_string_ = error; |
315 } | 320 } |
316 | 321 |
317 // The MIME type used to instantiate this instance of the NaCl plugin. | 322 // The MIME type used to instantiate this instance of the NaCl plugin. |
318 // Typically, the MIME type will be application/x-nacl. However, if the NEXE | 323 // Typically, the MIME type will be application/x-nacl. However, if the NEXE |
319 // is being used as a content type handler for another content type (such as | 324 // is being used as a content type handler for another content type (such as |
320 // PDF), then this function will return that type. | 325 // PDF), then this function will return that type. |
321 const nacl::string& mime_type() const { return mime_type_; } | 326 const nacl::string& mime_type() const { return mime_type_; } |
322 // The default MIME type for the NaCl plugin. | 327 // The default MIME type for the NaCl plugin. |
323 static const char* const kNaClMIMEType; | 328 static const char* const kNaClMIMEType; |
324 // Tests if the MIME type is not a NaCl MIME type. | |
325 bool IsForeignMIMEType() const; | |
326 // Returns true if PPAPI Dev interfaces should be allowed. | 329 // Returns true if PPAPI Dev interfaces should be allowed. |
327 bool enable_dev_interfaces() { return enable_dev_interfaces_; } | 330 bool enable_dev_interfaces() { return enable_dev_interfaces_; } |
328 | 331 |
329 Manifest const* manifest() const { return manifest_.get(); } | 332 Manifest const* manifest() const { return manifest_.get(); } |
330 const pp::URLUtil_Dev* url_util() const { return url_util_; } | 333 const pp::URLUtil_Dev* url_util() const { return url_util_; } |
331 | 334 |
332 // Extracts the exit status from the (main) service runtime. | 335 // Extracts the exit status from the (main) service runtime. |
333 int exit_status() const { | 336 int exit_status() const { |
334 if (NULL == main_service_runtime()) { | 337 if (NULL == main_service_runtime()) { |
335 return -1; | 338 return -1; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 bool* is_portable); | 449 bool* is_portable); |
447 | 450 |
448 // Logs timing information to a UMA histogram, and also logs the same timing | 451 // Logs timing information to a UMA histogram, and also logs the same timing |
449 // information divided by the size of the nexe to another histogram. | 452 // information divided by the size of the nexe to another histogram. |
450 void HistogramStartupTimeSmall(const std::string& name, float dt); | 453 void HistogramStartupTimeSmall(const std::string& name, float dt); |
451 void HistogramStartupTimeMedium(const std::string& name, float dt); | 454 void HistogramStartupTimeMedium(const std::string& name, float dt); |
452 | 455 |
453 // Determines the appropriate nexe for the sandbox and requests a load. | 456 // Determines the appropriate nexe for the sandbox and requests a load. |
454 void RequestNexeLoad(); | 457 void RequestNexeLoad(); |
455 | 458 |
| 459 // This NEXE is being used as a content type handler rather than directly by |
| 460 // an HTML document. |
| 461 bool NexeIsContentHandler() const; |
| 462 |
456 // Callback used when loading a URL for SRPC-based StreamAsFile(). | 463 // Callback used when loading a URL for SRPC-based StreamAsFile(). |
457 void UrlDidOpenForStreamAsFile(int32_t pp_error, | 464 void UrlDidOpenForStreamAsFile(int32_t pp_error, |
458 FileDownloader*& url_downloader, | 465 FileDownloader*& url_downloader, |
459 PP_CompletionCallback pp_callback); | 466 PP_CompletionCallback pp_callback); |
460 | 467 |
461 // Shuts down the proxy for PPAPI nexes. | 468 // Shuts down the proxy for PPAPI nexes. |
462 void ShutdownProxy(); // Nexe shutdown + proxy deletion. | 469 void ShutdownProxy(); // Nexe shutdown + proxy deletion. |
463 | 470 |
464 BrowserInterface* browser_interface_; | 471 BrowserInterface* browser_interface_; |
465 ScriptableHandle* scriptable_handle_; | 472 ScriptableHandle* scriptable_handle_; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 // in UpdateDownloadProgress to map a url loader back to the URL being | 569 // in UpdateDownloadProgress to map a url loader back to the URL being |
563 // downloaded. | 570 // downloaded. |
564 const FileDownloader* FindFileDownloader(PP_Resource url_loader) const; | 571 const FileDownloader* FindFileDownloader(PP_Resource url_loader) const; |
565 | 572 |
566 int64_t time_of_last_progress_event_; | 573 int64_t time_of_last_progress_event_; |
567 }; | 574 }; |
568 | 575 |
569 } // namespace plugin | 576 } // namespace plugin |
570 | 577 |
571 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_H_ | 578 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_H_ |
OLD | NEW |