summaryrefslogtreecommitdiffstats
path: root/webkit/tools
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-15 00:19:45 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-15 00:19:45 +0000
commit1ad083f293cd321fa7d7c8f14e71816571c6c54f (patch)
treed824874e5512053793a131876bbb5570e1d401f5 /webkit/tools
parenta11bf80384c2b200d2d1d73979bdf6cb994881fe (diff)
downloadchromium_src-1ad083f293cd321fa7d7c8f14e71816571c6c54f.zip
chromium_src-1ad083f293cd321fa7d7c8f14e71816571c6c54f.tar.gz
chromium_src-1ad083f293cd321fa7d7c8f14e71816571c6c54f.tar.bz2
Link in WebView to the gtk test shell, and organize all the gtk files into their own dir.
Review URL: http://codereview.chromium.org/7334 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3386 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools')
-rw-r--r--webkit/tools/test_shell/SConscript7
-rw-r--r--webkit/tools/test_shell/gtk/test_shell.cc83
-rw-r--r--webkit/tools/test_shell/gtk/webview_host.cc31
-rw-r--r--webkit/tools/test_shell/gtk/webwidget_host.cc15
4 files changed, 133 insertions, 3 deletions
diff --git a/webkit/tools/test_shell/SConscript b/webkit/tools/test_shell/SConscript
index 86a5e07..81ac682 100644
--- a/webkit/tools/test_shell/SConscript
+++ b/webkit/tools/test_shell/SConscript
@@ -46,6 +46,7 @@ env.Append(
'v8',
'JavaScriptCore_pcre',
'port',
+ 'WebCore',
'WTF',
'V8Bindings',
'default_plugin',
@@ -59,7 +60,6 @@ if env['PLATFORM'] == 'win32':
LIBS = [
'activex_shim',
'breakpad_sender',
- 'WebCore',
]
)
@@ -113,8 +113,9 @@ if env['PLATFORM'] == 'win32':
])
elif env['PLATFORM'] == 'posix':
input_files.extend([
- 'test_shell_gtk.cc',
- 'webwidget_host_gtk.cc',
+ 'gtk/test_shell.cc',
+ 'gtk/webwidget_host.cc',
+ 'gtk/webview_host.cc'
])
lib = env.ChromeStaticLibrary('test_shell', input_files)
diff --git a/webkit/tools/test_shell/gtk/test_shell.cc b/webkit/tools/test_shell/gtk/test_shell.cc
new file mode 100644
index 0000000..c441635
--- /dev/null
+++ b/webkit/tools/test_shell/gtk/test_shell.cc
@@ -0,0 +1,83 @@
+// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "webkit/tools/test_shell/test_shell.h"
+
+#include <gtk/gtk.h>
+
+#include "base/string_util.h"
+#include "webkit/tools/test_shell/test_navigation_controller.h"
+
+WindowList* TestShell::window_list_;
+
+TestShell::TestShell() {
+}
+
+TestShell::~TestShell() {
+}
+
+// static
+void TestShell::InitializeTestShell(bool interactive) {
+ window_list_ = new WindowList;
+}
+
+// static
+bool TestShell::CreateNewWindow(const std::wstring& startingURL,
+ TestShell** result) {
+ TestShell *shell = new TestShell();
+ if (!shell->Initialize(startingURL))
+ return false;
+ if (result)
+ *result = shell;
+ TestShell::windowList()->push_back(shell->m_mainWnd);
+ return true;
+}
+
+bool TestShell::Initialize(const std::wstring& startingURL) {
+ m_mainWnd = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_title(GTK_WINDOW(m_mainWnd), "Test Shell");
+ gtk_window_set_default_size(GTK_WINDOW(m_mainWnd), 640, 480);
+
+ GtkWidget* vbox = gtk_vbox_new(FALSE, 0);
+
+ GtkWidget* toolbar = gtk_toolbar_new();
+ gtk_toolbar_insert(GTK_TOOLBAR(toolbar),
+ gtk_tool_button_new_from_stock(GTK_STOCK_GO_BACK),
+ -1 /* append */);
+ gtk_toolbar_insert(GTK_TOOLBAR(toolbar),
+ gtk_tool_button_new_from_stock(GTK_STOCK_GO_FORWARD),
+ -1 /* append */);
+ gtk_toolbar_insert(GTK_TOOLBAR(toolbar),
+ gtk_tool_button_new_from_stock(GTK_STOCK_REFRESH),
+ -1 /* append */);
+ gtk_toolbar_insert(GTK_TOOLBAR(toolbar),
+ gtk_tool_button_new_from_stock(GTK_STOCK_STOP),
+ -1 /* append */);
+
+ m_editWnd = gtk_entry_new();
+ gtk_entry_set_text(GTK_ENTRY(m_editWnd), WideToUTF8(startingURL).c_str());
+
+ GtkToolItem* tool_item = gtk_tool_item_new();
+ gtk_container_add(GTK_CONTAINER(tool_item), m_editWnd);
+ gtk_tool_item_set_expand(tool_item, TRUE);
+ gtk_toolbar_insert(GTK_TOOLBAR(toolbar),
+ tool_item,
+ -1 /* append */);
+
+ gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0);
+
+ gtk_container_add(GTK_CONTAINER(m_mainWnd), vbox);
+ gtk_widget_show_all(m_mainWnd);
+
+ return true;
+}
+
+void TestShell::BindJSObjectsToWindow(WebFrame* frame) {
+ NOTIMPLEMENTED();
+}
+
+bool TestShell::Navigate(const TestNavigationEntry& entry, bool reload) {
+ NOTIMPLEMENTED();
+ return true;
+}
diff --git a/webkit/tools/test_shell/gtk/webview_host.cc b/webkit/tools/test_shell/gtk/webview_host.cc
new file mode 100644
index 0000000..d84ea74
--- /dev/null
+++ b/webkit/tools/test_shell/gtk/webview_host.cc
@@ -0,0 +1,31 @@
+// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <gtk/gtk.h>
+
+#include "webkit/tools/test_shell/webview_host.h"
+
+#include "base/gfx/platform_canvas.h"
+#include "base/gfx/rect.h"
+#include "base/gfx/size.h"
+#include "webkit/glue/webinputevent.h"
+#include "webkit/glue/webview.h"
+
+/*static*/
+WebViewHost* WebViewHost::Create(GtkWidget* parent_window,
+ WebViewDelegate* delegate,
+ const WebPreferences& prefs) {
+ WebViewHost* host = new WebViewHost();
+
+ // TODO(erg):
+ // - Set "host->view_"
+ // - Call "host->webwidget_->Resize"
+ host->webwidget_ = WebView::Create(delegate, prefs);
+
+ return host;
+}
+
+WebView* WebViewHost::webview() const {
+ return static_cast<WebView*>(webwidget_);
+}
diff --git a/webkit/tools/test_shell/gtk/webwidget_host.cc b/webkit/tools/test_shell/gtk/webwidget_host.cc
new file mode 100644
index 0000000..3b21839
--- /dev/null
+++ b/webkit/tools/test_shell/gtk/webwidget_host.cc
@@ -0,0 +1,15 @@
+// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "webkit/tools/test_shell/webwidget_host.h"
+
+#include "base/logging.h"
+
+WebWidgetHost::WebWidgetHost() {
+ NOTIMPLEMENTED();
+}
+
+WebWidgetHost::~WebWidgetHost() {
+ NOTIMPLEMENTED();
+}