Title: [166327] trunk/Tools
Revision
166327
Author
ander...@apple.com
Date
2014-03-26 16:36:08 -0700 (Wed, 26 Mar 2014)

Log Message

Change MiniBrowser to hold on to window controllers instead of windows
https://bugs.webkit.org/show_bug.cgi?id=130797

Reviewed by Oliver Hunt.

* MiniBrowser/mac/AppDelegate.h:
* MiniBrowser/mac/AppDelegate.m:
(-[BrowserAppDelegate init]):
(-[BrowserAppDelegate newWindow:]):
(-[BrowserAppDelegate browserWindowWillClose:]):
(-[BrowserAppDelegate applicationWillTerminate:]):
(-[BrowserAppDelegate frontmostBrowserWindowController]):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (166326 => 166327)


--- trunk/Tools/ChangeLog	2014-03-26 23:35:39 UTC (rev 166326)
+++ trunk/Tools/ChangeLog	2014-03-26 23:36:08 UTC (rev 166327)
@@ -1,3 +1,18 @@
+2014-03-26  Anders Carlsson  <ander...@apple.com>
+
+        Change MiniBrowser to hold on to window controllers instead of windows
+        https://bugs.webkit.org/show_bug.cgi?id=130797
+
+        Reviewed by Oliver Hunt.
+
+        * MiniBrowser/mac/AppDelegate.h:
+        * MiniBrowser/mac/AppDelegate.m:
+        (-[BrowserAppDelegate init]):
+        (-[BrowserAppDelegate newWindow:]):
+        (-[BrowserAppDelegate browserWindowWillClose:]):
+        (-[BrowserAppDelegate applicationWillTerminate:]):
+        (-[BrowserAppDelegate frontmostBrowserWindowController]):
+
 2014-03-26  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r166264.

Modified: trunk/Tools/MiniBrowser/mac/AppDelegate.h (166326 => 166327)


--- trunk/Tools/MiniBrowser/mac/AppDelegate.h	2014-03-26 23:35:39 UTC (rev 166326)
+++ trunk/Tools/MiniBrowser/mac/AppDelegate.h	2014-03-26 23:36:08 UTC (rev 166327)
@@ -24,7 +24,7 @@
  */
 
 @interface BrowserAppDelegate : NSObject <NSApplicationDelegate> {
-    NSMutableSet *_browserWindows;
+    NSMutableSet *_browserWindowControllers;
 }
 
 - (void)browserWindowWillClose:(NSWindow *)window;

Modified: trunk/Tools/MiniBrowser/mac/AppDelegate.m (166326 => 166327)


--- trunk/Tools/MiniBrowser/mac/AppDelegate.m	2014-03-26 23:35:39 UTC (rev 166326)
+++ trunk/Tools/MiniBrowser/mac/AppDelegate.m	2014-03-26 23:36:08 UTC (rev 166327)
@@ -43,7 +43,7 @@
 {
     self = [super init];
     if (self) {
-        _browserWindows = [[NSMutableSet alloc] init];
+        _browserWindowControllers = [[NSMutableSet alloc] init];
     }
 
     return self;
@@ -63,14 +63,14 @@
         return;
 
     [[controller window] makeKeyAndOrderFront:sender];
-    [_browserWindows addObject:[controller window]];
+    [_browserWindowControllers addObject:controller];
     
     [controller loadURLString:defaultURL];
 }
 
 - (void)browserWindowWillClose:(NSWindow *)window
 {
-    [_browserWindows removeObject:window];
+    [_browserWindowControllers removeObject:window.windowController];
 }
 
 - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
@@ -84,12 +84,8 @@
 
 - (void)applicationWillTerminate:(NSNotification *)notification
 {
-    for (NSWindow* window in _browserWindows) {
-        id delegate = [window delegate];
-        assert([delegate isKindOfClass:[BrowserWindowController class]]);
-        BrowserWindowController *controller = (BrowserWindowController *)delegate;
+    for (BrowserWindowController* controller in _browserWindowControllers)
         [controller applicationTerminating];
-    }
 }
 
 - (BrowserWindowController *)frontmostBrowserWindowController
@@ -101,11 +97,11 @@
             continue;
 
         BrowserWindowController *controller = (BrowserWindowController *)delegate;
-        assert([_browserWindows containsObject:[controller window]]);
+        assert([_browserWindowControllers containsObject:controller]);
         return controller;
     }
 
-    return 0;
+    return nil;
 }
 
 - (IBAction)openDocument:(id)sender
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to