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