Index: chrome/browser/ui/panels/panel_window_controller_cocoa.mm |
diff --git a/chrome/browser/ui/panels/panel_window_controller_cocoa.mm b/chrome/browser/ui/panels/panel_window_controller_cocoa.mm |
index 167c9058abd1dd3b94900914e6eae57edc0647a7..fce93fef78cfca59c2d9be3fb859975262ad155e 100644 |
--- a/chrome/browser/ui/panels/panel_window_controller_cocoa.mm |
+++ b/chrome/browser/ui/panels/panel_window_controller_cocoa.mm |
@@ -27,6 +27,7 @@ |
#import "chrome/browser/ui/panels/panel_titlebar_view_cocoa.h" |
#include "chrome/browser/ui/toolbar/encoding_menu_controller.h" |
#include "chrome/common/chrome_notification_types.h" |
+#include "content/browser/renderer_host/render_widget_host_view.h" |
#include "content/browser/tab_contents/tab_contents.h" |
#include "content/common/notification_service.h" |
@@ -412,6 +413,30 @@ static BOOL g_reportAnimationStatus = NO; |
NSView* titlebar = [self titlebarView]; |
return NSHeight([titlebar convertRect:[titlebar bounds] toView:nil]); |
} |
+ |
+// TODO(dcheng): These two selectors are almost copy-and-paste from |
+// BrowserWindowController. Figure out the appropriate way of code sharing, |
+// whether it's refactoring more things into BrowserWindowUtils or making a |
+// common base controller for browser windows. |
+- (void)windowDidBecomeKey:(NSNotification*)notification { |
+ if (TabContents* contents = |
+ windowShim_->browser()->GetSelectedTabContents()) { |
+ if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) |
+ rwhv->SetActive(true); |
+ } |
+} |
+ |
+- (void)windowDidResignKey:(NSNotification*)notification { |
+ if ([NSApp isActive] && ([NSApp keyWindow] == [self window])) |
Dmitry Titov
2011/09/20 23:36:00
could you figure out why we do these checks and ad
|
+ return; |
+ |
+ if (TabContents* contents = |
+ windowShim_->browser()->GetSelectedTabContents()) { |
+ if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) |
+ rwhv->SetActive(false); |
+ } |
+} |
+ |
// TestingAPI interface implementation |
+ (void)enableBoundsAnimationNotifications { |