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

Unified Diff: chrome/browser/ui/panels/panel_window_controller_cocoa.mm

Issue 7945018: Notify the WebView when panels gain/lose key window status. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698