Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: webkit/tools/test_shell/test_shell_gtk.cc

Issue 2983: gtk test shell (Closed)
Patch Set: rebase Created 12 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "webkit/tools/test_shell/test_shell.h"
6
7 #include <gtk/gtk.h>
8
9 #include "base/string_util.h"
10 #include "webkit/tools/test_shell/test_navigation_controller.h"
11
12 WindowList* TestShell::window_list_;
13
14 TestShell::TestShell() {
15 }
16
17 TestShell::~TestShell() {
18 }
19
20 // static
21 void TestShell::InitializeTestShell(bool interactive) {
22 window_list_ = new WindowList;
23 }
24
25 // static
26 bool TestShell::CreateNewWindow(const std::wstring& startingURL,
27 TestShell** result) {
28 TestShell *shell = new TestShell();
29 if (!shell->Initialize(startingURL))
30 return false;
31 if (result)
32 *result = shell;
33 TestShell::windowList()->push_back(shell->m_mainWnd);
34 return true;
35 }
36
37 bool TestShell::Initialize(const std::wstring& startingURL) {
38 m_mainWnd = gtk_window_new(GTK_WINDOW_TOPLEVEL);
39 gtk_window_set_title(GTK_WINDOW(m_mainWnd), "Test Shell");
40 gtk_window_set_default_size(GTK_WINDOW(m_mainWnd), 640, 480);
41
42 GtkWidget* vbox = gtk_vbox_new(FALSE, 0);
43
44 GtkWidget* toolbar = gtk_toolbar_new();
45 gtk_toolbar_insert(GTK_TOOLBAR(toolbar),
46 gtk_tool_button_new_from_stock(GTK_STOCK_GO_BACK),
47 -1 /* append */);
48 gtk_toolbar_insert(GTK_TOOLBAR(toolbar),
49 gtk_tool_button_new_from_stock(GTK_STOCK_GO_FORWARD),
50 -1 /* append */);
51 gtk_toolbar_insert(GTK_TOOLBAR(toolbar),
52 gtk_tool_button_new_from_stock(GTK_STOCK_REFRESH),
53 -1 /* append */);
54 gtk_toolbar_insert(GTK_TOOLBAR(toolbar),
55 gtk_tool_button_new_from_stock(GTK_STOCK_STOP),
56 -1 /* append */);
57
58 m_editWnd = gtk_entry_new();
59 gtk_entry_set_text(GTK_ENTRY(m_editWnd), WideToUTF8(startingURL).c_str());
60
61 GtkToolItem* tool_item = gtk_tool_item_new();
62 gtk_container_add(GTK_CONTAINER(tool_item), m_editWnd);
63 gtk_tool_item_set_expand(tool_item, TRUE);
64 gtk_toolbar_insert(GTK_TOOLBAR(toolbar),
65 tool_item,
66 -1 /* append */);
67
68 gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0);
69
70 gtk_container_add(GTK_CONTAINER(m_mainWnd), vbox);
71 gtk_widget_show_all(m_mainWnd);
72
73 return true;
74 }
75
76 void TestShell::BindJSObjectsToWindow(WebFrame* frame) {
77 NOTIMPLEMENTED();
78 }
79
80 bool TestShell::Navigate(const TestNavigationEntry& entry, bool reload) {
81 NOTIMPLEMENTED();
82 return true;
83 }
OLDNEW
« no previous file with comments | « webkit/tools/test_shell/test_navigation_controller.cc ('k') | webkit/tools/test_shell/test_shell_main_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698