OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_CHILD_REQUEST_EXTRA_DATA_H_ | 5 #ifndef CONTENT_CHILD_REQUEST_EXTRA_DATA_H_ |
6 #define CONTENT_CHILD_REQUEST_EXTRA_DATA_H_ | 6 #define CONTENT_CHILD_REQUEST_EXTRA_DATA_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
10 #include "content/public/common/page_transition_types.h" | 10 #include "content/public/common/page_transition_types.h" |
| 11 #include "third_party/WebKit/public/platform/WebString.h" |
| 12 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
11 #include "third_party/WebKit/public/web/WebPageVisibilityState.h" | 13 #include "third_party/WebKit/public/web/WebPageVisibilityState.h" |
12 #include "webkit/child/weburlrequest_extradata_impl.h" | |
13 | 14 |
14 namespace content { | 15 namespace content { |
15 | 16 |
16 // The RenderView stores an instance of this class in the "extra data" of each | 17 // The RenderView stores an instance of this class in the "extra data" of each |
17 // ResourceRequest (see RenderFrameImpl::willSendRequest). | 18 // ResourceRequest (see RenderFrameImpl::willSendRequest). |
18 class CONTENT_EXPORT RequestExtraData | 19 class CONTENT_EXPORT RequestExtraData |
19 : NON_EXPORTED_BASE(public webkit_glue::WebURLRequestExtraDataImpl) { | 20 : public NON_EXPORTED_BASE(blink::WebURLRequest::ExtraData) { |
20 public: | 21 public: |
21 RequestExtraData(blink::WebPageVisibilityState visibility_state, | 22 RequestExtraData(); |
22 const blink::WebString& custom_user_agent, | |
23 bool was_after_preconnect_request, | |
24 int render_frame_id, | |
25 bool is_main_frame, | |
26 const GURL& frame_origin, | |
27 bool parent_is_main_frame, | |
28 int parent_render_frame_id, | |
29 bool allow_download, | |
30 PageTransition transition_type, | |
31 bool should_replace_current_entry, | |
32 int transferred_request_child_id, | |
33 int transferred_request_request_id, | |
34 int service_worker_provider_id); | |
35 virtual ~RequestExtraData(); | 23 virtual ~RequestExtraData(); |
36 | 24 |
37 blink::WebPageVisibilityState visibility_state() const { | 25 blink::WebPageVisibilityState visibility_state() const { |
38 return visibility_state_; | 26 return visibility_state_; |
39 } | 27 } |
| 28 void set_visibility_state(blink::WebPageVisibilityState); |
40 int render_frame_id() const { return render_frame_id_; } | 29 int render_frame_id() const { return render_frame_id_; } |
| 30 void set_render_frame_id(int); |
41 bool is_main_frame() const { return is_main_frame_; } | 31 bool is_main_frame() const { return is_main_frame_; } |
| 32 void set_is_main_frame(bool); |
42 GURL frame_origin() const { return frame_origin_; } | 33 GURL frame_origin() const { return frame_origin_; } |
| 34 void set_frame_origin(const GURL&); |
43 bool parent_is_main_frame() const { return parent_is_main_frame_; } | 35 bool parent_is_main_frame() const { return parent_is_main_frame_; } |
| 36 void set_parent_is_main_frame(bool); |
44 int parent_render_frame_id() const { return parent_render_frame_id_; } | 37 int parent_render_frame_id() const { return parent_render_frame_id_; } |
| 38 void set_parent_render_frame_id(int); |
45 bool allow_download() const { return allow_download_; } | 39 bool allow_download() const { return allow_download_; } |
| 40 void set_allow_download(bool); |
46 PageTransition transition_type() const { return transition_type_; } | 41 PageTransition transition_type() const { return transition_type_; } |
| 42 void set_transition_type(PageTransition); |
47 bool should_replace_current_entry() const { | 43 bool should_replace_current_entry() const { |
48 return should_replace_current_entry_; | 44 return should_replace_current_entry_; |
49 } | 45 } |
| 46 void set_should_replace_current_entry(bool); |
50 int transferred_request_child_id() const { | 47 int transferred_request_child_id() const { |
51 return transferred_request_child_id_; | 48 return transferred_request_child_id_; |
52 } | 49 } |
| 50 void set_transferred_request_child_id(int); |
53 int transferred_request_request_id() const { | 51 int transferred_request_request_id() const { |
54 return transferred_request_request_id_; | 52 return transferred_request_request_id_; |
55 } | 53 } |
| 54 void set_transferred_request_request_id(int); |
56 int service_worker_provider_id() const { | 55 int service_worker_provider_id() const { |
57 return service_worker_provider_id_; | 56 return service_worker_provider_id_; |
58 } | 57 } |
| 58 void set_service_worker_provider_id(int); |
| 59 // |custom_user_agent| is used to communicate an overriding custom user agent |
| 60 // to |RenderViewImpl::willSendRequest()|; set to a null string to indicate no |
| 61 // override and an empty string to indicate that there should be no user |
| 62 // agent. |
| 63 const blink::WebString& custom_user_agent() const { |
| 64 return custom_user_agent_; |
| 65 } |
| 66 void set_custom_user_agent(const blink::WebString&); |
| 67 bool was_after_preconnect_request() { return was_after_preconnect_request_; } |
| 68 void set_was_after_preconnect_request(bool); |
59 | 69 |
60 private: | 70 private: |
61 blink::WebPageVisibilityState visibility_state_; | 71 blink::WebPageVisibilityState visibility_state_; |
62 int render_frame_id_; | 72 int render_frame_id_; |
63 bool is_main_frame_; | 73 bool is_main_frame_; |
64 GURL frame_origin_; | 74 GURL frame_origin_; |
65 bool parent_is_main_frame_; | 75 bool parent_is_main_frame_; |
66 int parent_render_frame_id_; | 76 int parent_render_frame_id_; |
67 bool allow_download_; | 77 bool allow_download_; |
68 PageTransition transition_type_; | 78 PageTransition transition_type_; |
69 bool should_replace_current_entry_; | 79 bool should_replace_current_entry_; |
70 int transferred_request_child_id_; | 80 int transferred_request_child_id_; |
71 int transferred_request_request_id_; | 81 int transferred_request_request_id_; |
72 int service_worker_provider_id_; | 82 int service_worker_provider_id_; |
| 83 blink::WebString custom_user_agent_; |
| 84 bool was_after_preconnect_request_; |
73 | 85 |
74 DISALLOW_COPY_AND_ASSIGN(RequestExtraData); | 86 DISALLOW_COPY_AND_ASSIGN(RequestExtraData); |
75 }; | 87 }; |
76 | 88 |
77 } // namespace content | 89 } // namespace content |
78 | 90 |
79 #endif // CONTENT_CHILD_REQUEST_EXTRA_DATA_H_ | 91 #endif // CONTENT_CHILD_REQUEST_EXTRA_DATA_H_ |
OLD | NEW |