Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1044 request.setURL(GURL(TestShell::RewriteLocalUrl(request_url))); | 1044 request.setURL(GURL(TestShell::RewriteLocalUrl(request_url))); |
| 1045 } | 1045 } |
| 1046 | 1046 |
| 1047 void TestWebViewDelegate::didReceiveResponse( | 1047 void TestWebViewDelegate::didReceiveResponse( |
| 1048 WebFrame* frame, unsigned identifier, const WebURLResponse& response) { | 1048 WebFrame* frame, unsigned identifier, const WebURLResponse& response) { |
| 1049 if (shell_->ShouldDumpResourceLoadCallbacks()) { | 1049 if (shell_->ShouldDumpResourceLoadCallbacks()) { |
| 1050 printf("%s - didReceiveResponse %s\n", | 1050 printf("%s - didReceiveResponse %s\n", |
| 1051 GetResourceDescription(identifier).c_str(), | 1051 GetResourceDescription(identifier).c_str(), |
| 1052 GetResponseDescription(response).c_str()); | 1052 GetResponseDescription(response).c_str()); |
| 1053 } | 1053 } |
| 1054 if (shell_->ShouldDumpResourceResponseMIMETypes()) { | |
| 1055 GURL url = response.url(); | |
| 1056 WebString mimeType = response.mimeType(); | |
| 1057 printf("%s has MIME type %s\n", | |
| 1058 url.ExtractFileName().c_str(), | |
| 1059 // Simulate NSURLResponse's mapping of empty/unknown MIME types to | |
| 1060 // application/octet-stream. | |
| 1061 mimeType.isEmpty() ? | |
| 1062 "application/octet-stream" : mimeType.utf8().data()); | |
|
tony
2010/09/09 18:36:29
Is mimeType.utf8().data() null terminated (looking
| |
| 1063 } | |
| 1054 } | 1064 } |
| 1055 | 1065 |
| 1056 void TestWebViewDelegate::didFinishResourceLoad( | 1066 void TestWebViewDelegate::didFinishResourceLoad( |
| 1057 WebFrame* frame, unsigned identifier) { | 1067 WebFrame* frame, unsigned identifier) { |
| 1058 TRACE_EVENT_END("url.load", identifier, ""); | 1068 TRACE_EVENT_END("url.load", identifier, ""); |
| 1059 if (shell_->ShouldDumpResourceLoadCallbacks()) { | 1069 if (shell_->ShouldDumpResourceLoadCallbacks()) { |
| 1060 printf("%s - didFinishLoading\n", | 1070 printf("%s - didFinishLoading\n", |
| 1061 GetResourceDescription(identifier).c_str()); | 1071 GetResourceDescription(identifier).c_str()); |
| 1062 } | 1072 } |
| 1063 resource_identifier_map_.erase(identifier); | 1073 resource_identifier_map_.erase(identifier); |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1300 } | 1310 } |
| 1301 | 1311 |
| 1302 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { | 1312 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { |
| 1303 fake_rect_ = rect; | 1313 fake_rect_ = rect; |
| 1304 using_fake_rect_ = true; | 1314 using_fake_rect_ = true; |
| 1305 } | 1315 } |
| 1306 | 1316 |
| 1307 WebRect TestWebViewDelegate::fake_window_rect() { | 1317 WebRect TestWebViewDelegate::fake_window_rect() { |
| 1308 return fake_rect_; | 1318 return fake_rect_; |
| 1309 } | 1319 } |
| OLD | NEW |