| 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 // 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 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 error.reason = net::ERR_ABORTED; | 725 error.reason = net::ERR_ABORTED; |
| 726 error.unreachableURL = request.url(); | 726 error.unreachableURL = request.url(); |
| 727 return error; | 727 return error; |
| 728 } | 728 } |
| 729 | 729 |
| 730 void TestWebViewDelegate::unableToImplementPolicyWithError( | 730 void TestWebViewDelegate::unableToImplementPolicyWithError( |
| 731 WebFrame* frame, const WebURLError& error) { | 731 WebFrame* frame, const WebURLError& error) { |
| 732 std::string domain = error.domain.utf8(); | 732 std::string domain = error.domain.utf8(); |
| 733 printf("Policy delegate: unable to implement policy with error domain '%s', " | 733 printf("Policy delegate: unable to implement policy with error domain '%s', " |
| 734 "error code %d, in frame '%s'\n", | 734 "error code %d, in frame '%s'\n", |
| 735 domain.data(), error.reason, frame->name().utf8().data()); | 735 domain.data(), error.reason, frame->uniqueName().utf8().data()); |
| 736 } | 736 } |
| 737 | 737 |
| 738 void TestWebViewDelegate::willPerformClientRedirect( | 738 void TestWebViewDelegate::willPerformClientRedirect( |
| 739 WebFrame* frame, const WebURL& from, const WebURL& to, | 739 WebFrame* frame, const WebURL& from, const WebURL& to, |
| 740 double interval, double fire_time) { | 740 double interval, double fire_time) { |
| 741 } | 741 } |
| 742 | 742 |
| 743 void TestWebViewDelegate::didCancelClientRedirect(WebFrame* frame) { | 743 void TestWebViewDelegate::didCancelClientRedirect(WebFrame* frame) { |
| 744 } | 744 } |
| 745 | 745 |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1110 | 1110 |
| 1111 const WebHistoryItem& history_item = | 1111 const WebHistoryItem& history_item = |
| 1112 shell_->webView()->mainFrame()->previousHistoryItem(); | 1112 shell_->webView()->mainFrame()->previousHistoryItem(); |
| 1113 if (history_item.isNull()) | 1113 if (history_item.isNull()) |
| 1114 return; | 1114 return; |
| 1115 | 1115 |
| 1116 entry->SetContentState(webkit_glue::HistoryItemToString(history_item)); | 1116 entry->SetContentState(webkit_glue::HistoryItemToString(history_item)); |
| 1117 } | 1117 } |
| 1118 | 1118 |
| 1119 string16 TestWebViewDelegate::GetFrameDescription(WebFrame* webframe) { | 1119 string16 TestWebViewDelegate::GetFrameDescription(WebFrame* webframe) { |
| 1120 std::string name = UTF16ToUTF8(webframe->name()); | 1120 std::string name = UTF16ToUTF8(webframe->uniqueName()); |
| 1121 | 1121 |
| 1122 if (webframe == shell_->webView()->mainFrame()) { | 1122 if (webframe == shell_->webView()->mainFrame()) { |
| 1123 if (name.length()) | 1123 if (name.length()) |
| 1124 name = "main frame \"" + name + "\""; | 1124 name = "main frame \"" + name + "\""; |
| 1125 else | 1125 else |
| 1126 name = "main frame"; | 1126 name = "main frame"; |
| 1127 } else { | 1127 } else { |
| 1128 if (name.length()) | 1128 if (name.length()) |
| 1129 name = "frame \"" + name + "\""; | 1129 name = "frame \"" + name + "\""; |
| 1130 else | 1130 else |
| 1131 name = "frame (anonymous)"; | 1131 name = "frame (anonymous)"; |
| 1132 } | 1132 } |
| 1133 return UTF8ToUTF16(name); | 1133 return UTF8ToUTF16(name); |
| 1134 } | 1134 } |
| 1135 | 1135 |
| 1136 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { | 1136 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { |
| 1137 fake_rect_ = rect; | 1137 fake_rect_ = rect; |
| 1138 using_fake_rect_ = true; | 1138 using_fake_rect_ = true; |
| 1139 } | 1139 } |
| 1140 | 1140 |
| 1141 WebRect TestWebViewDelegate::fake_window_rect() { | 1141 WebRect TestWebViewDelegate::fake_window_rect() { |
| 1142 return fake_rect_; | 1142 return fake_rect_; |
| 1143 } | 1143 } |
| OLD | NEW |