| 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 // This file was forked off the Mac port. | 5 // This file was forked off the Mac port. |
| 6 | 6 |
| 7 #include "webkit/tools/test_shell/test_webview_delegate.h" | 7 #include "webkit/tools/test_shell/test_webview_delegate.h" |
| 8 | 8 |
| 9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
| 10 #include <gdk/gdkx.h> | 10 #include <gdk/gdkx.h> |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 &num_targets); | 245 &num_targets); |
| 246 gtk_clipboard_set_with_data(clipboard, targets, num_targets, | 246 gtk_clipboard_set_with_data(clipboard, targets, num_targets, |
| 247 SelectionClipboardGetContents, NULL, | 247 SelectionClipboardGetContents, NULL, |
| 248 shell_->webView()); | 248 shell_->webView()); |
| 249 gtk_target_list_unref(target_list); | 249 gtk_target_list_unref(target_list); |
| 250 gtk_target_table_free(targets, num_targets); | 250 gtk_target_table_free(targets, num_targets); |
| 251 } | 251 } |
| 252 | 252 |
| 253 // Private methods ------------------------------------------------------------ | 253 // Private methods ------------------------------------------------------------ |
| 254 | 254 |
| 255 void TestWebViewDelegate::ShowJavaScriptAlert(const std::wstring& message) { | 255 void TestWebViewDelegate::ShowJavaScriptAlert(const string16& message) { |
| 256 GtkWidget* dialog = gtk_message_dialog_new( | 256 GtkWidget* dialog = gtk_message_dialog_new( |
| 257 shell_->mainWnd(), GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, | 257 shell_->mainWnd(), GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, |
| 258 GTK_BUTTONS_OK, "%s", WideToUTF8(message).c_str()); | 258 GTK_BUTTONS_OK, "%s", UTF16ToUTF8(message).c_str()); |
| 259 gtk_window_set_title(GTK_WINDOW(dialog), "JavaScript Alert"); | 259 gtk_window_set_title(GTK_WINDOW(dialog), "JavaScript Alert"); |
| 260 gtk_dialog_run(GTK_DIALOG(dialog)); // Runs a nested message loop. | 260 gtk_dialog_run(GTK_DIALOG(dialog)); // Runs a nested message loop. |
| 261 gtk_widget_destroy(dialog); | 261 gtk_widget_destroy(dialog); |
| 262 } | 262 } |
| 263 | 263 |
| 264 void TestWebViewDelegate::SetPageTitle(const string16& title) { | 264 void TestWebViewDelegate::SetPageTitle(const string16& title) { |
| 265 gtk_window_set_title(GTK_WINDOW(shell_->mainWnd()), | 265 gtk_window_set_title(GTK_WINDOW(shell_->mainWnd()), |
| 266 ("Test Shell - " + UTF16ToUTF8(title)).c_str()); | 266 ("Test Shell - " + UTF16ToUTF8(title)).c_str()); |
| 267 } | 267 } |
| 268 | 268 |
| 269 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { | 269 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { |
| 270 gtk_entry_set_text(GTK_ENTRY(shell_->editWnd()), url.spec().c_str()); | 270 gtk_entry_set_text(GTK_ENTRY(shell_->editWnd()), url.spec().c_str()); |
| 271 } | 271 } |
| OLD | NEW |