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 // This is used by SRPC-based StreamAsFile(). |
jvoung - send to chromium...
2011/12/19 21:37:08
Perhaps add a comment about permits_extension_urls
sehr (please use chromium)
2011/12/20 01:48:38
Done.
| |
302 bool StreamAsFile(const nacl::string& url, PP_CompletionCallback pp_callback); | 302 bool StreamAsFile(const nacl::string& url, |
303 bool permits_extension_urls, | |
304 PP_CompletionCallback pp_callback); | |
303 // Returns an open POSIX file descriptor retrieved by StreamAsFile() | 305 // Returns an open POSIX file descriptor retrieved by StreamAsFile() |
304 // or NACL_NO_FILE_DESC. The caller must take ownership of the descriptor. | 306 // or NACL_NO_FILE_DESC. The caller must take ownership of the descriptor. |
305 int32_t GetPOSIXFileDesc(const nacl::string& url); | 307 int32_t GetPOSIXFileDesc(const nacl::string& url); |
306 | 308 |
307 // A helper function that gets the scheme type for |url|. Uses URLUtil_Dev | 309 // A helper function that gets the scheme type for |url|. Uses URLUtil_Dev |
308 // interface which this class has as a member. | 310 // interface which this class has as a member. |
309 UrlSchemeType GetUrlScheme(const std::string& url); | 311 UrlSchemeType GetUrlScheme(const std::string& url); |
310 | 312 |
311 // Get the text description of the last error reported by the plugin. | 313 // Get the text description of the last error reported by the plugin. |
312 const nacl::string& last_error_string() const { return last_error_string_; } | 314 const nacl::string& last_error_string() const { return last_error_string_; } |
313 void set_last_error_string(const nacl::string& error) { | 315 void set_last_error_string(const nacl::string& error) { |
314 last_error_string_ = error; | 316 last_error_string_ = error; |
315 } | 317 } |
316 | 318 |
317 // The MIME type used to instantiate this instance of the NaCl plugin. | 319 // 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 | 320 // 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 | 321 // is being used as a content type handler for another content type (such as |
320 // PDF), then this function will return that type. | 322 // PDF), then this function will return that type. |
321 const nacl::string& mime_type() const { return mime_type_; } | 323 const nacl::string& mime_type() const { return mime_type_; } |
322 // The default MIME type for the NaCl plugin. | 324 // The default MIME type for the NaCl plugin. |
323 static const char* const kNaClMIMEType; | 325 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. | 326 // Returns true if PPAPI Dev interfaces should be allowed. |
327 bool enable_dev_interfaces() { return enable_dev_interfaces_; } | 327 bool enable_dev_interfaces() { return enable_dev_interfaces_; } |
328 | 328 |
329 Manifest const* manifest() const { return manifest_.get(); } | 329 Manifest const* manifest() const { return manifest_.get(); } |
330 const pp::URLUtil_Dev* url_util() const { return url_util_; } | 330 const pp::URLUtil_Dev* url_util() const { return url_util_; } |
331 | 331 |
332 // Extracts the exit status from the (main) service runtime. | 332 // Extracts the exit status from the (main) service runtime. |
333 int exit_status() const { | 333 int exit_status() const { |
334 if (NULL == main_service_runtime()) { | 334 if (NULL == main_service_runtime()) { |
335 return -1; | 335 return -1; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
446 bool* is_portable); | 446 bool* is_portable); |
447 | 447 |
448 // Logs timing information to a UMA histogram, and also logs the same timing | 448 // 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. | 449 // information divided by the size of the nexe to another histogram. |
450 void HistogramStartupTimeSmall(const std::string& name, float dt); | 450 void HistogramStartupTimeSmall(const std::string& name, float dt); |
451 void HistogramStartupTimeMedium(const std::string& name, float dt); | 451 void HistogramStartupTimeMedium(const std::string& name, float dt); |
452 | 452 |
453 // Determines the appropriate nexe for the sandbox and requests a load. | 453 // Determines the appropriate nexe for the sandbox and requests a load. |
454 void RequestNexeLoad(); | 454 void RequestNexeLoad(); |
455 | 455 |
456 // This NEXE is being used as a content type handler rather than directly by | |
457 // an HTML document. | |
458 bool NexeIsContentHandler() const; | |
459 | |
456 // Callback used when loading a URL for SRPC-based StreamAsFile(). | 460 // Callback used when loading a URL for SRPC-based StreamAsFile(). |
457 void UrlDidOpenForStreamAsFile(int32_t pp_error, | 461 void UrlDidOpenForStreamAsFile(int32_t pp_error, |
458 FileDownloader*& url_downloader, | 462 FileDownloader*& url_downloader, |
459 PP_CompletionCallback pp_callback); | 463 PP_CompletionCallback pp_callback); |
460 | 464 |
461 // Shuts down the proxy for PPAPI nexes. | 465 // Shuts down the proxy for PPAPI nexes. |
462 void ShutdownProxy(); // Nexe shutdown + proxy deletion. | 466 void ShutdownProxy(); // Nexe shutdown + proxy deletion. |
463 | 467 |
464 BrowserInterface* browser_interface_; | 468 BrowserInterface* browser_interface_; |
465 ScriptableHandle* scriptable_handle_; | 469 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 | 566 // in UpdateDownloadProgress to map a url loader back to the URL being |
563 // downloaded. | 567 // downloaded. |
564 const FileDownloader* FindFileDownloader(PP_Resource url_loader) const; | 568 const FileDownloader* FindFileDownloader(PP_Resource url_loader) const; |
565 | 569 |
566 int64_t time_of_last_progress_event_; | 570 int64_t time_of_last_progress_event_; |
567 }; | 571 }; |
568 | 572 |
569 } // namespace plugin | 573 } // namespace plugin |
570 | 574 |
571 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_H_ | 575 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_H_ |
OLD | NEW |