| OLD | NEW |
| 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "webkit/tools/test_shell/test_webview_delegate.h" | 5 #include "webkit/tools/test_shell/test_webview_delegate.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "webkit/glue/webcursor.h" |
| 9 #include "webkit/glue/webview.h" | 10 #include "webkit/glue/webview.h" |
| 10 #include "webkit/tools/test_shell/test_shell.h" | 11 #include "webkit/tools/test_shell/test_shell.h" |
| 11 | 12 |
| 12 | 13 |
| 13 // WebViewDelegate ----------------------------------------------------------- | 14 // WebViewDelegate ----------------------------------------------------------- |
| 14 | 15 |
| 15 TestWebViewDelegate::~TestWebViewDelegate() { | 16 TestWebViewDelegate::~TestWebViewDelegate() { |
| 16 } | 17 } |
| 17 | 18 |
| 18 WebPluginDelegate* TestWebViewDelegate::CreatePluginDelegate( | 19 WebPluginDelegate* TestWebViewDelegate::CreatePluginDelegate( |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // to the event loop), so we should make sure we don't leave it dangling. | 55 // to the event loop), so we should make sure we don't leave it dangling. |
| 55 [win performClose:nil]; | 56 [win performClose:nil]; |
| 56 shell_ = NULL; | 57 shell_ = NULL; |
| 57 } else if (webwidget == shell_->popup()) { | 58 } else if (webwidget == shell_->popup()) { |
| 58 shell_->ClosePopup(); | 59 shell_->ClosePopup(); |
| 59 } | 60 } |
| 60 } | 61 } |
| 61 | 62 |
| 62 void TestWebViewDelegate::SetCursor(WebWidget* webwidget, | 63 void TestWebViewDelegate::SetCursor(WebWidget* webwidget, |
| 63 const WebCursor& cursor) { | 64 const WebCursor& cursor) { |
| 64 //TODO: Mac cursor handling | 65 NSCursor* ns_cursor = cursor.GetCursor(); |
| 66 [ns_cursor set]; |
| 65 } | 67 } |
| 66 | 68 |
| 67 void TestWebViewDelegate::GetWindowRect(WebWidget* webwidget, | 69 void TestWebViewDelegate::GetWindowRect(WebWidget* webwidget, |
| 68 gfx::Rect* out_rect) { | 70 gfx::Rect* out_rect) { |
| 69 DCHECK(out_rect); | 71 DCHECK(out_rect); |
| 70 if (WebWidgetHost* host = GetHostForWidget(webwidget)) { | 72 if (WebWidgetHost* host = GetHostForWidget(webwidget)) { |
| 71 NSView *view = host->window_handle(); | 73 NSView *view = host->window_handle(); |
| 72 NSRect rect = [view frame]; | 74 NSRect rect = [view frame]; |
| 73 *out_rect = gfx::Rect(NSRectToCGRect(rect)); | 75 *out_rect = gfx::Rect(NSRectToCGRect(rect)); |
| 74 } | 76 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 103 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { | 105 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { |
| 104 [[shell_->webViewHost()->window_handle() window] | 106 [[shell_->webViewHost()->window_handle() window] |
| 105 setTitle:[NSString stringWithUTF8String:WideToUTF8(title).c_str()]]; | 107 setTitle:[NSString stringWithUTF8String:WideToUTF8(title).c_str()]]; |
| 106 } | 108 } |
| 107 | 109 |
| 108 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { | 110 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { |
| 109 const char* frameURL = url.spec().c_str(); | 111 const char* frameURL = url.spec().c_str(); |
| 110 NSString *address = [NSString stringWithUTF8String:frameURL]; | 112 NSString *address = [NSString stringWithUTF8String:frameURL]; |
| 111 [shell_->editWnd() setStringValue:address]; | 113 [shell_->editWnd() setStringValue:address]; |
| 112 } | 114 } |
| OLD | NEW |