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

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

Issue 20243003: Fix crash when reloading packaged app. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to after mac app shim fix Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/cocoa/extensions/native_app_window_cocoa.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/native_app_window_gtk.h" 5 #include "chrome/browser/ui/gtk/extensions/native_app_window_gtk.h"
6 6
7 #include <gdk/gdkx.h> 7 #include <gdk/gdkx.h>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/message_loop/message_loop.h"
10 #include "base/message_loop/message_pump_gtk.h" 11 #include "base/message_loop/message_pump_gtk.h"
11 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
12 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/ui/gtk/extensions/extension_keybinding_registry_gtk.h" 14 #include "chrome/browser/ui/gtk/extensions/extension_keybinding_registry_gtk.h"
14 #include "chrome/browser/ui/gtk/gtk_util.h" 15 #include "chrome/browser/ui/gtk/gtk_util.h"
15 #include "chrome/browser/ui/gtk/gtk_window_util.h" 16 #include "chrome/browser/ui/gtk/gtk_window_util.h"
16 #include "chrome/browser/web_applications/web_app.h" 17 #include "chrome/browser/web_applications/web_app.h"
17 #include "chrome/common/extensions/extension.h" 18 #include "chrome/common/extensions/extension.h"
18 #include "content/public/browser/render_view_host.h" 19 #include "content/public/browser/render_view_host.h"
19 #include "content/public/browser/render_widget_host_view.h" 20 #include "content/public/browser/render_widget_host_view.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 void NativeAppWindowGtk::Close() { 237 void NativeAppWindowGtk::Close() {
237 shell_window_->OnNativeWindowChanged(); 238 shell_window_->OnNativeWindowChanged();
238 239
239 // Cancel any pending callback from the window configure debounce timer. 240 // Cancel any pending callback from the window configure debounce timer.
240 window_configure_debounce_timer_.Stop(); 241 window_configure_debounce_timer_.Stop();
241 242
242 GtkWidget* window = GTK_WIDGET(window_); 243 GtkWidget* window = GTK_WIDGET(window_);
243 // To help catch bugs in any event handlers that might get fired during the 244 // To help catch bugs in any event handlers that might get fired during the
244 // destruction, set window_ to NULL before any handlers will run. 245 // destruction, set window_ to NULL before any handlers will run.
245 window_ = NULL; 246 window_ = NULL;
247 gtk_widget_destroy(window);
246 248
247 // OnNativeClose does a delete this so no other members should 249 // On other platforms, the native window doesn't get destroyed synchronously.
248 // be accessed after. gtk_widget_destroy is safe (and must 250 // We simulate that here so that ShellWindow can assume that it doesn't get
249 // be last). 251 // deleted immediately upon calling Close().
250 shell_window_->OnNativeClose(); 252 base::MessageLoop::current()->PostTask(
251 gtk_widget_destroy(window); 253 FROM_HERE,
254 base::Bind(&ShellWindow::OnNativeClose,
255 base::Unretained(shell_window_)));
252 } 256 }
253 257
254 void NativeAppWindowGtk::Activate() { 258 void NativeAppWindowGtk::Activate() {
255 gtk_window_present(window_); 259 gtk_window_present(window_);
256 } 260 }
257 261
258 void NativeAppWindowGtk::Deactivate() { 262 void NativeAppWindowGtk::Deactivate() {
259 gdk_window_lower(gtk_widget_get_window(GTK_WIDGET(window_))); 263 gdk_window_lower(gtk_widget_get_window(GTK_WIDGET(window_)));
260 } 264 }
261 265
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 624
621 draggable_region_.reset(ShellWindow::RawDraggableRegionsToSkRegion(regions)); 625 draggable_region_.reset(ShellWindow::RawDraggableRegionsToSkRegion(regions));
622 } 626 }
623 627
624 // static 628 // static
625 NativeAppWindow* NativeAppWindow::Create( 629 NativeAppWindow* NativeAppWindow::Create(
626 ShellWindow* shell_window, 630 ShellWindow* shell_window,
627 const ShellWindow::CreateParams& params) { 631 const ShellWindow::CreateParams& params) {
628 return new NativeAppWindowGtk(shell_window, params); 632 return new NativeAppWindowGtk(shell_window, params);
629 } 633 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/extensions/native_app_window_cocoa.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698