| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 size_t pos = url.rfind('/'); | 151 size_t pos = url.rfind('/'); |
| 152 if (pos == std::string::npos || pos == 0) | 152 if (pos == std::string::npos || pos == 0) |
| 153 return "ERROR:" + url; | 153 return "ERROR:" + url; |
| 154 pos = url.rfind('/', pos - 1); | 154 pos = url.rfind('/', pos - 1); |
| 155 if (pos == std::string::npos) | 155 if (pos == std::string::npos) |
| 156 return "ERROR:" + url; | 156 return "ERROR:" + url; |
| 157 | 157 |
| 158 return url.substr(pos + 1); | 158 return url.substr(pos + 1); |
| 159 } | 159 } |
| 160 | 160 |
| 161 // Adds a file called "DRTFakeFile" to |data_object| (CF_HDROP). Use to fake | 161 // Adds a file called "DRTFakeFile" to |data_object|. Use to fake dragging a |
| 162 // dragging a file. | 162 // file. |
| 163 void AddDRTFakeFileToDataObject(WebDragData* drag_data) { | 163 void AddDRTFakeFileToDataObject(WebDragData* drag_data) { |
| 164 drag_data->appendToFilenames(WebString::fromUTF8("DRTFakeFile")); | 164 WebDragData::Item item; |
| 165 item.storageType = WebDragData::Item::StorageTypeFilename; |
| 166 item.filenameData = WebString::fromUTF8("DRTFakeFile"); |
| 167 drag_data->addItem(item); |
| 165 } | 168 } |
| 166 | 169 |
| 167 // Get a debugging string from a WebNavigationType. | 170 // Get a debugging string from a WebNavigationType. |
| 168 const char* WebNavigationTypeToString(WebNavigationType type) { | 171 const char* WebNavigationTypeToString(WebNavigationType type) { |
| 169 switch (type) { | 172 switch (type) { |
| 170 case WebKit::WebNavigationTypeLinkClicked: | 173 case WebKit::WebNavigationTypeLinkClicked: |
| 171 return kLinkClickedString; | 174 return kLinkClickedString; |
| 172 case WebKit::WebNavigationTypeFormSubmitted: | 175 case WebKit::WebNavigationTypeFormSubmitted: |
| 173 return kFormSubmittedString; | 176 return kFormSubmittedString; |
| 174 case WebKit::WebNavigationTypeBackForward: | 177 case WebKit::WebNavigationTypeBackForward: |
| (...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1144 } | 1147 } |
| 1145 | 1148 |
| 1146 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { | 1149 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { |
| 1147 fake_rect_ = rect; | 1150 fake_rect_ = rect; |
| 1148 using_fake_rect_ = true; | 1151 using_fake_rect_ = true; |
| 1149 } | 1152 } |
| 1150 | 1153 |
| 1151 WebRect TestWebViewDelegate::fake_window_rect() { | 1154 WebRect TestWebViewDelegate::fake_window_rect() { |
| 1152 return fake_rect_; | 1155 return fake_rect_; |
| 1153 } | 1156 } |
| OLD | NEW |