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 WEBKIT_GLUE_WEBURLREQUEST_EXTRADATA_IMPL_H_ | 5 #ifndef WEBKIT_GLUE_WEBURLREQUEST_EXTRADATA_IMPL_H_ |
6 #define WEBKIT_GLUE_WEBURLREQUEST_EXTRADATA_IMPL_H_ | 6 #define WEBKIT_GLUE_WEBURLREQUEST_EXTRADATA_IMPL_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" | 9 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" |
10 #include "third_party/WebKit/public/platform/WebString.h" | 10 #include "third_party/WebKit/public/platform/WebString.h" |
11 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 11 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
12 #include "webkit/common/webkit_common_export.h" | 12 #include "webkit/common/webkit_common_export.h" |
13 | 13 |
14 namespace webkit_glue { | 14 namespace webkit_glue { |
15 | 15 |
16 // Base class for Chrome's implementation of the "extra data" stored in each | 16 // Base class for Chrome's implementation of the "extra data" stored in each |
17 // ResourceRequest. | 17 // ResourceRequest. |
18 class WEBKIT_COMMON_EXPORT WebURLRequestExtraDataImpl : | 18 class WEBKIT_COMMON_EXPORT WebURLRequestExtraDataImpl : |
19 public NON_EXPORTED_BASE(WebKit::WebURLRequest::ExtraData) { | 19 public NON_EXPORTED_BASE(WebKit::WebURLRequest::ExtraData) { |
20 public: | 20 public: |
21 static const int kType; | |
22 | |
21 // |custom_user_agent| is used to communicate an overriding custom user agent | 23 // |custom_user_agent| is used to communicate an overriding custom user agent |
22 // to |RenderViewImpl::willSendRequest()|; set to a null string to indicate no | 24 // to |RenderViewImpl::willSendRequest()|; set to a null string to indicate no |
23 // override and an empty string to indicate that there should be no user | 25 // override and an empty string to indicate that there should be no user |
24 // agent. This needs to be here, instead of content's |RequestExtraData| since | 26 // agent. This needs to be here, instead of content's |RequestExtraData| since |
25 // ppb_url_request_info_impl.cc needs to be able to set it. | 27 // ppb_url_request_info_impl.cc needs to be able to set it. |
26 explicit WebURLRequestExtraDataImpl( | 28 explicit WebURLRequestExtraDataImpl( |
27 WebKit::WebReferrerPolicy referrer_policy, | 29 WebKit::WebReferrerPolicy referrer_policy, |
28 const WebKit::WebString& custom_user_agent); | 30 const WebKit::WebString& custom_user_agent); |
29 virtual ~WebURLRequestExtraDataImpl(); | 31 virtual ~WebURLRequestExtraDataImpl(); |
30 | 32 |
31 WebKit::WebReferrerPolicy referrer_policy() const { return referrer_policy_; } | 33 WebKit::WebReferrerPolicy referrer_policy() const { return referrer_policy_; } |
32 const WebKit::WebString& custom_user_agent() const { | 34 const WebKit::WebString& custom_user_agent() const { |
33 return custom_user_agent_; | 35 return custom_user_agent_; |
34 } | 36 } |
37 int type_id() const { return type_id_; } | |
jam
2013/07/11 16:23:52
hmm, seems best to avoid this hand rolled RTTI
| |
38 | |
39 protected: | |
40 void set_type_id(int id) { type_id_ = id; } | |
35 | 41 |
36 private: | 42 private: |
37 WebKit::WebReferrerPolicy referrer_policy_; | 43 WebKit::WebReferrerPolicy referrer_policy_; |
38 WebKit::WebString custom_user_agent_; | 44 WebKit::WebString custom_user_agent_; |
39 | 45 |
46 // This is used to identify subclass of WebURLRequestExtraDataImpl. | |
47 int type_id_; | |
48 | |
40 DISALLOW_COPY_AND_ASSIGN(WebURLRequestExtraDataImpl); | 49 DISALLOW_COPY_AND_ASSIGN(WebURLRequestExtraDataImpl); |
41 }; | 50 }; |
42 | 51 |
43 } // namespace webkit_glue | 52 } // namespace webkit_glue |
44 | 53 |
45 #endif // WEBKIT_GLUE_WEBURLREQUEST_EXTRADATA_IMPL_H_ | 54 #endif // WEBKIT_GLUE_WEBURLREQUEST_EXTRADATA_IMPL_H_ |
OLD | NEW |