OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/gfx/point.h" | 12 #include "base/gfx/point.h" |
| 13 #include "base/gfx/native_widget_types.h" |
13 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
14 #include "base/string_util.h" | 15 #include "base/string_util.h" |
15 #include "base/trace_event.h" | 16 #include "base/trace_event.h" |
16 #include "net/base/net_errors.h" | 17 #include "net/base/net_errors.h" |
17 #include "webkit/glue/webdatasource.h" | 18 #include "webkit/glue/webdatasource.h" |
18 #include "webkit/glue/webdropdata.h" | 19 #include "webkit/glue/webdropdata.h" |
19 #include "webkit/glue/weberror.h" | 20 #include "webkit/glue/weberror.h" |
20 #include "webkit/glue/webframe.h" | 21 #include "webkit/glue/webframe.h" |
21 #include "webkit/glue/webpreferences.h" | 22 #include "webkit/glue/webpreferences.h" |
22 #include "webkit/glue/weburlrequest.h" | 23 #include "webkit/glue/weburlrequest.h" |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 | 658 |
658 void TestWebViewDelegate::SetUserStyleSheetLocation(const GURL& location) { | 659 void TestWebViewDelegate::SetUserStyleSheetLocation(const GURL& location) { |
659 WebPreferences* prefs = shell_->GetWebPreferences(); | 660 WebPreferences* prefs = shell_->GetWebPreferences(); |
660 prefs->user_style_sheet_enabled = true; | 661 prefs->user_style_sheet_enabled = true; |
661 prefs->user_style_sheet_location = location; | 662 prefs->user_style_sheet_location = location; |
662 shell_->webView()->SetPreferences(*prefs); | 663 shell_->webView()->SetPreferences(*prefs); |
663 } | 664 } |
664 | 665 |
665 // WebWidgetDelegate --------------------------------------------------------- | 666 // WebWidgetDelegate --------------------------------------------------------- |
666 | 667 |
667 gfx::NativeView TestWebViewDelegate::GetContainingView(WebWidget* webwidget) { | 668 gfx::NativeViewId TestWebViewDelegate::GetContainingView(WebWidget* webwidget) { |
| 669 // For test shell, we pack a NativeView pointer into the NativeViewId since |
| 670 // everything is single process. |
668 if (WebWidgetHost* host = GetHostForWidget(webwidget)) | 671 if (WebWidgetHost* host = GetHostForWidget(webwidget)) |
669 return host->view_handle(); | 672 return gfx::IdFromNativeView(host->view_handle()); |
670 | 673 |
671 return NULL; | 674 return NULL; |
672 } | 675 } |
673 | 676 |
674 void TestWebViewDelegate::DidInvalidateRect(WebWidget* webwidget, | 677 void TestWebViewDelegate::DidInvalidateRect(WebWidget* webwidget, |
675 const gfx::Rect& rect) { | 678 const gfx::Rect& rect) { |
676 if (WebWidgetHost* host = GetHostForWidget(webwidget)) | 679 if (WebWidgetHost* host = GetHostForWidget(webwidget)) |
677 host->DidInvalidateRect(rect); | 680 host->DidInvalidateRect(rect); |
678 } | 681 } |
679 | 682 |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 else | 850 else |
848 return L"main frame"; | 851 return L"main frame"; |
849 } else { | 852 } else { |
850 if (name.length()) | 853 if (name.length()) |
851 return L"frame \"" + name + L"\""; | 854 return L"frame \"" + name + L"\""; |
852 else | 855 else |
853 return L"frame (anonymous)"; | 856 return L"frame (anonymous)"; |
854 } | 857 } |
855 } | 858 } |
856 | 859 |
OLD | NEW |