OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/shell/shell.h" | 5 #include "content/shell/shell.h" |
6 | 6 |
7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 | 9 |
10 #include "base/command_line.h" | |
11 #include "base/logging.h" | 10 #include "base/logging.h" |
12 #include "base/string_piece.h" | 11 #include "base/string_piece.h" |
13 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
14 #include "content/public/browser/browser_context.h" | 13 #include "content/public/browser/browser_context.h" |
15 #include "content/public/browser/native_web_keyboard_event.h" | 14 #include "content/public/browser/native_web_keyboard_event.h" |
16 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
17 #include "content/public/browser/web_contents_view.h" | 16 #include "content/public/browser/web_contents_view.h" |
18 #include "content/public/common/renderer_preferences.h" | 17 #include "content/public/common/renderer_preferences.h" |
19 #include "content/shell/shell_browser_context.h" | 18 #include "content/shell/shell_browser_context.h" |
20 #include "content/shell/shell_content_browser_client.h" | 19 #include "content/shell/shell_content_browser_client.h" |
21 #include "content/shell/shell_switches.h" | |
22 #include "third_party/skia/include/core/SkColor.h" | 20 #include "third_party/skia/include/core/SkColor.h" |
23 | 21 |
24 namespace content { | 22 namespace content { |
25 | 23 |
26 namespace { | 24 namespace { |
27 | 25 |
28 // Callback for Debug > Show web inspector... menu item. | 26 // Callback for Debug > Show web inspector... menu item. |
29 gboolean ShowWebInspectorActivated(GtkWidget* widget, Shell* shell) { | 27 gboolean ShowWebInspectorActivated(GtkWidget* widget, Shell* shell) { |
30 shell->ShowDevTools(); | 28 shell->ShowDevTools(); |
31 return FALSE; // Don't stop this message. | 29 return FALSE; // Don't stop this message. |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 177 |
180 spinner_item_ = gtk_tool_item_new(); | 178 spinner_item_ = gtk_tool_item_new(); |
181 gtk_container_add(GTK_CONTAINER(spinner_item_), spinner_alignment); | 179 gtk_container_add(GTK_CONTAINER(spinner_item_), spinner_alignment); |
182 gtk_toolbar_insert(GTK_TOOLBAR(toolbar), spinner_item_, -1 /* append */); | 180 gtk_toolbar_insert(GTK_TOOLBAR(toolbar), spinner_item_, -1 /* append */); |
183 | 181 |
184 gtk_box_pack_start(GTK_BOX(vbox_), toolbar, FALSE, FALSE, 0); | 182 gtk_box_pack_start(GTK_BOX(vbox_), toolbar, FALSE, FALSE, 0); |
185 | 183 |
186 gtk_container_add(GTK_CONTAINER(window_), vbox_); | 184 gtk_container_add(GTK_CONTAINER(window_), vbox_); |
187 gtk_widget_show_all(GTK_WIDGET(window_)); | 185 gtk_widget_show_all(GTK_WIDGET(window_)); |
188 | 186 |
189 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | |
190 gtk_widget_set_uposition(GTK_WIDGET(window_), 10000, 10000); | |
191 | |
192 SizeTo(width, height); | 187 SizeTo(width, height); |
193 } | 188 } |
194 | 189 |
195 void Shell::PlatformSetContents() { | 190 void Shell::PlatformSetContents() { |
196 WebContentsView* content_view = web_contents_->GetView(); | 191 WebContentsView* content_view = web_contents_->GetView(); |
197 gtk_container_add(GTK_CONTAINER(vbox_), content_view->GetNativeView()); | 192 gtk_container_add(GTK_CONTAINER(vbox_), content_view->GetNativeView()); |
198 | 193 |
199 // As an additional requirement on Linux, we must set the colors for the | 194 // As an additional requirement on Linux, we must set the colors for the |
200 // render widgets in webkit. | 195 // render widgets in webkit. |
201 content::RendererPreferences* prefs = | 196 content::RendererPreferences* prefs = |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 gtk_widget_grab_focus(GTK_WIDGET(url_edit_view_)); | 282 gtk_widget_grab_focus(GTK_WIDGET(url_edit_view_)); |
288 return TRUE; | 283 return TRUE; |
289 } | 284 } |
290 | 285 |
291 void Shell::PlatformSetTitle(const string16& title) { | 286 void Shell::PlatformSetTitle(const string16& title) { |
292 std::string title_utf8 = UTF16ToUTF8(title); | 287 std::string title_utf8 = UTF16ToUTF8(title); |
293 gtk_window_set_title(GTK_WINDOW(window_), title_utf8.c_str()); | 288 gtk_window_set_title(GTK_WINDOW(window_), title_utf8.c_str()); |
294 } | 289 } |
295 | 290 |
296 } // namespace content | 291 } // namespace content |
OLD | NEW |