Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / content / child / npapi / plugin_url_fetcher.h
blob8b0f09af669e79f37ab1230a8031b44200a39686
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 "base/memory/weak_ptr.h"
12 #include "content/public/child/request_peer.h"
13 #include "content/public/common/referrer.h"
14 #include "url/gurl.h"
16 namespace content {
17 class MultipartResponseDelegate;
18 class PluginStreamUrl;
20 // Fetches URLS for a plugin using ResourceDispatcher.
21 class PluginURLFetcher : public RequestPeer {
22 public:
23 PluginURLFetcher(PluginStreamUrl* plugin_stream,
24 const GURL& url,
25 const GURL& first_party_for_cookies,
26 const std::string& method,
27 const char* buf,
28 unsigned int len,
29 const Referrer& referrer,
30 const std::string& range,
31 bool notify_redirects,
32 bool is_plugin_src_load,
33 int origin_pid,
34 int render_frame_id,
35 int render_view_id,
36 unsigned long resource_id,
37 bool copy_stream_data);
38 ~PluginURLFetcher() override;
40 // Cancels the current request.
41 void Cancel();
43 // Called with the plugin's reply to NPP_URLRedirectNotify.
44 void URLRedirectResponse(bool allow);
46 GURL first_party_for_cookies() { return first_party_for_cookies_; }
47 Referrer referrer() { return referrer_; }
48 int origin_pid() { return origin_pid_; }
49 int render_frame_id() { return render_frame_id_; }
50 int render_view_id() { return render_view_id_; }
51 bool copy_stream_data() { return copy_stream_data_; }
52 bool pending_failure_notification() { return pending_failure_notification_; }
54 private:
55 // RequestPeer implementation:
56 void OnUploadProgress(uint64 position, uint64 size) override;
57 bool OnReceivedRedirect(const net::RedirectInfo& redirect_info,
58 const ResourceResponseInfo& info) override;
59 void OnReceivedResponse(const ResourceResponseInfo& info) override;
60 void OnDownloadedData(int len, int encoded_data_length) override;
61 void OnReceivedData(scoped_ptr<ReceivedData> data) override;
62 void OnCompletedRequest(int error_code,
63 bool was_ignored_by_handler,
64 bool stale_copy_in_cache,
65 const std::string& security_info,
66 const base::TimeTicks& completion_time,
67 int64 total_transfer_size) override;
68 void OnReceivedCompletedResponse(const ResourceResponseInfo& info,
69 scoped_ptr<ReceivedData> data,
70 int error_code,
71 bool was_ignored_by_handler,
72 bool stale_copy_in_cache,
73 const std::string& security_info,
74 const base::TimeTicks& completion_time,
75 int64 total_transfer_size) override;
77 // |plugin_stream_| becomes NULL after Cancel() to ensure no further calls
78 // |reach it.
79 PluginStreamUrl* plugin_stream_;
80 GURL url_;
81 GURL first_party_for_cookies_;
82 Referrer referrer_;
83 bool notify_redirects_;
84 bool is_plugin_src_load_;
85 int origin_pid_;
86 int render_frame_id_;
87 int render_view_id_;
88 unsigned long resource_id_;
89 bool copy_stream_data_;
90 int64 data_offset_;
91 bool pending_failure_notification_;
92 int request_id_;
94 scoped_ptr<MultipartResponseDelegate> multipart_delegate_;
95 base::WeakPtrFactory<PluginURLFetcher> weak_factory_;
97 DISALLOW_COPY_AND_ASSIGN(PluginURLFetcher);
100 } // namespace content
102 #endif // CONTENT_CHILD_NPAPI_PLUGIN_URL_FETCHER_H_