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

Unified Diff: chrome/browser/ui/cocoa/constrained_window_mac.mm

Issue 10823176: Cocoa: Support constrained windows for platform apps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment Created 8 years, 4 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
Index: chrome/browser/ui/cocoa/constrained_window_mac.mm
diff --git a/chrome/browser/ui/cocoa/constrained_window_mac.mm b/chrome/browser/ui/cocoa/constrained_window_mac.mm
index 1d018f160838b2dc24cbd176e3f4a787908aaef2..3f0af3ca02dcd4d24f5c824528aa0b084a4e8db7 100644
--- a/chrome/browser/ui/cocoa/constrained_window_mac.mm
+++ b/chrome/browser/ui/cocoa/constrained_window_mac.mm
@@ -4,7 +4,6 @@
#include "chrome/browser/ui/cocoa/constrained_window_mac.h"
-#import "chrome/browser/ui/cocoa/browser_window_controller.h"
#include "chrome/browser/ui/constrained_window_tab_helper.h"
#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "content/public/browser/web_contents.h"
@@ -105,12 +104,21 @@ void ConstrainedWindowMac::ShowConstrainedWindow() {
// The WebContents only has a native window if it is currently visible. In
// this case, open the sheet now. Else, Realize() will be called later, when
// our tab becomes visible.
- NSWindow* browserWindow =
+ NSWindow* window =
tab_contents_->web_contents()->GetView()->GetTopLevelNativeWindow();
- BrowserWindowController* browser_controller =
- [BrowserWindowController browserWindowControllerForWindow:browserWindow];
- if ([browser_controller canAttachConstrainedWindow])
- Realize(browser_controller);
+ NSWindowController<ConstrainedWindowSupport>* window_controller = nil;
+ while (window) {
+ if ([[window windowController] conformsToProtocol:
+ @protocol(ConstrainedWindowSupport)]) {
Robert Sesek 2012/08/06 22:18:34 nit: indent4 from here
sail 2012/08/09 00:25:54 Done.
+ window_controller = [window windowController];
+ break;
+ }
+ window = [window parentWindow];
jeremya 2012/08/05 22:32:47 If the window is the TopLevelNativeWindow, will it
sail 2012/08/09 00:25:54 No, the parent will be nil.
jeremya 2012/08/09 00:32:48 Then why check here? if [window parentWindow] is a
sail 2012/08/09 00:40:42 The idea is that we want the window controller of
+ }
+
+ DCHECK(window_controller);
jeremya 2012/08/05 22:32:47 Are we guaranteed a controller that conforms to Co
Robert Sesek 2012/08/06 22:18:34 That'll happen with the if-check below because you
+ if ([window_controller canAttachConstrainedWindow])
+ Realize(window_controller);
}
void ConstrainedWindowMac::CloseConstrainedWindow() {
@@ -131,7 +139,8 @@ void ConstrainedWindowMac::CloseConstrainedWindow() {
delete this;
}
-void ConstrainedWindowMac::Realize(BrowserWindowController* controller) {
+void ConstrainedWindowMac::Realize(
+ NSWindowController<ConstrainedWindowSupport>* controller) {
if (!should_be_visible_)
return;

Powered by Google App Engine
This is Rietveld 408576698