[Android WebView] Fix webview perf bot switchover to use org.chromium.webview_shell...
[chromium-blink-merge.git] / content / child / npapi / plugin_url_fetcher.h
blob1fb848970e8bd8130348471ca54efb9106f69acb
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_PLUGIN_URL_FETCHER_H_
6 #define CONTENT_CHILD_NPAPI_PLUGIN_URL_FETCHER_H_
8 #include <string>
10 #include "base/memory/scoped_ptr.h"
11 #include "content/public/child/request_peer.h"
12 #include "content/public/common/referrer.h"
13 #include "url/gurl.h"
15 namespace content {
16 class MultipartResponseDelegate;
17 class PluginStreamUrl;
19 // Fetches URLS for a plugin using ResourceDispatcher.
20 class PluginURLFetcher : public RequestPeer {
21 public:
22 PluginURLFetcher(PluginStreamUrl* plugin_stream,
23 const GURL& url,
24 const GURL& first_party_for_cookies,
25 const std::string& method,
26 const char* buf,
27 unsigned int len,
28 const Referrer& referrer,
29 const std::string& range,
30 bool notify_redirects,
31 bool is_plugin_src_load,
32 int origin_pid,
33 int render_frame_id,
34 int render_view_id,
35 unsigned long resource_id,
36 bool copy_stream_data);
37 ~PluginURLFetcher() override;
39 // Cancels the current request.
40 void Cancel();
42 // Called with the plugin's reply to NPP_URLRedirectNotify.
43 void URLRedirectResponse(bool allow);
45 GURL first_party_for_cookies() { return first_party_for_cookies_; }
46 Referrer referrer() { return referrer_; }
47 int origin_pid() { return origin_pid_; }
48 int render_frame_id() { return render_frame_id_; }
49 int render_view_id() { return render_view_id_; }
50 bool copy_stream_data() { return copy_stream_data_; }
51 bool pending_failure_notification() { return pending_failure_notification_; }
53 private:
54 // RequestPeer implementation:
55 void OnUploadProgress(uint64 position, uint64 size) override;
56 bool OnReceivedRedirect(const net::RedirectInfo& redirect_info,
57 const ResourceResponseInfo& info) override;
58 void OnReceivedResponse(const ResourceResponseInfo& info) override;
59 void OnDownloadedData(int len, int encoded_data_length) override;
60 void OnReceivedData(scoped_ptr<ReceivedData> data) override;
61 void OnCompletedRequest(int error_code,
62 bool was_ignored_by_handler,
63 bool stale_copy_in_cache,
64 const std::string& security_info,
65 const base::TimeTicks& completion_time,
66 int64 total_transfer_size) override;
68 // |plugin_stream_| becomes NULL after Cancel() to ensure no further calls
69 // |reach it.
70 PluginStreamUrl* plugin_stream_;
71 GURL url_;
72 GURL first_party_for_cookies_;
73 Referrer referrer_;
74 bool notify_redirects_;
75 bool is_plugin_src_load_;
76 int origin_pid_;
77 int render_frame_id_;
78 int render_view_id_;
79 unsigned long resource_id_;
80 bool copy_stream_data_;
81 int64 data_offset_;
82 bool pending_failure_notification_;
83 int request_id_;
85 scoped_ptr<MultipartResponseDelegate> multipart_delegate_;
87 DISALLOW_COPY_AND_ASSIGN(PluginURLFetcher);
90 } // namespace content
92 #endif // CONTENT_CHILD_NPAPI_PLUGIN_URL_FETCHER_H_