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 "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 Loading... | |
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 MessageLoop::current()->PostTask( |
Nico
2013/02/13 01:22:32
Can you add a comment similar to the one in the gt
jeremya
2013/02/13 01:33:18
Done.
| |
685 FROM_HERE, | |
686 base::Bind(&ShellWindow::OnNativeClose, | |
687 base::Unretained(shell_window_))); | |
683 } | 688 } |
684 | 689 |
685 void NativeAppWindowCocoa::WindowDidBecomeKey() { | 690 void NativeAppWindowCocoa::WindowDidBecomeKey() { |
686 content::RenderWidgetHostView* rwhv = | 691 content::RenderWidgetHostView* rwhv = |
687 web_contents()->GetRenderWidgetHostView(); | 692 web_contents()->GetRenderWidgetHostView(); |
688 if (rwhv) | 693 if (rwhv) |
689 rwhv->SetActive(true); | 694 rwhv->SetActive(true); |
690 } | 695 } |
691 | 696 |
692 void NativeAppWindowCocoa::WindowDidResignKey() { | 697 void NativeAppWindowCocoa::WindowDidResignKey() { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
758 CHECK(!window || [window isKindOfClass:[ShellNSWindow class]]); | 763 CHECK(!window || [window isKindOfClass:[ShellNSWindow class]]); |
759 return static_cast<ShellNSWindow*>(window); | 764 return static_cast<ShellNSWindow*>(window); |
760 } | 765 } |
761 | 766 |
762 // static | 767 // static |
763 NativeAppWindow* NativeAppWindow::Create( | 768 NativeAppWindow* NativeAppWindow::Create( |
764 ShellWindow* shell_window, | 769 ShellWindow* shell_window, |
765 const ShellWindow::CreateParams& params) { | 770 const ShellWindow::CreateParams& params) { |
766 return new NativeAppWindowCocoa(shell_window, params); | 771 return new NativeAppWindowCocoa(shell_window, params); |
767 } | 772 } |
OLD | NEW |