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 15 matching lines...) Expand all Loading... |
26 #include "third_party/WebKit/WebKit/chromium/public/WebDeviceOrientationClientMo
ck.h" | 26 #include "third_party/WebKit/WebKit/chromium/public/WebDeviceOrientationClientMo
ck.h" |
27 #include "third_party/WebKit/WebKit/chromium/public/WebCString.h" | 27 #include "third_party/WebKit/WebKit/chromium/public/WebCString.h" |
28 #include "third_party/WebKit/WebKit/chromium/public/WebData.h" | 28 #include "third_party/WebKit/WebKit/chromium/public/WebData.h" |
29 #include "third_party/WebKit/WebKit/chromium/public/WebDataSource.h" | 29 #include "third_party/WebKit/WebKit/chromium/public/WebDataSource.h" |
30 #include "third_party/WebKit/WebKit/chromium/public/WebDragData.h" | 30 #include "third_party/WebKit/WebKit/chromium/public/WebDragData.h" |
31 #include "third_party/WebKit/WebKit/chromium/public/WebHistoryItem.h" | 31 #include "third_party/WebKit/WebKit/chromium/public/WebHistoryItem.h" |
32 #include "third_party/WebKit/WebKit/chromium/public/WebImage.h" | 32 #include "third_party/WebKit/WebKit/chromium/public/WebImage.h" |
33 #include "third_party/WebKit/WebKit/chromium/public/WebFileError.h" | 33 #include "third_party/WebKit/WebKit/chromium/public/WebFileError.h" |
34 #include "third_party/WebKit/WebKit/chromium/public/WebFileSystemCallbacks.h" | 34 #include "third_party/WebKit/WebKit/chromium/public/WebFileSystemCallbacks.h" |
35 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" | 35 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" |
| 36 #if defined(ENABLE_CLIENT_BASED_GEOLOCATION) |
| 37 #include "third_party/WebKit/WebKit/chromium/public/WebGeolocationClientMock.h" |
| 38 #endif |
36 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" | 39 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" |
37 #include "third_party/WebKit/WebKit/chromium/public/WebKitClient.h" | 40 #include "third_party/WebKit/WebKit/chromium/public/WebKitClient.h" |
38 #include "third_party/WebKit/WebKit/chromium/public/WebNode.h" | 41 #include "third_party/WebKit/WebKit/chromium/public/WebNode.h" |
39 #include "third_party/WebKit/WebKit/chromium/public/WebNotificationPresenter.h" | 42 #include "third_party/WebKit/WebKit/chromium/public/WebNotificationPresenter.h" |
40 #include "third_party/WebKit/WebKit/chromium/public/WebPluginParams.h" | 43 #include "third_party/WebKit/WebKit/chromium/public/WebPluginParams.h" |
41 #include "third_party/WebKit/WebKit/chromium/public/WebPoint.h" | 44 #include "third_party/WebKit/WebKit/chromium/public/WebPoint.h" |
42 #include "third_party/WebKit/WebKit/chromium/public/WebPopupMenu.h" | 45 #include "third_party/WebKit/WebKit/chromium/public/WebPopupMenu.h" |
43 #include "third_party/WebKit/WebKit/chromium/public/WebRange.h" | 46 #include "third_party/WebKit/WebKit/chromium/public/WebRange.h" |
44 #include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" | 47 #include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" |
45 #include "third_party/WebKit/WebKit/chromium/public/WebSpeechInputController.h" | 48 #include "third_party/WebKit/WebKit/chromium/public/WebSpeechInputController.h" |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 | 650 |
648 void TestWebViewDelegate::focusAccessibilityObject( | 651 void TestWebViewDelegate::focusAccessibilityObject( |
649 const WebAccessibilityObject& object) { | 652 const WebAccessibilityObject& object) { |
650 shell_->accessibility_controller()->SetFocusedElement(object); | 653 shell_->accessibility_controller()->SetFocusedElement(object); |
651 } | 654 } |
652 | 655 |
653 WebNotificationPresenter* TestWebViewDelegate::notificationPresenter() { | 656 WebNotificationPresenter* TestWebViewDelegate::notificationPresenter() { |
654 return shell_->notification_presenter(); | 657 return shell_->notification_presenter(); |
655 } | 658 } |
656 | 659 |
| 660 #if defined(ENABLE_CLIENT_BASED_GEOLOCATION) |
| 661 WebKit::WebGeolocationClient* TestWebViewDelegate::geolocationClient() { |
| 662 return shell_->geolocation_client_mock(); |
| 663 } |
| 664 #else |
657 WebKit::WebGeolocationService* TestWebViewDelegate::geolocationService() { | 665 WebKit::WebGeolocationService* TestWebViewDelegate::geolocationService() { |
658 return GetTestGeolocationService(); | 666 return GetTestGeolocationService(); |
659 } | 667 } |
| 668 #endif |
660 | 669 |
661 WebKit::WebDeviceOrientationClient* | 670 WebKit::WebDeviceOrientationClient* |
662 TestWebViewDelegate::deviceOrientationClient() { | 671 TestWebViewDelegate::deviceOrientationClient() { |
663 return shell_->device_orientation_client_mock(); | 672 return shell_->device_orientation_client_mock(); |
664 } | 673 } |
665 | 674 |
666 WebKit::WebSpeechInputController* TestWebViewDelegate::speechInputController( | 675 WebKit::WebSpeechInputController* TestWebViewDelegate::speechInputController( |
667 WebKit::WebSpeechInputListener* listener) { | 676 WebKit::WebSpeechInputListener* listener) { |
668 return shell_->CreateSpeechInputControllerMock(listener); | 677 return shell_->CreateSpeechInputControllerMock(listener); |
669 } | 678 } |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1200 bool is_permissive) { | 1209 bool is_permissive) { |
1201 policy_delegate_enabled_ = is_custom; | 1210 policy_delegate_enabled_ = is_custom; |
1202 policy_delegate_is_permissive_ = is_permissive; | 1211 policy_delegate_is_permissive_ = is_permissive; |
1203 } | 1212 } |
1204 | 1213 |
1205 void TestWebViewDelegate::WaitForPolicyDelegate() { | 1214 void TestWebViewDelegate::WaitForPolicyDelegate() { |
1206 policy_delegate_enabled_ = true; | 1215 policy_delegate_enabled_ = true; |
1207 policy_delegate_should_notify_done_ = true; | 1216 policy_delegate_should_notify_done_ = true; |
1208 } | 1217 } |
1209 | 1218 |
| 1219 #if !defined(ENABLE_CLIENT_BASED_GEOLOCATION) |
1210 void TestWebViewDelegate::SetGeolocationPermission(bool allowed) { | 1220 void TestWebViewDelegate::SetGeolocationPermission(bool allowed) { |
1211 GetTestGeolocationService()->SetGeolocationPermission(allowed); | 1221 GetTestGeolocationService()->SetGeolocationPermission(allowed); |
1212 } | 1222 } |
| 1223 #endif |
1213 | 1224 |
1214 // Private methods ----------------------------------------------------------- | 1225 // Private methods ----------------------------------------------------------- |
1215 | 1226 |
1216 void TestWebViewDelegate::UpdateAddressBar(WebView* webView) { | 1227 void TestWebViewDelegate::UpdateAddressBar(WebView* webView) { |
1217 WebFrame* main_frame = webView->mainFrame(); | 1228 WebFrame* main_frame = webView->mainFrame(); |
1218 | 1229 |
1219 WebDataSource* data_source = main_frame->dataSource(); | 1230 WebDataSource* data_source = main_frame->dataSource(); |
1220 if (!data_source) | 1231 if (!data_source) |
1221 data_source = main_frame->provisionalDataSource(); | 1232 data_source = main_frame->provisionalDataSource(); |
1222 if (!data_source) | 1233 if (!data_source) |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1324 else | 1335 else |
1325 return L"main frame"; | 1336 return L"main frame"; |
1326 } else { | 1337 } else { |
1327 if (name.length()) | 1338 if (name.length()) |
1328 return L"frame \"" + name + L"\""; | 1339 return L"frame \"" + name + L"\""; |
1329 else | 1340 else |
1330 return L"frame (anonymous)"; | 1341 return L"frame (anonymous)"; |
1331 } | 1342 } |
1332 } | 1343 } |
1333 | 1344 |
| 1345 #if !defined(ENABLE_CLIENT_BASED_GEOLOCATION) |
1334 TestGeolocationService* TestWebViewDelegate::GetTestGeolocationService() { | 1346 TestGeolocationService* TestWebViewDelegate::GetTestGeolocationService() { |
1335 if (!test_geolocation_service_.get()) | 1347 if (!test_geolocation_service_.get()) |
1336 test_geolocation_service_.reset(new TestGeolocationService); | 1348 test_geolocation_service_.reset(new TestGeolocationService); |
1337 return test_geolocation_service_.get(); | 1349 return test_geolocation_service_.get(); |
1338 } | 1350 } |
| 1351 #endif |
1339 | 1352 |
1340 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { | 1353 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { |
1341 fake_rect_ = rect; | 1354 fake_rect_ = rect; |
1342 using_fake_rect_ = true; | 1355 using_fake_rect_ = true; |
1343 } | 1356 } |
1344 | 1357 |
1345 WebRect TestWebViewDelegate::fake_window_rect() { | 1358 WebRect TestWebViewDelegate::fake_window_rect() { |
1346 return fake_rect_; | 1359 return fake_rect_; |
1347 } | 1360 } |
OLD | NEW |