summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/common.gypi1
-rw-r--r--chrome/browser/cocoa/browser_window_controller.h16
-rw-r--r--chrome/browser/cocoa/browser_window_controller.mm33
3 files changed, 25 insertions, 25 deletions
diff --git a/build/common.gypi b/build/common.gypi
index d80242c..8327758 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -269,6 +269,7 @@
'GCC_DYNAMIC_NO_PIC': 'YES',
'GCC_ENABLE_PASCAL_STRINGS': 'NO',
'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
+ 'GCC_OBJC_CALL_CXX_CDTORS': 'YES',
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES',
'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES',
'GCC_VERSION': '4.2',
diff --git a/chrome/browser/cocoa/browser_window_controller.h b/chrome/browser/cocoa/browser_window_controller.h
index df77819..a88b3c8 100644
--- a/chrome/browser/cocoa/browser_window_controller.h
+++ b/chrome/browser/cocoa/browser_window_controller.h
@@ -6,10 +6,14 @@
#define CHROME_BROWSER_COCOA_BROWSER_WINDOW_CONTROLLER_H_
// A class acting as the Objective-C controller for the Browser object. Handles
-// interactions between Cocoa and the cross-platform code.
+// interactions between Cocoa and the cross-platform code. Each window has a
+// single set of toolbars (main toolbar, bookmark bar, etc) and, by virtue of
+// being a TabWindowController, a tab strip along the top.
#import <Cocoa/Cocoa.h>
+#include "base/scoped_nsobject.h"
+#include "base/scoped_ptr.h"
#import "chrome/browser/cocoa/tab_window_controller.h"
#import "chrome/browser/cocoa/toolbar_view.h"
@@ -27,11 +31,11 @@ class TabStripModelObserverBridge;
@interface BrowserWindowController :
TabWindowController<NSUserInterfaceValidations> {
@private
- TabStripController* tabStripController_;
- ToolbarController* toolbarController_;
- Browser* browser_;
- TabStripModelObserverBridge* tabObserver_;
- BrowserWindowCocoa* windowShim_;
+ scoped_nsobject<TabStripController> tabStripController_;
+ scoped_nsobject<ToolbarController> toolbarController_;
+ scoped_ptr<Browser> browser_;
+ scoped_ptr<TabStripModelObserverBridge> tabObserver_;
+ scoped_ptr<BrowserWindowCocoa> windowShim_;
}
// Load the browser window nib and do any Cocoa-specific initialization.
diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm
index fc1e0ec..f076e26 100644
--- a/chrome/browser/cocoa/browser_window_controller.mm
+++ b/chrome/browser/cocoa/browser_window_controller.mm
@@ -27,11 +27,11 @@
// up as the window's delegate.
- (id)initWithBrowser:(Browser*)browser {
if ((self = [super initWithWindowNibName:@"BrowserWindow"])) {
- browser_ = browser;
- DCHECK(browser_);
- tabObserver_ = new TabStripModelObserverBridge(browser->tabstrip_model(),
- self);
- windowShim_ = new BrowserWindowCocoa(browser, self, [self window]);
+ DCHECK(browser);
+ browser_.reset(browser);
+ tabObserver_.reset(
+ new TabStripModelObserverBridge(browser->tabstrip_model(), self));
+ windowShim_.reset(new BrowserWindowCocoa(browser, self, [self window]));
// The window is now fully realized and |-windowDidLoad:| has been
// called. We shouldn't do much in wDL because |windowShim_| won't yet
@@ -46,17 +46,17 @@
// this window's Browser and the tab strip view. The controller will handle
// registering for the appropriate tab notifications from the back-end and
// managing the creation of new tabs.
- tabStripController_ = [[TabStripController alloc]
- initWithView:[self tabStripView]
- switchView:[self tabContentArea]
- browser:browser_];
+ tabStripController_.reset([[TabStripController alloc]
+ initWithView:[self tabStripView]
+ switchView:[self tabContentArea]
+ browser:browser_.get()]);
// Create a controller for the toolbar, giving it the toolbar model object
// and the toolbar view from the nib. The controller will handle
// registering for the appropriate command state changes from the back-end.
- toolbarController_ = [[ToolbarController alloc]
- initWithModel:browser->toolbar_model()
- commands:browser->command_updater()];
+ toolbarController_.reset([[ToolbarController alloc]
+ initWithModel:browser->toolbar_model()
+ commands:browser->command_updater()]);
[self positionToolbar];
}
return self;
@@ -64,17 +64,12 @@
- (void)dealloc {
browser_->CloseAllTabs();
- [tabStripController_ release];
- [toolbarController_ release];
- delete windowShim_;
- delete tabObserver_;
- delete browser_;
[super dealloc];
}
// Access the C++ bridge between the NSWindow and the rest of Chromium
- (BrowserWindow*)browserWindow {
- return windowShim_;
+ return windowShim_.get();
}
// Position |toolbarView_| below the tab strip, but not as a sibling. The
@@ -147,7 +142,7 @@
// Called right after our window became the main window.
- (void)windowDidBecomeMain:(NSNotification *)notification {
- BrowserList::SetLastActive(browser_);
+ BrowserList::SetLastActive(browser_.get());
}
// Update a toggle state for an NSMenuItem if modified.