| 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" | |
| 8 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 9 #include "base/mac/mac_util.h" | 8 #include "base/mac/mac_util.h" |
| 10 #include "base/message_loop/message_loop.h" | |
| 11 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/ui/cocoa/browser_window_utils.h" | 11 #include "chrome/browser/ui/cocoa/browser_window_utils.h" |
| 14 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" | 12 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" |
| 15 #include "chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa
.h" | 13 #include "chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa
.h" |
| 16 #include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h" | 14 #include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h" |
| 17 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
| 18 #include "chrome/common/extensions/extension.h" | 16 #include "chrome/common/extensions/extension.h" |
| 19 #include "content/public/browser/native_web_keyboard_event.h" | 17 #include "content/public/browser/native_web_keyboard_event.h" |
| 20 #include "content/public/browser/notification_source.h" | 18 #include "content/public/browser/notification_source.h" |
| (...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 } | 751 } |
| 754 | 752 |
| 755 void NativeAppWindowCocoa::RemoveObserver( | 753 void NativeAppWindowCocoa::RemoveObserver( |
| 756 web_modal::WebContentsModalDialogHostObserver* observer) { | 754 web_modal::WebContentsModalDialogHostObserver* observer) { |
| 757 NOTIMPLEMENTED(); | 755 NOTIMPLEMENTED(); |
| 758 } | 756 } |
| 759 | 757 |
| 760 void NativeAppWindowCocoa::WindowWillClose() { | 758 void NativeAppWindowCocoa::WindowWillClose() { |
| 761 [window_controller_ setAppWindow:NULL]; | 759 [window_controller_ setAppWindow:NULL]; |
| 762 shell_window_->OnNativeWindowChanged(); | 760 shell_window_->OnNativeWindowChanged(); |
| 763 // On other platforms, the native window doesn't get destroyed synchronously. | 761 shell_window_->OnNativeClose(); |
| 764 // We simulate that here so that ShellWindow can assume that it doesn't get | |
| 765 // deleted immediately upon calling Close(). | |
| 766 base::MessageLoop::current()->PostTask( | |
| 767 FROM_HERE, | |
| 768 base::Bind(&ShellWindow::OnNativeClose, | |
| 769 base::Unretained(shell_window_))); | |
| 770 } | 762 } |
| 771 | 763 |
| 772 void NativeAppWindowCocoa::WindowDidBecomeKey() { | 764 void NativeAppWindowCocoa::WindowDidBecomeKey() { |
| 773 content::RenderWidgetHostView* rwhv = | 765 content::RenderWidgetHostView* rwhv = |
| 774 web_contents()->GetRenderWidgetHostView(); | 766 web_contents()->GetRenderWidgetHostView(); |
| 775 if (rwhv) | 767 if (rwhv) |
| 776 rwhv->SetActive(true); | 768 rwhv->SetActive(true); |
| 777 shell_window_->OnNativeWindowActivated(); | 769 shell_window_->OnNativeWindowActivated(); |
| 778 } | 770 } |
| 779 | 771 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 CHECK(!window || [window isKindOfClass:[ShellNSWindow class]]); | 842 CHECK(!window || [window isKindOfClass:[ShellNSWindow class]]); |
| 851 return static_cast<ShellNSWindow*>(window); | 843 return static_cast<ShellNSWindow*>(window); |
| 852 } | 844 } |
| 853 | 845 |
| 854 // static | 846 // static |
| 855 NativeAppWindow* NativeAppWindow::Create( | 847 NativeAppWindow* NativeAppWindow::Create( |
| 856 ShellWindow* shell_window, | 848 ShellWindow* shell_window, |
| 857 const ShellWindow::CreateParams& params) { | 849 const ShellWindow::CreateParams& params) { |
| 858 return new NativeAppWindowCocoa(shell_window, params); | 850 return new NativeAppWindowCocoa(shell_window, params); |
| 859 } | 851 } |
| OLD | NEW |