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 visibility_state) { |
| 29 visibility_state_ = visibility_state; |
| 30 } |
40 int render_frame_id() const { return render_frame_id_; } | 31 int render_frame_id() const { return render_frame_id_; } |
| 32 void set_render_frame_id(int render_frame_id) { |
| 33 render_frame_id_ = render_frame_id; |
| 34 } |
41 bool is_main_frame() const { return is_main_frame_; } | 35 bool is_main_frame() const { return is_main_frame_; } |
| 36 void set_is_main_frame(bool is_main_frame) { |
| 37 is_main_frame_ = is_main_frame; |
| 38 } |
42 GURL frame_origin() const { return frame_origin_; } | 39 GURL frame_origin() const { return frame_origin_; } |
| 40 void set_frame_origin(const GURL& frame_origin) { |
| 41 frame_origin_ = frame_origin; |
| 42 } |
43 bool parent_is_main_frame() const { return parent_is_main_frame_; } | 43 bool parent_is_main_frame() const { return parent_is_main_frame_; } |
| 44 void set_parent_is_main_frame(bool parent_is_main_frame) { |
| 45 parent_is_main_frame_ = parent_is_main_frame; |
| 46 } |
44 int parent_render_frame_id() const { return parent_render_frame_id_; } | 47 int parent_render_frame_id() const { return parent_render_frame_id_; } |
| 48 void set_parent_render_frame_id(int parent_render_frame_id) { |
| 49 parent_render_frame_id_ = parent_render_frame_id; |
| 50 } |
45 bool allow_download() const { return allow_download_; } | 51 bool allow_download() const { return allow_download_; } |
| 52 void set_allow_download(bool allow_download) { |
| 53 allow_download_ = allow_download; |
| 54 } |
46 PageTransition transition_type() const { return transition_type_; } | 55 PageTransition transition_type() const { return transition_type_; } |
| 56 void set_transition_type(PageTransition transition_type) { |
| 57 transition_type_ = transition_type; |
| 58 } |
47 bool should_replace_current_entry() const { | 59 bool should_replace_current_entry() const { |
48 return should_replace_current_entry_; | 60 return should_replace_current_entry_; |
49 } | 61 } |
| 62 void set_should_replace_current_entry( |
| 63 bool should_replace_current_entry) { |
| 64 should_replace_current_entry_ = should_replace_current_entry; |
| 65 } |
50 int transferred_request_child_id() const { | 66 int transferred_request_child_id() const { |
51 return transferred_request_child_id_; | 67 return transferred_request_child_id_; |
52 } | 68 } |
| 69 void set_transferred_request_child_id( |
| 70 int transferred_request_child_id) { |
| 71 transferred_request_child_id_ = transferred_request_child_id; |
| 72 } |
53 int transferred_request_request_id() const { | 73 int transferred_request_request_id() const { |
54 return transferred_request_request_id_; | 74 return transferred_request_request_id_; |
55 } | 75 } |
| 76 void set_transferred_request_request_id( |
| 77 int transferred_request_request_id) { |
| 78 transferred_request_request_id_ = transferred_request_request_id; |
| 79 } |
56 int service_worker_provider_id() const { | 80 int service_worker_provider_id() const { |
57 return service_worker_provider_id_; | 81 return service_worker_provider_id_; |
58 } | 82 } |
| 83 void set_service_worker_provider_id( |
| 84 int service_worker_provider_id) { |
| 85 service_worker_provider_id_ = service_worker_provider_id; |
| 86 } |
| 87 // |custom_user_agent| is used to communicate an overriding custom user agent |
| 88 // to |RenderViewImpl::willSendRequest()|; set to a null string to indicate no |
| 89 // override and an empty string to indicate that there should be no user |
| 90 // agent. |
| 91 const blink::WebString& custom_user_agent() const { |
| 92 return custom_user_agent_; |
| 93 } |
| 94 void set_custom_user_agent( |
| 95 const blink::WebString& custom_user_agent) { |
| 96 custom_user_agent_ = custom_user_agent; |
| 97 } |
| 98 bool was_after_preconnect_request() { return was_after_preconnect_request_; } |
| 99 void set_was_after_preconnect_request( |
| 100 bool was_after_preconnect_request) { |
| 101 was_after_preconnect_request_ = was_after_preconnect_request; |
| 102 } |
59 | 103 |
60 private: | 104 private: |
61 blink::WebPageVisibilityState visibility_state_; | 105 blink::WebPageVisibilityState visibility_state_; |
62 int render_frame_id_; | 106 int render_frame_id_; |
63 bool is_main_frame_; | 107 bool is_main_frame_; |
64 GURL frame_origin_; | 108 GURL frame_origin_; |
65 bool parent_is_main_frame_; | 109 bool parent_is_main_frame_; |
66 int parent_render_frame_id_; | 110 int parent_render_frame_id_; |
67 bool allow_download_; | 111 bool allow_download_; |
68 PageTransition transition_type_; | 112 PageTransition transition_type_; |
69 bool should_replace_current_entry_; | 113 bool should_replace_current_entry_; |
70 int transferred_request_child_id_; | 114 int transferred_request_child_id_; |
71 int transferred_request_request_id_; | 115 int transferred_request_request_id_; |
72 int service_worker_provider_id_; | 116 int service_worker_provider_id_; |
| 117 blink::WebString custom_user_agent_; |
| 118 bool was_after_preconnect_request_; |
73 | 119 |
74 DISALLOW_COPY_AND_ASSIGN(RequestExtraData); | 120 DISALLOW_COPY_AND_ASSIGN(RequestExtraData); |
75 }; | 121 }; |
76 | 122 |
77 } // namespace content | 123 } // namespace content |
78 | 124 |
79 #endif // CONTENT_CHILD_REQUEST_EXTRA_DATA_H_ | 125 #endif // CONTENT_CHILD_REQUEST_EXTRA_DATA_H_ |
OLD | NEW |