Skip to content

Commit

Permalink
Enable ARC and Notification Center
Browse files Browse the repository at this point in the history
  • Loading branch information
KOed committed Mar 30, 2012
1 parent 5f26309 commit 0165827
Show file tree
Hide file tree
Showing 52 changed files with 2,500 additions and 2,122 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Expand Up @@ -7,3 +7,11 @@
*xcodeproj/xcuserdata
/examples/simple-app/test.*
*CTTab*Object.*

.DS_Store

chromium-tabs.xcodeproj/KOed.mode1v3

chromium-tabs.xcodeproj/KOed.pbxuser

chromium-tabs.tmproj
54 changes: 20 additions & 34 deletions chromium-tabs.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

597 changes: 57 additions & 540 deletions resources/BrowserWindow.xib

Large diffs are not rendered by default.

27 changes: 11 additions & 16 deletions resources/TabContents.xib
Expand Up @@ -2,13 +2,13 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1050</int>
<string key="IBDocument.SystemVersion">11B26</string>
<string key="IBDocument.InterfaceBuilderVersion">1617</string>
<string key="IBDocument.AppKitVersion">1138</string>
<string key="IBDocument.HIToolboxVersion">566.00</string>
<string key="IBDocument.SystemVersion">11D50d</string>
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
<string key="IBDocument.AppKitVersion">1138.32</string>
<string key="IBDocument.HIToolboxVersion">568.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">1617</string>
<string key="NS.object.0">2182</string>
</object>
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
Expand All @@ -22,11 +22,8 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="dict.values" ref="0"/>
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1012502457">
<bool key="EncodedWithXMLCoder">YES</bool>
Expand Down Expand Up @@ -102,7 +99,9 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<reference key="object" ref="0"/>
<object class="NSArray" key="object" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="children" ref="1012502457"/>
<nil key="parent"/>
</object>
Expand Down Expand Up @@ -162,7 +161,7 @@
<string>93.IBWindowTemplateEditedContentRect</string>
<string>94.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
Expand Down Expand Up @@ -216,10 +215,6 @@
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<integer value="1050" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<integer value="1060" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>
Expand Down
4 changes: 2 additions & 2 deletions src/CTBrowser.h
Expand Up @@ -16,7 +16,7 @@ typedef enum {
// There is one CTBrowser instance per percieved window.
// A CTBrowser instance has one TabStripModel.

@interface CTBrowser : NSObject <CTTabStripModelDelegate, NSFastEnumeration> {
@interface CTBrowser : NSObject <CTTabStripModelDelegate/*, NSFastEnumeration*/> {
CTTabStripModel *tabStripModel_;
@public
// Important: Don't ever change this value from user code. It's public just
Expand All @@ -28,7 +28,7 @@ typedef enum {
@property(retain, readonly, nonatomic) CTTabStripModel* tabStripModel;

// The window controller
@property(strong, retain, readonly, nonatomic) CTBrowserWindowController* windowController;
@property(strong, retain, readwrite, nonatomic) CTBrowserWindowController* windowController;

// The window. Convenience for [windowController window]
@property(strong, readonly, nonatomic) NSWindow* window;
Expand Down
87 changes: 36 additions & 51 deletions src/CTBrowser.mm
Expand Up @@ -15,22 +15,8 @@ @implementation CTBrowser
@synthesize tabStripModel = tabStripModel_;


/*- (id)retain {
self = [super retain];
NSLog(@"%@ did retain (retainCount: %u)", self, [self retainCount]);
NSLog(@"%@", [NSThread callStackSymbols]);
return self;
}
- (void)release {
NSLog(@"%@ will release (retainCount: %u)", self, [self retainCount]);
NSLog(@"%@", [NSThread callStackSymbols]);
[super release];
}*/


+ (CTBrowser*)browser {
return [[[self alloc] init] autorelease];
return [[self alloc] init];
}


Expand All @@ -40,34 +26,33 @@ - (id)init {
}
return self;
}


-(void)dealloc {
DLOG("[ChromiumTabs] deallocing browser %@", self);
[tabStripModel_ release];
[super dealloc];
}


-(void)finalize {
[tabStripModel_ release];
[super finalize];
}
//
//
//-(void)dealloc {
// DLOG("[ChromiumTabs] deallocing browser %@", self);
// [tabStripModel_ release];
// [super dealloc];
//}
//
//
//-(void)finalize {
// [tabStripModel_ release];
// [super finalize];
//}


-(CTToolbarController *)createToolbarController {
// subclasses could override this -- returning nil means no toolbar
NSBundle *bundle = [CTUtil bundleForResource:@"Toolbar" ofType:@"nib"];
return [[[CTToolbarController alloc] initWithNibName:@"Toolbar"
return [[CTToolbarController alloc] initWithNibName:@"Toolbar"
bundle:bundle
browser:self] autorelease];
browser:self];
}

-(CTTabContentsController*)createTabContentsControllerWithContents:
(CTTabContents*)contents {
// subclasses could override this
return [[[CTTabContentsController alloc]
initWithContents:contents] autorelease];
return [[CTTabContentsController alloc] initWithContents:contents];
}


Expand Down Expand Up @@ -180,7 +165,6 @@ -(void)newWindow {
[[cls alloc] initWithBrowser:browser];
[browser addBlankTabInForeground:YES];
[windowController showWindow:self];
[[windowController autorelease] retain];
}

-(void)closeWindow {
Expand Down Expand Up @@ -217,7 +201,8 @@ -(CTTabContents*)addTabContents:(CTTabContents*)contents {
-(CTTabContents*)createBlankTabBasedOn:(CTTabContents*)baseContents {
// subclasses should override this to provide a custom CTTabContents type
// and/or initialization
return [[[CTTabContents alloc] initWithBaseTabContents:baseContents] autorelease];
// return [[[CTTabContents alloc] initWithBaseTabContents:baseContents] autorelease];
return [[CTTabContents alloc] initWithBaseTabContents:baseContents];
}

// implementation conforms to CTTabStripModelDelegate
Expand Down Expand Up @@ -446,23 +431,23 @@ -(BOOL)canCloseTab {
#pragma mark NSFastEnumeration


- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state
objects:(id *)stackbuf
count:(NSUInteger)fetchCount {
NSUInteger totalCount = [tabStripModel_ count];
NSUInteger fetchIndex = 0;

while (state->state+fetchIndex < totalCount && fetchIndex < fetchCount) {
stackbuf[fetchIndex++] =
[tabStripModel_ tabContentsAtIndex:(state->state + fetchIndex)];
}

state->state += fetchIndex;
state->itemsPtr = stackbuf;
state->mutationsPtr = (unsigned long *)self; // TODO

return fetchIndex;
}
//- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state
// objects:(id __unsafe_unretained [])stackbuf
// count:(NSUInteger)fetchCount {
// NSUInteger totalCount = [tabStripModel_ count];
// NSUInteger fetchIndex = 0;
//
// while (state->state+fetchIndex < totalCount && fetchIndex < fetchCount) {
// stackbuf[fetchIndex++] =
// [tabStripModel_ tabContentsAtIndex:(state->state + fetchIndex)];
// }
//
// state->state += fetchIndex;
// state->itemsPtr = stackbuf;
// state->mutationsPtr = self; // TODO
//
// return fetchIndex;
//}


@end
4 changes: 2 additions & 2 deletions src/CTBrowserFrameView.mm
Expand Up @@ -6,7 +6,7 @@

#import <objc/runtime.h>

#import "scoped_nsautorelease_pool.h"
//#import "scoped_nsautorelease_pool.h"
#import "CTBrowserWindow.h"

static const CGFloat kBrowserFrameViewPaintHeight = 60.0;
Expand Down Expand Up @@ -39,7 +39,7 @@ + (void)load {
// others. If they all fail, we will lose window frame theming and
// roll overs for our close widgets, but things should still function
// correctly.
ScopedNSAutoreleasePool pool;
// ScopedNSAutoreleasePool pool;
Class grayFrameClass = NSClassFromString(@"NSGrayFrame");
DCHECK(grayFrameClass);
if (!grayFrameClass) return;
Expand Down
6 changes: 3 additions & 3 deletions src/CTBrowserWindow.mm
Expand Up @@ -62,10 +62,10 @@ - (void)dealloc {
if (widgetTrackingArea_) {
[[self frameView] removeTrackingArea:widgetTrackingArea_];
//widgetTrackingArea_.reset();
[widgetTrackingArea_ release];
// [widgetTrackingArea_ release];
widgetTrackingArea_ = nil;
}
[super dealloc];
// [super dealloc];
}

- (void)setWindowController:(NSWindowController*)controller {
Expand Down Expand Up @@ -230,7 +230,7 @@ - (void)updateTrackingAreas {
// NSTrackingActiveAlways)
// owner:self
// userInfo:nil]);
[widgetTrackingArea_ release];
// [widgetTrackingArea_ release];
widgetTrackingArea_ = [[NSTrackingArea alloc] initWithRect:trackingRect
options:(NSTrackingMouseEnteredAndExited |
NSTrackingActiveAlways)
Expand Down
8 changes: 4 additions & 4 deletions src/CTBrowserWindowController.h
Expand Up @@ -13,17 +13,17 @@
error:(NSError **)outError;
@end

@interface CTBrowserWindowController : CTTabWindowController <CTTabStripModelObserver> {
@interface CTBrowserWindowController : CTTabWindowController /*<CTTabStripModelObserver>*/ {
CTBrowser* browser_; // we own the browser
CTTabStripController *tabStripController_;
CTToolbarController *toolbarController_;
@private
BOOL initializing_; // true if the instance is initializing
}

@property(readonly, nonatomic) CTTabStripController *tabStripController;
@property(readonly, nonatomic) CTToolbarController *toolbarController;
@property(readonly, nonatomic) CTBrowser *browser;
@property(strong, readonly, nonatomic) CTTabStripController *tabStripController;
@property(strong, readonly, nonatomic) CTToolbarController *toolbarController;
@property(strong, readonly, nonatomic) CTBrowser *browser;
@property(readonly, nonatomic) BOOL isFullscreen; // fullscreen or not

// Called to check whether or not this window has a toolbar. By default returns
Expand Down

0 comments on commit 0165827

Please sign in to comment.