| 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 "config.h" | 9 #include "config.h" |
| 10 | 10 |
| (...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 | 737 |
| 738 void TestWebViewDelegate::SetUserStyleSheetLocation(const GURL& location) { | 738 void TestWebViewDelegate::SetUserStyleSheetLocation(const GURL& location) { |
| 739 WebPreferences* prefs = shell_->GetWebPreferences(); | 739 WebPreferences* prefs = shell_->GetWebPreferences(); |
| 740 prefs->user_style_sheet_enabled = true; | 740 prefs->user_style_sheet_enabled = true; |
| 741 prefs->user_style_sheet_location = location; | 741 prefs->user_style_sheet_location = location; |
| 742 shell_->webView()->SetPreferences(*prefs); | 742 shell_->webView()->SetPreferences(*prefs); |
| 743 } | 743 } |
| 744 | 744 |
| 745 // WebWidgetDelegate --------------------------------------------------------- | 745 // WebWidgetDelegate --------------------------------------------------------- |
| 746 | 746 |
| 747 gfx::NativeViewId TestWebViewDelegate::GetContainingView(WebWidget* webwidget) { | |
| 748 // For test shell, we pack a NativeView pointer into the NativeViewId since | |
| 749 // everything is single process. | |
| 750 if (WebWidgetHost* host = GetHostForWidget(webwidget)) | |
| 751 return gfx::IdFromNativeView(host->view_handle()); | |
| 752 | |
| 753 return NULL; | |
| 754 } | |
| 755 | |
| 756 void TestWebViewDelegate::DidInvalidateRect(WebWidget* webwidget, | 747 void TestWebViewDelegate::DidInvalidateRect(WebWidget* webwidget, |
| 757 const WebRect& rect) { | 748 const WebRect& rect) { |
| 758 if (WebWidgetHost* host = GetHostForWidget(webwidget)) | 749 if (WebWidgetHost* host = GetHostForWidget(webwidget)) |
| 759 host->DidInvalidateRect(rect); | 750 host->DidInvalidateRect(rect); |
| 760 } | 751 } |
| 761 | 752 |
| 762 void TestWebViewDelegate::DidScrollRect(WebWidget* webwidget, int dx, int dy, | 753 void TestWebViewDelegate::DidScrollRect(WebWidget* webwidget, int dx, int dy, |
| 763 const WebRect& clip_rect) { | 754 const WebRect& clip_rect) { |
| 764 if (WebWidgetHost* host = GetHostForWidget(webwidget)) | 755 if (WebWidgetHost* host = GetHostForWidget(webwidget)) |
| 765 host->DidScrollRect(dx, dy, clip_rect); | 756 host->DidScrollRect(dx, dy, clip_rect); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 return L"main frame \"" + name + L"\""; | 922 return L"main frame \"" + name + L"\""; |
| 932 else | 923 else |
| 933 return L"main frame"; | 924 return L"main frame"; |
| 934 } else { | 925 } else { |
| 935 if (name.length()) | 926 if (name.length()) |
| 936 return L"frame \"" + name + L"\""; | 927 return L"frame \"" + name + L"\""; |
| 937 else | 928 else |
| 938 return L"frame (anonymous)"; | 929 return L"frame (anonymous)"; |
| 939 } | 930 } |
| 940 } | 931 } |
| OLD | NEW |