Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(505)

Side by Side Diff: chrome/browser/ui/gtk/extensions/shell_window_gtk.cc

Issue 10119003: Pull shell window stuff out of ExtensionHost and put in ShellWindow (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Try jobs Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/browser/ui/gtk/extensions/shell_window_gtk.h" 5 #include "chrome/browser/ui/gtk/extensions/shell_window_gtk.h"
6 6
7 #include "chrome/browser/extensions/extension_host.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/common/extensions/extension.h" 8 #include "chrome/common/extensions/extension.h"
9 #include "content/public/browser/render_widget_host_view.h" 9 #include "content/public/browser/render_widget_host_view.h"
10 #include "content/public/browser/web_contents.h"
11 #include "content/public/browser/web_contents_view.h"
10 #include "ui/base/x/active_window_watcher_x.h" 12 #include "ui/base/x/active_window_watcher_x.h"
11 #include "ui/gfx/rect.h" 13 #include "ui/gfx/rect.h"
12 14
13 ShellWindowGtk::ShellWindowGtk(ExtensionHost* host) 15 ShellWindowGtk::ShellWindowGtk(Profile* profile,
14 : ShellWindow(host), 16 const Extension* extension,
17 const GURL& url)
18 : ShellWindow(profile, extension, url),
15 state_(GDK_WINDOW_STATE_WITHDRAWN), 19 state_(GDK_WINDOW_STATE_WITHDRAWN),
16 is_active_(!ui::ActiveWindowWatcherX::WMSupportsActivation()) { 20 is_active_(!ui::ActiveWindowWatcherX::WMSupportsActivation()) {
17 host_->view()->SetContainer(this);
18 window_ = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL)); 21 window_ = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL));
19 22
20 gtk_container_add(GTK_CONTAINER(window_), host_->view()->native_view()); 23 gfx::NativeView native_view =
24 web_contents()->GetView()->GetNativeView();
25 gtk_container_add(GTK_CONTAINER(window_), native_view);
21 26
22 gtk_window_set_default_size(window_, kDefaultWidth, kDefaultHeight); 27 gtk_window_set_default_size(window_, kDefaultWidth, kDefaultHeight);
23 28
24 const Extension* extension = host_->extension();
25
26 // TODO(mihaip): Mirror contents of <title> tag in window title 29 // TODO(mihaip): Mirror contents of <title> tag in window title
27 gtk_window_set_title(window_, extension->name().c_str()); 30 gtk_window_set_title(window_, extension->name().c_str());
28 31
29 g_signal_connect(window_, "delete-event", 32 g_signal_connect(window_, "delete-event",
30 G_CALLBACK(OnMainWindowDeleteEventThunk), this); 33 G_CALLBACK(OnMainWindowDeleteEventThunk), this);
31 g_signal_connect(window_, "configure-event", 34 g_signal_connect(window_, "configure-event",
32 G_CALLBACK(OnConfigureThunk), this); 35 G_CALLBACK(OnConfigureThunk), this);
33 g_signal_connect(window_, "window-state-event", 36 g_signal_connect(window_, "window-state-event",
34 G_CALLBACK(OnWindowStateThunk), this); 37 G_CALLBACK(OnWindowStateThunk), this);
35 38
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 return FALSE; 160 return FALSE;
158 } 161 }
159 162
160 gboolean ShellWindowGtk::OnWindowState(GtkWidget* sender, 163 gboolean ShellWindowGtk::OnWindowState(GtkWidget* sender,
161 GdkEventWindowState* event) { 164 GdkEventWindowState* event) {
162 state_ = event->new_window_state; 165 state_ = event->new_window_state;
163 return FALSE; 166 return FALSE;
164 } 167 }
165 168
166 // static 169 // static
167 ShellWindow* ShellWindow::CreateShellWindow(ExtensionHost* host) { 170 ShellWindow* ShellWindow::CreateImpl(Profile* profile,
168 return new ShellWindowGtk(host); 171 const Extension* extension,
172 const GURL& url) {
173 return new ShellWindowGtk(profile, extension, url);
169 } 174 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698