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 { | |
joth
2010/12/07 10:24:51
{ on prev line
John Knottenbelt
2010/12/07 12:30:04
Done.
| |
663 return shell_->geolocation_client_mock(); | |
664 } | |
665 #else | |
657 WebKit::WebGeolocationService* TestWebViewDelegate::geolocationService() { | 666 WebKit::WebGeolocationService* TestWebViewDelegate::geolocationService() { |
658 return GetTestGeolocationService(); | 667 return GetTestGeolocationService(); |
659 } | 668 } |
669 #endif | |
660 | 670 |
661 WebKit::WebDeviceOrientationClient* | 671 WebKit::WebDeviceOrientationClient* |
662 TestWebViewDelegate::deviceOrientationClient() { | 672 TestWebViewDelegate::deviceOrientationClient() { |
663 return shell_->device_orientation_client_mock(); | 673 return shell_->device_orientation_client_mock(); |
664 } | 674 } |
665 | 675 |
666 WebKit::WebSpeechInputController* TestWebViewDelegate::speechInputController( | 676 WebKit::WebSpeechInputController* TestWebViewDelegate::speechInputController( |
667 WebKit::WebSpeechInputListener* listener) { | 677 WebKit::WebSpeechInputListener* listener) { |
668 return shell_->CreateSpeechInputControllerMock(listener); | 678 return shell_->CreateSpeechInputControllerMock(listener); |
669 } | 679 } |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1221 bool is_permissive) { | 1231 bool is_permissive) { |
1222 policy_delegate_enabled_ = is_custom; | 1232 policy_delegate_enabled_ = is_custom; |
1223 policy_delegate_is_permissive_ = is_permissive; | 1233 policy_delegate_is_permissive_ = is_permissive; |
1224 } | 1234 } |
1225 | 1235 |
1226 void TestWebViewDelegate::WaitForPolicyDelegate() { | 1236 void TestWebViewDelegate::WaitForPolicyDelegate() { |
1227 policy_delegate_enabled_ = true; | 1237 policy_delegate_enabled_ = true; |
1228 policy_delegate_should_notify_done_ = true; | 1238 policy_delegate_should_notify_done_ = true; |
1229 } | 1239 } |
1230 | 1240 |
1241 #if !defined(ENABLE_CLIENT_BASED_GEOLOCATION) | |
1231 void TestWebViewDelegate::SetGeolocationPermission(bool allowed) { | 1242 void TestWebViewDelegate::SetGeolocationPermission(bool allowed) { |
1232 GetTestGeolocationService()->SetGeolocationPermission(allowed); | 1243 GetTestGeolocationService()->SetGeolocationPermission(allowed); |
1233 } | 1244 } |
1245 #endif | |
1234 | 1246 |
1235 // Private methods ----------------------------------------------------------- | 1247 // Private methods ----------------------------------------------------------- |
1236 | 1248 |
1237 void TestWebViewDelegate::UpdateAddressBar(WebView* webView) { | 1249 void TestWebViewDelegate::UpdateAddressBar(WebView* webView) { |
1238 WebFrame* main_frame = webView->mainFrame(); | 1250 WebFrame* main_frame = webView->mainFrame(); |
1239 | 1251 |
1240 WebDataSource* data_source = main_frame->dataSource(); | 1252 WebDataSource* data_source = main_frame->dataSource(); |
1241 if (!data_source) | 1253 if (!data_source) |
1242 data_source = main_frame->provisionalDataSource(); | 1254 data_source = main_frame->provisionalDataSource(); |
1243 if (!data_source) | 1255 if (!data_source) |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1345 else | 1357 else |
1346 return L"main frame"; | 1358 return L"main frame"; |
1347 } else { | 1359 } else { |
1348 if (name.length()) | 1360 if (name.length()) |
1349 return L"frame \"" + name + L"\""; | 1361 return L"frame \"" + name + L"\""; |
1350 else | 1362 else |
1351 return L"frame (anonymous)"; | 1363 return L"frame (anonymous)"; |
1352 } | 1364 } |
1353 } | 1365 } |
1354 | 1366 |
1367 #if !defined(ENABLE_CLIENT_BASED_GEOLOCATION) | |
1355 TestGeolocationService* TestWebViewDelegate::GetTestGeolocationService() { | 1368 TestGeolocationService* TestWebViewDelegate::GetTestGeolocationService() { |
1356 if (!test_geolocation_service_.get()) | 1369 if (!test_geolocation_service_.get()) |
1357 test_geolocation_service_.reset(new TestGeolocationService); | 1370 test_geolocation_service_.reset(new TestGeolocationService); |
1358 return test_geolocation_service_.get(); | 1371 return test_geolocation_service_.get(); |
1359 } | 1372 } |
1373 #endif | |
1360 | 1374 |
1361 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { | 1375 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { |
1362 fake_rect_ = rect; | 1376 fake_rect_ = rect; |
1363 using_fake_rect_ = true; | 1377 using_fake_rect_ = true; |
1364 } | 1378 } |
1365 | 1379 |
1366 WebRect TestWebViewDelegate::fake_window_rect() { | 1380 WebRect TestWebViewDelegate::fake_window_rect() { |
1367 return fake_rect_; | 1381 return fake_rect_; |
1368 } | 1382 } |
OLD | NEW |