OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_PLUGIN_PLUGIN_URL_FETCHER_H_ |
| 6 #define CONTENT_PLUGIN_PLUGIN_URL_FETCHER_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "url/gurl.h" |
| 12 #include "webkit/child/resource_loader_bridge.h" |
| 13 |
| 14 namespace webkit_glue { |
| 15 class ResourceLoaderBridge; |
| 16 } |
| 17 |
| 18 namespace content { |
| 19 class WebPluginProxy; |
| 20 class WebPluginResourceClient; |
| 21 |
| 22 // Fetches URLS for a plugin using ResourceDispatcher. We avoid going through |
| 23 // the renderer because plugins can request any origin, and we can't let a |
| 24 // renderer request any URL when running under site isolation. |
| 25 class PluginURLFetcher : public webkit_glue::ResourceLoaderBridge::Peer { |
| 26 public: |
| 27 PluginURLFetcher(WebPluginResourceClient* client, |
| 28 WebPluginProxy* webplugin_proxy, |
| 29 const GURL& url, |
| 30 const GURL& first_party_for_cookies, |
| 31 const std::string& method, |
| 32 const std::string& post_data, |
| 33 const GURL& referrer, |
| 34 bool notify_redirects, |
| 35 bool is_plugin_src_load, |
| 36 int render_process_id, |
| 37 unsigned long resource_id); |
| 38 virtual ~PluginURLFetcher(); |
| 39 |
| 40 // Cancels the current request. |
| 41 void Cancel(); |
| 42 |
| 43 // Called with the plugin's reply to NPP_URLRedirectNotify. |
| 44 void URLRedirectResponse(bool allow); |
| 45 |
| 46 WebPluginResourceClient* client() { return client_; } |
| 47 |
| 48 private: |
| 49 // webkit_glue::ResourceLoaderBridge::Peer implementation: |
| 50 virtual void OnUploadProgress(uint64 position, uint64 size) OVERRIDE; |
| 51 virtual bool OnReceivedRedirect(const GURL& new_url, |
| 52 const webkit_glue::ResourceResponseInfo& info, |
| 53 bool* has_new_first_party_for_cookies, |
| 54 GURL* new_first_party_for_cookies) OVERRIDE; |
| 55 virtual void OnReceivedResponse( |
| 56 const webkit_glue::ResourceResponseInfo& info) OVERRIDE; |
| 57 virtual void OnDownloadedData(int len, int encoded_data_length) OVERRIDE; |
| 58 virtual void OnReceivedData(const char* data, |
| 59 int data_length, |
| 60 int encoded_data_length) OVERRIDE; |
| 61 virtual void OnCompletedRequest( |
| 62 int error_code, |
| 63 bool was_ignored_by_handler, |
| 64 const std::string& security_info, |
| 65 const base::TimeTicks& completion_time) OVERRIDE; |
| 66 |
| 67 WebPluginResourceClient* client_; |
| 68 WebPluginProxy* webplugin_proxy_; |
| 69 GURL url_; |
| 70 GURL first_party_for_cookies_; |
| 71 std::string method_; |
| 72 std::string post_data_; |
| 73 GURL referrer_; |
| 74 bool notify_redirects_; |
| 75 bool is_plugin_src_load_; |
| 76 unsigned long resource_id_; |
| 77 int data_offset_; |
| 78 |
| 79 scoped_ptr<webkit_glue::ResourceLoaderBridge> bridge_; |
| 80 |
| 81 DISALLOW_COPY_AND_ASSIGN(PluginURLFetcher); |
| 82 }; |
| 83 |
| 84 } // namespace content |
| 85 |
| 86 #endif // CONTENT_PLUGIN_PLUGIN_URL_FETCHER_H_ |
OLD | NEW |