OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This file contains the implementation of TestWebViewDelegate, which serves | 5 // This file contains the implementation of TestWebViewDelegate, which serves |
6 // as the WebViewDelegate for the TestShellWebHost. The host is expected to | 6 // as the WebViewDelegate for the TestShellWebHost. The host is expected to |
7 // have initialized a MessageLoop before these methods are called. | 7 // have initialized a MessageLoop before these methods are called. |
8 | 8 |
9 #include "webkit/tools/test_shell/test_webview_delegate.h" | 9 #include "webkit/tools/test_shell/test_webview_delegate.h" |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" | 56 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" |
57 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 57 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
58 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWindowFeatures.h" | 58 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWindowFeatures.h" |
59 #include "ui/gfx/native_widget_types.h" | 59 #include "ui/gfx/native_widget_types.h" |
60 #include "ui/gfx/point.h" | 60 #include "ui/gfx/point.h" |
61 #include "webkit/appcache/web_application_cache_host_impl.h" | 61 #include "webkit/appcache/web_application_cache_host_impl.h" |
62 #include "webkit/glue/glue_serialize.h" | 62 #include "webkit/glue/glue_serialize.h" |
63 #include "webkit/glue/webdropdata.h" | 63 #include "webkit/glue/webdropdata.h" |
64 #include "webkit/glue/webkit_glue.h" | 64 #include "webkit/glue/webkit_glue.h" |
65 #include "webkit/glue/webpreferences.h" | 65 #include "webkit/glue/webpreferences.h" |
| 66 #include "webkit/glue/weburlrequest_extradata_impl.h" |
66 #include "webkit/glue/window_open_disposition.h" | 67 #include "webkit/glue/window_open_disposition.h" |
67 #include "webkit/media/video_renderer_impl.h" | 68 #include "webkit/media/video_renderer_impl.h" |
68 #include "webkit/media/webmediaplayer_impl.h" | 69 #include "webkit/media/webmediaplayer_impl.h" |
69 #include "webkit/plugins/npapi/webplugin_impl.h" | 70 #include "webkit/plugins/npapi/webplugin_impl.h" |
70 #include "webkit/plugins/npapi/plugin_list.h" | 71 #include "webkit/plugins/npapi/plugin_list.h" |
71 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" | 72 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" |
72 #include "webkit/tools/test_shell/mock_spellcheck.h" | 73 #include "webkit/tools/test_shell/mock_spellcheck.h" |
73 #include "webkit/tools/test_shell/notification_presenter.h" | 74 #include "webkit/tools/test_shell/notification_presenter.h" |
74 #include "webkit/tools/test_shell/simple_appcache_system.h" | 75 #include "webkit/tools/test_shell/simple_appcache_system.h" |
75 #include "webkit/tools/test_shell/simple_file_system.h" | 76 #include "webkit/tools/test_shell/simple_file_system.h" |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
868 void TestWebViewDelegate::assignIdentifierToRequest( | 869 void TestWebViewDelegate::assignIdentifierToRequest( |
869 WebFrame* frame, unsigned identifier, const WebURLRequest& request) { | 870 WebFrame* frame, unsigned identifier, const WebURLRequest& request) { |
870 } | 871 } |
871 | 872 |
872 void TestWebViewDelegate::willSendRequest( | 873 void TestWebViewDelegate::willSendRequest( |
873 WebFrame* frame, unsigned identifier, WebURLRequest& request, | 874 WebFrame* frame, unsigned identifier, WebURLRequest& request, |
874 const WebURLResponse& redirect_response) { | 875 const WebURLResponse& redirect_response) { |
875 GURL url = request.url(); | 876 GURL url = request.url(); |
876 std::string request_url = url.possibly_invalid_spec(); | 877 std::string request_url = url.possibly_invalid_spec(); |
877 | 878 |
| 879 request.setExtraData( |
| 880 new webkit_glue::WebURLRequestExtraDataImpl(frame->referrerPolicy())); |
| 881 |
878 if (!redirect_response.isNull() && block_redirects_) { | 882 if (!redirect_response.isNull() && block_redirects_) { |
879 printf("Returning null for this redirect\n"); | 883 printf("Returning null for this redirect\n"); |
880 | 884 |
881 // To block the request, we set its URL to an empty one. | 885 // To block the request, we set its URL to an empty one. |
882 request.setURL(WebURL()); | 886 request.setURL(WebURL()); |
883 return; | 887 return; |
884 } | 888 } |
885 | 889 |
886 if (request_return_null_) { | 890 if (request_return_null_) { |
887 // To block the request, we set its URL to an empty one. | 891 // To block the request, we set its URL to an empty one. |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1151 } | 1155 } |
1152 | 1156 |
1153 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { | 1157 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { |
1154 fake_rect_ = rect; | 1158 fake_rect_ = rect; |
1155 using_fake_rect_ = true; | 1159 using_fake_rect_ = true; |
1156 } | 1160 } |
1157 | 1161 |
1158 WebRect TestWebViewDelegate::fake_window_rect() { | 1162 WebRect TestWebViewDelegate::fake_window_rect() { |
1159 return fake_rect_; | 1163 return fake_rect_; |
1160 } | 1164 } |
OLD | NEW |