| 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> |
| 11 | 11 |
| 12 #include "base/bind.h" |
| 12 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
| 13 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 14 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
| 15 #include "content/common/page_transition_types.h" | 16 #include "content/common/page_transition_types.h" |
| 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCString.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCString.h" |
| 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" |
| 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" |
| 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
| 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 void TestWebViewDelegate::show(WebNavigationPolicy policy) { | 98 void TestWebViewDelegate::show(WebNavigationPolicy policy) { |
| 98 WebWidgetHost* host = GetWidgetHost(); | 99 WebWidgetHost* host = GetWidgetHost(); |
| 99 GtkWidget* drawing_area = host->view_handle(); | 100 GtkWidget* drawing_area = host->view_handle(); |
| 100 GtkWidget* window = | 101 GtkWidget* window = |
| 101 gtk_widget_get_parent(gtk_widget_get_parent(drawing_area)); | 102 gtk_widget_get_parent(gtk_widget_get_parent(drawing_area)); |
| 102 gtk_widget_show_all(window); | 103 gtk_widget_show_all(window); |
| 103 } | 104 } |
| 104 | 105 |
| 105 void TestWebViewDelegate::closeWidgetSoon() { | 106 void TestWebViewDelegate::closeWidgetSoon() { |
| 106 if (this == shell_->delegate()) { | 107 if (this == shell_->delegate()) { |
| 107 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableFunction( | 108 MessageLoop::current()->PostTask( |
| 108 >k_widget_destroy, GTK_WIDGET(shell_->mainWnd()))); | 109 FROM_HERE, |
| 110 base::Bind(>k_widget_destroy, GTK_WIDGET(shell_->mainWnd()))); |
| 109 } else if (this == shell_->popup_delegate()) { | 111 } else if (this == shell_->popup_delegate()) { |
| 110 shell_->ClosePopup(); | 112 shell_->ClosePopup(); |
| 111 } | 113 } |
| 112 } | 114 } |
| 113 | 115 |
| 114 void TestWebViewDelegate::didChangeCursor(const WebCursorInfo& cursor_info) { | 116 void TestWebViewDelegate::didChangeCursor(const WebCursorInfo& cursor_info) { |
| 115 current_cursor_.InitFromCursorInfo(cursor_info); | 117 current_cursor_.InitFromCursorInfo(cursor_info); |
| 116 GdkCursorType cursor_type = | 118 GdkCursorType cursor_type = |
| 117 static_cast<GdkCursorType>(current_cursor_.GetCursorType()); | 119 static_cast<GdkCursorType>(current_cursor_.GetCursorType()); |
| 118 GdkCursor* gdk_cursor; | 120 GdkCursor* gdk_cursor; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 } | 263 } |
| 262 | 264 |
| 263 void TestWebViewDelegate::SetPageTitle(const string16& title) { | 265 void TestWebViewDelegate::SetPageTitle(const string16& title) { |
| 264 gtk_window_set_title(GTK_WINDOW(shell_->mainWnd()), | 266 gtk_window_set_title(GTK_WINDOW(shell_->mainWnd()), |
| 265 ("Test Shell - " + UTF16ToUTF8(title)).c_str()); | 267 ("Test Shell - " + UTF16ToUTF8(title)).c_str()); |
| 266 } | 268 } |
| 267 | 269 |
| 268 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { | 270 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { |
| 269 gtk_entry_set_text(GTK_ENTRY(shell_->editWnd()), url.spec().c_str()); | 271 gtk_entry_set_text(GTK_ENTRY(shell_->editWnd()), url.spec().c_str()); |
| 270 } | 272 } |
| OLD | NEW |