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

Side by Side Diff: chrome/browser/ui/cocoa/extensions/native_app_window_cocoa.mm

Issue 12210107: Fix issue 174250, crash when reloading packaged app. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: comments Created 7 years, 10 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/cocoa/extensions/native_app_window_cocoa.h" 5 #include "chrome/browser/ui/cocoa/extensions/native_app_window_cocoa.h"
6 6
7 #include "base/bind.h"
7 #include "base/mac/mac_util.h" 8 #include "base/mac/mac_util.h"
9 #include "base/message_loop.h"
8 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
9 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/cocoa/browser_window_utils.h" 12 #include "chrome/browser/ui/cocoa/browser_window_utils.h"
11 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" 13 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h"
12 #include "chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa .h" 14 #include "chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa .h"
13 #include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h" 15 #include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h"
14 #include "chrome/common/extensions/extension.h" 16 #include "chrome/common/extensions/extension.h"
15 #include "content/public/browser/native_web_keyboard_event.h" 17 #include "content/public/browser/native_web_keyboard_event.h"
16 #include "content/public/browser/notification_source.h" 18 #include "content/public/browser/notification_source.h"
17 #include "content/public/browser/notification_types.h" 19 #include "content/public/browser/notification_types.h"
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 return gfx::Insets(); 674 return gfx::Insets();
673 gfx::Rect frameRect(NSRectToCGRect([window() frame])); 675 gfx::Rect frameRect(NSRectToCGRect([window() frame]));
674 gfx::Rect contentRect( 676 gfx::Rect contentRect(
675 NSRectToCGRect([window() contentRectForFrameRect:[window() frame]])); 677 NSRectToCGRect([window() contentRectForFrameRect:[window() frame]]));
676 return frameRect.InsetsFrom(contentRect); 678 return frameRect.InsetsFrom(contentRect);
677 } 679 }
678 680
679 void NativeAppWindowCocoa::WindowWillClose() { 681 void NativeAppWindowCocoa::WindowWillClose() {
680 [window_controller_ setAppWindow:NULL]; 682 [window_controller_ setAppWindow:NULL];
681 shell_window_->OnNativeWindowChanged(); 683 shell_window_->OnNativeWindowChanged();
682 shell_window_->OnNativeClose(); 684 // On other platforms, the native window doesn't get destroyed synchronously.
685 // We simulate that here so that ShellWindow can assume that it doesn't get
686 // deleted immediately upon calling Close().
687 MessageLoop::current()->PostTask(
688 FROM_HERE,
689 base::Bind(&ShellWindow::OnNativeClose,
690 base::Unretained(shell_window_)));
683 } 691 }
684 692
685 void NativeAppWindowCocoa::WindowDidBecomeKey() { 693 void NativeAppWindowCocoa::WindowDidBecomeKey() {
686 content::RenderWidgetHostView* rwhv = 694 content::RenderWidgetHostView* rwhv =
687 web_contents()->GetRenderWidgetHostView(); 695 web_contents()->GetRenderWidgetHostView();
688 if (rwhv) 696 if (rwhv)
689 rwhv->SetActive(true); 697 rwhv->SetActive(true);
690 } 698 }
691 699
692 void NativeAppWindowCocoa::WindowDidResignKey() { 700 void NativeAppWindowCocoa::WindowDidResignKey() {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 CHECK(!window || [window isKindOfClass:[ShellNSWindow class]]); 766 CHECK(!window || [window isKindOfClass:[ShellNSWindow class]]);
759 return static_cast<ShellNSWindow*>(window); 767 return static_cast<ShellNSWindow*>(window);
760 } 768 }
761 769
762 // static 770 // static
763 NativeAppWindow* NativeAppWindow::Create( 771 NativeAppWindow* NativeAppWindow::Create(
764 ShellWindow* shell_window, 772 ShellWindow* shell_window,
765 const ShellWindow::CreateParams& params) { 773 const ShellWindow::CreateParams& params) {
766 return new NativeAppWindowCocoa(shell_window, params); 774 return new NativeAppWindowCocoa(shell_window, params);
767 } 775 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/shell_window_registry.cc ('k') | chrome/browser/ui/extensions/shell_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698