| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 } | 198 } |
| 199 | 199 |
| 200 // Public methods ------------------------------------------------------------- | 200 // Public methods ------------------------------------------------------------- |
| 201 | 201 |
| 202 void TestWebViewDelegate::UpdateSelectionClipboard(bool is_empty_selection) { | 202 void TestWebViewDelegate::UpdateSelectionClipboard(bool is_empty_selection) { |
| 203 // No selection clipboard on mac, do nothing. | 203 // No selection clipboard on mac, do nothing. |
| 204 } | 204 } |
| 205 | 205 |
| 206 // Private methods ------------------------------------------------------------ | 206 // Private methods ------------------------------------------------------------ |
| 207 | 207 |
| 208 void TestWebViewDelegate::ShowJavaScriptAlert(const std::wstring& message) { | 208 void TestWebViewDelegate::ShowJavaScriptAlert(const string16& message) { |
| 209 NSString *text = | 209 NSString *text = |
| 210 [NSString stringWithUTF8String:WideToUTF8(message).c_str()]; | 210 [NSString stringWithUTF8String:UTF16ToUTF8(message).c_str()]; |
| 211 NSAlert *alert = [NSAlert alertWithMessageText:@"JavaScript Alert" | 211 NSAlert *alert = [NSAlert alertWithMessageText:@"JavaScript Alert" |
| 212 defaultButton:@"OK" | 212 defaultButton:@"OK" |
| 213 alternateButton:nil | 213 alternateButton:nil |
| 214 otherButton:nil | 214 otherButton:nil |
| 215 informativeTextWithFormat:text]; | 215 informativeTextWithFormat:text]; |
| 216 [alert runModal]; | 216 [alert runModal]; |
| 217 } | 217 } |
| 218 | 218 |
| 219 void TestWebViewDelegate::SetPageTitle(const string16& title) { | 219 void TestWebViewDelegate::SetPageTitle(const string16& title) { |
| 220 [[shell_->webViewHost()->view_handle() window] | 220 [[shell_->webViewHost()->view_handle() window] |
| 221 setTitle:[NSString stringWithUTF8String:UTF16ToUTF8(title).c_str()]]; | 221 setTitle:[NSString stringWithUTF8String:UTF16ToUTF8(title).c_str()]]; |
| 222 } | 222 } |
| 223 | 223 |
| 224 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { | 224 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { |
| 225 const char* frameURL = url.spec().c_str(); | 225 const char* frameURL = url.spec().c_str(); |
| 226 NSString *address = [NSString stringWithUTF8String:frameURL]; | 226 NSString *address = [NSString stringWithUTF8String:frameURL]; |
| 227 [shell_->editWnd() setStringValue:address]; | 227 [shell_->editWnd() setStringValue:address]; |
| 228 } | 228 } |
| OLD | NEW |