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/logging.h" | 10 #include "base/logging.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 if (headless_) | 94 if (headless_) |
95 return; | 95 return; |
96 | 96 |
97 if (loading) | 97 if (loading) |
98 gtk_spinner_start(GTK_SPINNER(spinner_)); | 98 gtk_spinner_start(GTK_SPINNER(spinner_)); |
99 else | 99 else |
100 gtk_spinner_stop(GTK_SPINNER(spinner_)); | 100 gtk_spinner_stop(GTK_SPINNER(spinner_)); |
101 } | 101 } |
102 | 102 |
103 void Shell::PlatformCreateWindow(int width, int height) { | 103 void Shell::PlatformCreateWindow(int width, int height) { |
| 104 SizeTo(width, height); |
| 105 |
104 if (headless_) | 106 if (headless_) |
105 return; | 107 return; |
106 | 108 |
107 window_ = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL)); | 109 window_ = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL)); |
108 gtk_window_set_title(window_, "Content Shell"); | 110 gtk_window_set_title(window_, "Content Shell"); |
109 g_signal_connect(G_OBJECT(window_), "destroy", | 111 g_signal_connect(G_OBJECT(window_), "destroy", |
110 G_CALLBACK(OnWindowDestroyedThunk), this); | 112 G_CALLBACK(OnWindowDestroyedThunk), this); |
111 | 113 |
112 vbox_ = gtk_vbox_new(FALSE, 0); | 114 vbox_ = gtk_vbox_new(FALSE, 0); |
113 | 115 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 gtk_container_add(GTK_CONTAINER(spinner_alignment), spinner_); | 189 gtk_container_add(GTK_CONTAINER(spinner_alignment), spinner_); |
188 | 190 |
189 spinner_item_ = gtk_tool_item_new(); | 191 spinner_item_ = gtk_tool_item_new(); |
190 gtk_container_add(GTK_CONTAINER(spinner_item_), spinner_alignment); | 192 gtk_container_add(GTK_CONTAINER(spinner_item_), spinner_alignment); |
191 gtk_toolbar_insert(GTK_TOOLBAR(toolbar), spinner_item_, -1 /* append */); | 193 gtk_toolbar_insert(GTK_TOOLBAR(toolbar), spinner_item_, -1 /* append */); |
192 | 194 |
193 gtk_box_pack_start(GTK_BOX(vbox_), toolbar, FALSE, FALSE, 0); | 195 gtk_box_pack_start(GTK_BOX(vbox_), toolbar, FALSE, FALSE, 0); |
194 | 196 |
195 gtk_container_add(GTK_CONTAINER(window_), vbox_); | 197 gtk_container_add(GTK_CONTAINER(window_), vbox_); |
196 gtk_widget_show_all(GTK_WIDGET(window_)); | 198 gtk_widget_show_all(GTK_WIDGET(window_)); |
197 | |
198 SizeTo(width, height); | |
199 } | 199 } |
200 | 200 |
201 void Shell::PlatformSetContents() { | 201 void Shell::PlatformSetContents() { |
202 if (headless_) | 202 if (headless_) |
203 return; | 203 return; |
204 | 204 |
205 WebContentsView* content_view = web_contents_->GetView(); | 205 WebContentsView* content_view = web_contents_->GetView(); |
206 gtk_container_add(GTK_CONTAINER(vbox_), content_view->GetNativeView()); | 206 gtk_container_add(GTK_CONTAINER(vbox_), content_view->GetNativeView()); |
207 } | 207 } |
208 | 208 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 | 289 |
290 void Shell::PlatformSetTitle(const string16& title) { | 290 void Shell::PlatformSetTitle(const string16& title) { |
291 if (headless_) | 291 if (headless_) |
292 return; | 292 return; |
293 | 293 |
294 std::string title_utf8 = UTF16ToUTF8(title); | 294 std::string title_utf8 = UTF16ToUTF8(title); |
295 gtk_window_set_title(GTK_WINDOW(window_), title_utf8.c_str()); | 295 gtk_window_set_title(GTK_WINDOW(window_), title_utf8.c_str()); |
296 } | 296 } |
297 | 297 |
298 } // namespace content | 298 } // namespace content |
OLD | NEW |