Chromium Code Reviews| 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 if (headless_) | 104 if (headless_) |
|
jochen (gone - plz use gerrit)
2013/01/08 20:20:34
You should invoke SizeTo(width, height) here
| |
| 105 return; | 105 return; |
| 106 | 106 |
| 107 window_ = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL)); | 107 window_ = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL)); |
| 108 gtk_window_set_title(window_, "Content Shell"); | 108 gtk_window_set_title(window_, "Content Shell"); |
| 109 g_signal_connect(G_OBJECT(window_), "destroy", | 109 g_signal_connect(G_OBJECT(window_), "destroy", |
| 110 G_CALLBACK(OnWindowDestroyedThunk), this); | 110 G_CALLBACK(OnWindowDestroyedThunk), this); |
| 111 | 111 |
| 112 vbox_ = gtk_vbox_new(FALSE, 0); | 112 vbox_ = gtk_vbox_new(FALSE, 0); |
| 113 | 113 |
| 114 // Create the menu bar. | 114 // Create the menu bar. |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 207 } | 207 } |
| 208 | 208 |
| 209 void Shell::SizeTo(int width, int height) { | 209 void Shell::SizeTo(int width, int height) { |
| 210 content_width_ = width; | 210 content_width_ = width; |
| 211 content_height_ = height; | 211 content_height_ = height; |
| 212 if (web_contents_.get()) | 212 if (web_contents_.get()) |
| 213 gtk_widget_set_size_request(web_contents_->GetNativeView(), width, height); | 213 gtk_widget_set_size_request(web_contents_->GetNativeView(), width, height); |
| 214 } | 214 } |
| 215 | 215 |
| 216 void Shell::PlatformResizeSubViews() { | 216 void Shell::PlatformResizeSubViews() { |
| 217 if (headless_) | |
| 218 return; | |
| 219 | |
| 217 SizeTo(content_width_, content_height_); | 220 SizeTo(content_width_, content_height_); |
| 218 } | 221 } |
| 219 | 222 |
| 220 void Shell::Close() { | 223 void Shell::Close() { |
| 221 if (headless_) { | 224 if (headless_) { |
| 222 delete this; | 225 delete this; |
| 223 return; | 226 return; |
| 224 } | 227 } |
| 225 | 228 |
| 226 gtk_widget_destroy(GTK_WIDGET(window_)); | 229 gtk_widget_destroy(GTK_WIDGET(window_)); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 289 | 292 |
| 290 void Shell::PlatformSetTitle(const string16& title) { | 293 void Shell::PlatformSetTitle(const string16& title) { |
| 291 if (headless_) | 294 if (headless_) |
| 292 return; | 295 return; |
| 293 | 296 |
| 294 std::string title_utf8 = UTF16ToUTF8(title); | 297 std::string title_utf8 = UTF16ToUTF8(title); |
| 295 gtk_window_set_title(GTK_WINDOW(window_), title_utf8.c_str()); | 298 gtk_window_set_title(GTK_WINDOW(window_), title_utf8.c_str()); |
| 296 } | 299 } |
| 297 | 300 |
| 298 } // namespace content | 301 } // namespace content |
| OLD | NEW |