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.
5 #ifndef CONTENT_CHILD_NPAPI_URL_FETCHER_H_
6 #define CONTENT_CHILD_NPAPI_URL_FETCHER_H_
10 #include "base/memory/scoped_ptr.h"
12 #include "webkit/child/resource_loader_bridge.h"
14 namespace webkit_glue
{
15 class MultipartResponseDelegate
;
16 class ResourceLoaderBridge
;
20 class PluginStreamUrl
;
22 // Fetches URLS for a plugin using ResourceDispatcher.
23 class PluginURLFetcher
: public webkit_glue::ResourceLoaderBridge::Peer
{
25 PluginURLFetcher(PluginStreamUrl
* plugin_stream
,
27 const GURL
& first_party_for_cookies
,
28 const std::string
& method
,
32 bool notify_redirects
,
33 bool is_plugin_src_load
,
36 unsigned long resource_id
);
37 virtual ~PluginURLFetcher();
39 // Cancels the current request.
42 // Called with the plugin's reply to NPP_URLRedirectNotify.
43 void URLRedirectResponse(bool allow
);
45 bool pending_failure_notification() { return pending_failure_notification_
; }
48 // webkit_glue::ResourceLoaderBridge::Peer implementation:
49 virtual void OnUploadProgress(uint64 position
, uint64 size
) OVERRIDE
;
50 virtual bool OnReceivedRedirect(const GURL
& new_url
,
51 const webkit_glue::ResourceResponseInfo
& info
,
52 bool* has_new_first_party_for_cookies
,
53 GURL
* new_first_party_for_cookies
) OVERRIDE
;
54 virtual void OnReceivedResponse(
55 const webkit_glue::ResourceResponseInfo
& info
) OVERRIDE
;
56 virtual void OnDownloadedData(int len
, int encoded_data_length
) OVERRIDE
;
57 virtual void OnReceivedData(const char* data
,
59 int encoded_data_length
) OVERRIDE
;
60 virtual void OnCompletedRequest(
62 bool was_ignored_by_handler
,
63 const std::string
& security_info
,
64 const base::TimeTicks
& completion_time
) OVERRIDE
;
66 PluginStreamUrl
* plugin_stream_
;
68 GURL first_party_for_cookies_
;
71 bool notify_redirects_
;
72 bool is_plugin_src_load_
;
73 unsigned long resource_id_
;
75 bool pending_failure_notification_
;
77 scoped_ptr
<webkit_glue::MultipartResponseDelegate
> multipart_delegate_
;
79 scoped_ptr
<webkit_glue::ResourceLoaderBridge
> bridge_
;
81 DISALLOW_COPY_AND_ASSIGN(PluginURLFetcher
);
84 } // namespace content
86 #endif // CONTENT_CHILD_NPAPI_URL_FETCHER_H_