| 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_)); | |
| 26 } | 23 } |
| 27 | 24 |
| 28 TestShell::~TestShell() { | 25 TestShell::~TestShell() { |
| 29 } | 26 } |
| 30 | 27 |
| 31 // static | 28 // static |
| 32 void TestShell::InitializeTestShell(bool interactive) { | 29 void TestShell::InitializeTestShell(bool interactive) { |
| 33 window_list_ = new WindowList; | 30 window_list_ = new WindowList; |
| 34 | 31 |
| 35 web_prefs_ = new WebPreferences; | 32 web_prefs_ = new WebPreferences; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 gtk_entry_set_text(GTK_ENTRY(m_editWnd), WideToUTF8(startingURL).c_str()); | 69 gtk_entry_set_text(GTK_ENTRY(m_editWnd), WideToUTF8(startingURL).c_str()); |
| 73 | 70 |
| 74 GtkToolItem* tool_item = gtk_tool_item_new(); | 71 GtkToolItem* tool_item = gtk_tool_item_new(); |
| 75 gtk_container_add(GTK_CONTAINER(tool_item), m_editWnd); | 72 gtk_container_add(GTK_CONTAINER(tool_item), m_editWnd); |
| 76 gtk_tool_item_set_expand(tool_item, TRUE); | 73 gtk_tool_item_set_expand(tool_item, TRUE); |
| 77 gtk_toolbar_insert(GTK_TOOLBAR(toolbar), | 74 gtk_toolbar_insert(GTK_TOOLBAR(toolbar), |
| 78 tool_item, | 75 tool_item, |
| 79 -1 /* append */); | 76 -1 /* append */); |
| 80 | 77 |
| 81 gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); | 78 gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); |
| 82 | 79 m_webViewHost.reset(WebViewHost::Create(vbox, NULL, *TestShell::web_prefs_)); |
| 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); | |
| 93 | 80 |
| 94 gtk_container_add(GTK_CONTAINER(m_mainWnd), vbox); | 81 gtk_container_add(GTK_CONTAINER(m_mainWnd), vbox); |
| 95 gtk_widget_show_all(m_mainWnd); | 82 gtk_widget_show_all(m_mainWnd); |
| 96 | 83 |
| 97 return true; | 84 return true; |
| 98 } | 85 } |
| 99 | 86 |
| 100 void TestShell::BindJSObjectsToWindow(WebFrame* frame) { | 87 void TestShell::BindJSObjectsToWindow(WebFrame* frame) { |
| 101 NOTIMPLEMENTED(); | 88 NOTIMPLEMENTED(); |
| 102 } | 89 } |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 173 |
| 187 bool IsDefaultPluginEnabled() { | 174 bool IsDefaultPluginEnabled() { |
| 188 return false; | 175 return false; |
| 189 } | 176 } |
| 190 | 177 |
| 191 std::wstring GetWebKitLocale() { | 178 std::wstring GetWebKitLocale() { |
| 192 return L"en-US"; | 179 return L"en-US"; |
| 193 } | 180 } |
| 194 | 181 |
| 195 } // namespace webkit_glue | 182 } // namespace webkit_glue |
| OLD | NEW |