Map WebSocket URL schemes to HTTP URL schemes for auth purposes.
[chromium-blink-merge.git] / content / child / request_extra_data.h
blob96582ec1193c90e5ba22634281c8712f480059ea
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_CHILD_REQUEST_EXTRA_DATA_H_
6 #define CONTENT_CHILD_REQUEST_EXTRA_DATA_H_
8 #include "base/compiler_specific.h"
9 #include "content/common/content_export.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"
13 #include "third_party/WebKit/public/web/WebPageVisibilityState.h"
15 namespace content {
17 // Can be used by callers to store extra data on every ResourceRequest
18 // which will be incorporated into the ResourceHostMsg_Request message
19 // sent by ResourceDispatcher.
20 class CONTENT_EXPORT RequestExtraData
21 : public NON_EXPORTED_BASE(blink::WebURLRequest::ExtraData) {
22 public:
23 RequestExtraData();
24 virtual ~RequestExtraData();
26 blink::WebPageVisibilityState visibility_state() const {
27 return visibility_state_;
29 void set_visibility_state(blink::WebPageVisibilityState visibility_state) {
30 visibility_state_ = visibility_state;
32 int render_frame_id() const { return render_frame_id_; }
33 void set_render_frame_id(int render_frame_id) {
34 render_frame_id_ = render_frame_id;
36 bool is_main_frame() const { return is_main_frame_; }
37 void set_is_main_frame(bool is_main_frame) {
38 is_main_frame_ = is_main_frame;
40 GURL frame_origin() const { return frame_origin_; }
41 void set_frame_origin(const GURL& frame_origin) {
42 frame_origin_ = frame_origin;
44 bool parent_is_main_frame() const { return parent_is_main_frame_; }
45 void set_parent_is_main_frame(bool parent_is_main_frame) {
46 parent_is_main_frame_ = parent_is_main_frame;
48 int parent_render_frame_id() const { return parent_render_frame_id_; }
49 void set_parent_render_frame_id(int parent_render_frame_id) {
50 parent_render_frame_id_ = parent_render_frame_id;
52 bool allow_download() const { return allow_download_; }
53 void set_allow_download(bool allow_download) {
54 allow_download_ = allow_download;
56 PageTransition transition_type() const { return transition_type_; }
57 void set_transition_type(PageTransition transition_type) {
58 transition_type_ = transition_type;
60 bool should_replace_current_entry() const {
61 return should_replace_current_entry_;
63 void set_should_replace_current_entry(
64 bool should_replace_current_entry) {
65 should_replace_current_entry_ = should_replace_current_entry;
67 int transferred_request_child_id() const {
68 return transferred_request_child_id_;
70 void set_transferred_request_child_id(
71 int transferred_request_child_id) {
72 transferred_request_child_id_ = transferred_request_child_id;
74 int transferred_request_request_id() const {
75 return transferred_request_request_id_;
77 void set_transferred_request_request_id(
78 int transferred_request_request_id) {
79 transferred_request_request_id_ = transferred_request_request_id;
81 int service_worker_provider_id() const {
82 return service_worker_provider_id_;
84 void set_service_worker_provider_id(
85 int service_worker_provider_id) {
86 service_worker_provider_id_ = service_worker_provider_id;
88 // |custom_user_agent| is used to communicate an overriding custom user agent
89 // to |RenderViewImpl::willSendRequest()|; set to a null string to indicate no
90 // override and an empty string to indicate that there should be no user
91 // agent.
92 const blink::WebString& custom_user_agent() const {
93 return custom_user_agent_;
95 void set_custom_user_agent(
96 const blink::WebString& custom_user_agent) {
97 custom_user_agent_ = custom_user_agent;
99 bool was_after_preconnect_request() { return was_after_preconnect_request_; }
100 void set_was_after_preconnect_request(
101 bool was_after_preconnect_request) {
102 was_after_preconnect_request_ = was_after_preconnect_request;
105 private:
106 blink::WebPageVisibilityState visibility_state_;
107 int render_frame_id_;
108 bool is_main_frame_;
109 GURL frame_origin_;
110 bool parent_is_main_frame_;
111 int parent_render_frame_id_;
112 bool allow_download_;
113 PageTransition transition_type_;
114 bool should_replace_current_entry_;
115 int transferred_request_child_id_;
116 int transferred_request_request_id_;
117 int service_worker_provider_id_;
118 blink::WebString custom_user_agent_;
119 bool was_after_preconnect_request_;
121 DISALLOW_COPY_AND_ASSIGN(RequestExtraData);
124 } // namespace content
126 #endif // CONTENT_CHILD_REQUEST_EXTRA_DATA_H_