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