OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/extensions/extension_host_mac.h" | 5 #include "chrome/browser/extensions/extension_host_mac.h" |
6 | 6 |
7 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" | 7 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" |
8 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" | 8 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" |
9 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" | 9 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" |
10 #import "chrome/browser/ui/cocoa/info_bubble_window.h" | 10 #import "chrome/browser/ui/cocoa/info_bubble_window.h" |
11 #include "chrome/common/native_web_keyboard_event.h" | 11 #include "chrome/common/native_web_keyboard_event.h" |
12 | 12 |
13 ExtensionHostMac::~ExtensionHostMac() { | 13 ExtensionHostMac::~ExtensionHostMac() { |
14 // If there is a popup open for this host's extension, close it. | 14 // If there is a popup open for this host's extension, close it. |
15 ExtensionPopupController* popup = [ExtensionPopupController popup]; | 15 ExtensionPopupController* popup = [ExtensionPopupController popup]; |
16 if (popup && [popup extensionHost]->extension() == this->extension()) { | 16 if ([[popup window] isVisible] && |
| 17 [popup extensionHost]->extension() == this->extension()) { |
17 InfoBubbleWindow* window = (InfoBubbleWindow*)[popup window]; | 18 InfoBubbleWindow* window = (InfoBubbleWindow*)[popup window]; |
18 [window setDelayOnClose:NO]; | 19 [window setDelayOnClose:NO]; |
19 [popup close]; | 20 [popup close]; |
20 } | 21 } |
21 } | 22 } |
22 | 23 |
23 RenderWidgetHostView* ExtensionHostMac::CreateNewWidgetInternal( | 24 RenderWidgetHostView* ExtensionHostMac::CreateNewWidgetInternal( |
24 int route_id, | 25 int route_id, |
25 WebKit::WebPopupType popup_type) { | 26 WebKit::WebPopupType popup_type) { |
26 // A RenderWidgetHostViewMac has lifetime scoped to the view. We'll retain it | 27 // A RenderWidgetHostViewMac has lifetime scoped to the view. We'll retain it |
(...skipping 25 matching lines...) Expand all Loading... |
52 if (event.skip_in_browser || event.type == NativeWebKeyboardEvent::Char || | 53 if (event.skip_in_browser || event.type == NativeWebKeyboardEvent::Char || |
53 extension_host_type() != ViewType::EXTENSION_POPUP) { | 54 extension_host_type() != ViewType::EXTENSION_POPUP) { |
54 return; | 55 return; |
55 } | 56 } |
56 | 57 |
57 ChromeEventProcessingWindow* event_window = | 58 ChromeEventProcessingWindow* event_window = |
58 static_cast<ChromeEventProcessingWindow*>([view()->native_view() window]); | 59 static_cast<ChromeEventProcessingWindow*>([view()->native_view() window]); |
59 DCHECK([event_window isKindOfClass:[ChromeEventProcessingWindow class]]); | 60 DCHECK([event_window isKindOfClass:[ChromeEventProcessingWindow class]]); |
60 [event_window redispatchKeyEvent:event.os_event]; | 61 [event_window redispatchKeyEvent:event.os_event]; |
61 } | 62 } |
OLD | NEW |