OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 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 | 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_shell.h" | 5 #include "webkit/tools/test_shell/test_shell.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "net/base/mime_util.h" | 12 #include "net/base/mime_util.h" |
13 #include "webkit/glue/webpreferences.h" | 13 #include "webkit/glue/webpreferences.h" |
14 #include "webkit/glue/plugins/plugin_list.h" | 14 #include "webkit/glue/plugins/plugin_list.h" |
15 #include "webkit/glue/resource_loader_bridge.h" | 15 #include "webkit/glue/resource_loader_bridge.h" |
16 #include "webkit/tools/test_shell/test_navigation_controller.h" | 16 #include "webkit/tools/test_shell/test_navigation_controller.h" |
17 | 17 |
18 WebPreferences* TestShell::web_prefs_ = NULL; | 18 WebPreferences* TestShell::web_prefs_ = NULL; |
19 | 19 |
20 WindowList* TestShell::window_list_; | 20 WindowList* TestShell::window_list_; |
21 | 21 |
22 TestShell::TestShell() { | 22 TestShell::TestShell() { |
| 23 // Uncomment this line to get a bunch of linker errors. This is what we need |
| 24 // to fix. |
| 25 m_webViewHost.reset(WebViewHost::Create(NULL, NULL, *TestShell::web_prefs_)); |
23 } | 26 } |
24 | 27 |
25 TestShell::~TestShell() { | 28 TestShell::~TestShell() { |
26 } | 29 } |
27 | 30 |
28 // static | 31 // static |
29 void TestShell::InitializeTestShell(bool interactive) { | 32 void TestShell::InitializeTestShell(bool interactive) { |
30 window_list_ = new WindowList; | 33 window_list_ = new WindowList; |
31 | 34 |
32 web_prefs_ = new WebPreferences; | 35 web_prefs_ = new WebPreferences; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 gtk_entry_set_text(GTK_ENTRY(m_editWnd), WideToUTF8(startingURL).c_str()); | 72 gtk_entry_set_text(GTK_ENTRY(m_editWnd), WideToUTF8(startingURL).c_str()); |
70 | 73 |
71 GtkToolItem* tool_item = gtk_tool_item_new(); | 74 GtkToolItem* tool_item = gtk_tool_item_new(); |
72 gtk_container_add(GTK_CONTAINER(tool_item), m_editWnd); | 75 gtk_container_add(GTK_CONTAINER(tool_item), m_editWnd); |
73 gtk_tool_item_set_expand(tool_item, TRUE); | 76 gtk_tool_item_set_expand(tool_item, TRUE); |
74 gtk_toolbar_insert(GTK_TOOLBAR(toolbar), | 77 gtk_toolbar_insert(GTK_TOOLBAR(toolbar), |
75 tool_item, | 78 tool_item, |
76 -1 /* append */); | 79 -1 /* append */); |
77 | 80 |
78 gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); | 81 gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); |
79 m_webViewHost.reset(WebViewHost::Create(vbox, NULL, *TestShell::web_prefs_)); | 82 |
| 83 // It's funny, ok? |
| 84 std::wstring path; |
| 85 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
| 86 file_util::AppendToPath(&path, L"webkit"); |
| 87 file_util::AppendToPath(&path, L"tools"); |
| 88 file_util::AppendToPath(&path, L"test_shell"); |
| 89 file_util::AppendToPath(&path, L"resources"); |
| 90 file_util::AppendToPath(&path, L"acid3.png"); |
| 91 GtkWidget* image = gtk_image_new_from_file(WideToUTF8(path).c_str()); |
| 92 gtk_box_pack_start(GTK_BOX(vbox), image, FALSE, FALSE, 0); |
80 | 93 |
81 gtk_container_add(GTK_CONTAINER(m_mainWnd), vbox); | 94 gtk_container_add(GTK_CONTAINER(m_mainWnd), vbox); |
82 gtk_widget_show_all(m_mainWnd); | 95 gtk_widget_show_all(m_mainWnd); |
83 | 96 |
84 return true; | 97 return true; |
85 } | 98 } |
86 | 99 |
87 void TestShell::BindJSObjectsToWindow(WebFrame* frame) { | 100 void TestShell::BindJSObjectsToWindow(WebFrame* frame) { |
88 NOTIMPLEMENTED(); | 101 NOTIMPLEMENTED(); |
89 } | 102 } |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 186 |
174 bool IsDefaultPluginEnabled() { | 187 bool IsDefaultPluginEnabled() { |
175 return false; | 188 return false; |
176 } | 189 } |
177 | 190 |
178 std::wstring GetWebKitLocale() { | 191 std::wstring GetWebKitLocale() { |
179 return L"en-US"; | 192 return L"en-US"; |
180 } | 193 } |
181 | 194 |
182 } // namespace webkit_glue | 195 } // namespace webkit_glue |
OLD | NEW |