diff options
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r-- | chrome/browser/cocoa/base_view.mm | 2 | ||||
-rw-r--r-- | chrome/browser/cocoa/browser_window_cocoa.mm | 10 | ||||
-rw-r--r-- | chrome/browser/cocoa/browser_window_controller.mm | 12 | ||||
-rw-r--r-- | chrome/browser/cocoa/grow_box_view.m | 2 | ||||
-rw-r--r-- | chrome/browser/cocoa/sad_tab_view.mm | 18 | ||||
-rw-r--r-- | chrome/browser/cocoa/tab_contents_controller.h | 2 | ||||
-rw-r--r-- | chrome/browser/cocoa/tab_contents_controller.mm | 16 | ||||
-rw-r--r-- | chrome/browser/cocoa/tab_strip_controller.h | 2 | ||||
-rw-r--r-- | chrome/browser/cocoa/tab_strip_controller.mm | 58 |
9 files changed, 61 insertions, 61 deletions
diff --git a/chrome/browser/cocoa/base_view.mm b/chrome/browser/cocoa/base_view.mm index 9d8e247..9ea74fb 100644 --- a/chrome/browser/cocoa/base_view.mm +++ b/chrome/browser/cocoa/base_view.mm @@ -24,7 +24,7 @@ - (void)dealloc { [self removeTrackingArea:trackingArea_]; [trackingArea_ release]; - + [super dealloc]; } diff --git a/chrome/browser/cocoa/browser_window_cocoa.mm b/chrome/browser/cocoa/browser_window_cocoa.mm index 9d1ae21..0f611b3 100644 --- a/chrome/browser/cocoa/browser_window_cocoa.mm +++ b/chrome/browser/cocoa/browser_window_cocoa.mm @@ -7,7 +7,7 @@ #include "chrome/browser/cocoa/browser_window_cocoa.h" #include "chrome/browser/cocoa/browser_window_controller.h" -BrowserWindowCocoa::BrowserWindowCocoa(BrowserWindowController* controller, +BrowserWindowCocoa::BrowserWindowCocoa(BrowserWindowController* controller, NSWindow* window) : controller_(controller), window_(window) { } @@ -27,7 +27,7 @@ void BrowserWindowCocoa::SetBounds(const gfx::Rect& bounds) { bounds.height()); // flip coordinates NSScreen* screen = [window_ screen]; - cocoa_bounds.origin.y = + cocoa_bounds.origin.y = [screen frame].size.height - bounds.height() - bounds.y(); } @@ -44,7 +44,7 @@ void BrowserWindowCocoa::Activate() { } void BrowserWindowCocoa::FlashFrame() { - [[NSApplication sharedApplication] + [[NSApplication sharedApplication] requestUserAttention:NSInformationalRequest]; } @@ -123,7 +123,7 @@ void BrowserWindowCocoa::UpdateStopGoState(bool is_loading) { void BrowserWindowCocoa::UpdateToolbar(TabContents* contents, bool should_restore_state) { - [controller_ updateToolbarWithContents:contents + [controller_ updateToolbarWithContents:contents shouldRestoreState:should_restore_state ? YES : NO]; } @@ -189,7 +189,7 @@ void BrowserWindowCocoa::ShowHTMLDialog(HtmlDialogContentsDelegate* delegate, void* parent_window) { NOTIMPLEMENTED(); } - + void BrowserWindowCocoa::DestroyBrowser() { [controller_ destroyBrowser]; diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm index 3365812..8779fed 100644 --- a/chrome/browser/cocoa/browser_window_controller.mm +++ b/chrome/browser/cocoa/browser_window_controller.mm @@ -38,11 +38,11 @@ - (void)windowDidLoad { // Create a controller for the tab strip, giving it the model object for // this window's Browser and the tab strip view. The controller will handle - // registering for the appropriate tab notifications from the back-end and + // registering for the appropriate tab notifications from the back-end and // managing the creation of new tabs. - tabStripController_ = + tabStripController_ = [[TabStripController alloc] - initWithView:tabStripView_ + initWithView:tabStripView_ tabModel:browser_->tabstrip_model() toolbarModel:browser_->toolbar_model() commands:browser_->command_updater()]; @@ -67,7 +67,7 @@ // from this method. - (void)windowWillClose:(NSNotification *)notification { DCHECK(!browser_->tabstrip_model()->count()); - + // We can't acutally use |-autorelease| here because there's an embedded // run loop in the |-performClose:| which contains its own autorelease pool. // Instead we use call it after a zero-length delay, which gets us back @@ -150,7 +150,7 @@ // in the coordinate system of the content area of the currently selected tab. // |windowGrowBox| needs to be in the window's coordinate system. - (NSRect)selectedTabGrowBoxRect { - return [tabStripController_ + return [tabStripController_ selectedTabGrowBoxRect]; } @@ -161,7 +161,7 @@ // Called to start/stop the loading animations. - (void)updateLoadingAnimations:(BOOL)animate { if (animate) { - // TODO(pinkerton): determine what throbber animation is necessary and + // TODO(pinkerton): determine what throbber animation is necessary and // start a timer to periodically update. Windows tells the tab strip to // do this. It uses a single timer to coalesce the multiple things that // could be updating. http://crbug.com/8281 diff --git a/chrome/browser/cocoa/grow_box_view.m b/chrome/browser/cocoa/grow_box_view.m index 79f3ca0..d7ace41 100644 --- a/chrome/browser/cocoa/grow_box_view.m +++ b/chrome/browser/cocoa/grow_box_view.m @@ -17,7 +17,7 @@ // Draws the "grow_box" image in our bounds. - (void)drawRect:(NSRect)dirtyRect { - [image_ drawInRect:[self bounds] fromRect:NSZeroRect + [image_ drawInRect:[self bounds] fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0]; } diff --git a/chrome/browser/cocoa/sad_tab_view.mm b/chrome/browser/cocoa/sad_tab_view.mm index eddb505..c74f297 100644 --- a/chrome/browser/cocoa/sad_tab_view.mm +++ b/chrome/browser/cocoa/sad_tab_view.mm @@ -20,17 +20,17 @@ static const int kTitleMessageSpacing = 15; base::SysWideToNSString(l10n_util::GetString(IDS_SAD_TAB_TITLE)); NSString* message = base::SysWideToNSString(l10n_util::GetString(IDS_SAD_TAB_MESSAGE)); - + NSColor* textColor = [NSColor whiteColor]; NSColor* backgroundColor = [NSColor colorWithCalibratedRed:(35.0f/255.0f) green:(48.0f/255.0f) blue:(64.0f/255.0f) alpha:1.0]; - + // Layout NSFont* titleFont = [NSFont boldSystemFontOfSize:[NSFont systemFontSize]]; NSFont* messageFont = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]; - + NSDictionary* titleAttrs = [NSDictionary dictionaryWithObjectsAndKeys: titleFont, NSFontAttributeName, textColor, NSForegroundColorAttributeName, @@ -39,23 +39,23 @@ static const int kTitleMessageSpacing = 15; messageFont, NSFontAttributeName, textColor, NSForegroundColorAttributeName, nil]; - + NSAttributedString* titleString = [[[NSAttributedString alloc] initWithString:title attributes:titleAttrs] autorelease]; NSAttributedString* messageString = [[[NSAttributedString alloc] initWithString:message attributes:messageAttrs] autorelease]; - + NSRect viewBounds = [self bounds]; - + NSSize sadTabImageSize = [sadTabImage size]; CGFloat iconWidth = sadTabImageSize.width; CGFloat iconHeight = sadTabImageSize.height; CGFloat iconX = (viewBounds.size.width - iconWidth) / 2; CGFloat iconY = ((viewBounds.size.height - iconHeight) / 2) - kSadTabOffset; - + NSSize titleSize = [titleString size]; CGFloat titleX = (viewBounds.size.width - titleSize.width) / 2; CGFloat titleY = iconY - kIconTitleSpacing - titleSize.height; @@ -63,11 +63,11 @@ static const int kTitleMessageSpacing = 15; NSSize messageSize = [messageString size]; CGFloat messageX = (viewBounds.size.width - messageSize.width) / 2; CGFloat messageY = titleY - kTitleMessageSpacing - messageSize.height; - + // Paint [backgroundColor set]; NSRectFill(viewBounds); - + [sadTabImage drawAtPoint:NSMakePoint(iconX, iconY) fromRect:NSZeroRect operation:NSCompositeSourceOver diff --git a/chrome/browser/cocoa/tab_contents_controller.h b/chrome/browser/cocoa/tab_contents_controller.h index 2bf021a..bc97e4f 100644 --- a/chrome/browser/cocoa/tab_contents_controller.h +++ b/chrome/browser/cocoa/tab_contents_controller.h @@ -46,7 +46,7 @@ class ToolbarModel; // Create the contents of a tab represented by |contents| and loaded from the // nib given by |name|. |commands| allows tracking of what's enabled and // disabled. It may be nil if no updating is desired. -- (id)initWithNibName:(NSString*)name +- (id)initWithNibName:(NSString*)name bundle:(NSBundle*)bundle contents:(TabContents*)contents commands:(CommandUpdater*)commands diff --git a/chrome/browser/cocoa/tab_contents_controller.mm b/chrome/browser/cocoa/tab_contents_controller.mm index 0700341..f20038e 100644 --- a/chrome/browser/cocoa/tab_contents_controller.mm +++ b/chrome/browser/cocoa/tab_contents_controller.mm @@ -58,7 +58,7 @@ class LocationBarBridge : public LocationBar { virtual std::wstring GetInputString() const; virtual WindowOpenDisposition GetWindowOpenDisposition() const { NOTIMPLEMENTED(); return CURRENT_TAB; } - virtual PageTransition::Type GetPageTransition() const + virtual PageTransition::Type GetPageTransition() const { NOTIMPLEMENTED(); return 0; } virtual void AcceptInput() { NOTIMPLEMENTED(); } virtual void FocusLocation(); @@ -71,7 +71,7 @@ class LocationBarBridge : public LocationBar { @implementation TabContentsController -- (id)initWithNibName:(NSString*)name +- (id)initWithNibName:(NSString*)name bundle:(NSBundle*)bundle contents:(TabContents*)contents commands:(CommandUpdater*)commands @@ -97,7 +97,7 @@ class LocationBarBridge : public LocationBar { - (void)awakeFromNib { [contentsBox_ setContentView:contents_->GetNativeView()]; - + // Provide a starting point since we won't get notifications if the state // doesn't change between tabs. [self updateToolbarCommandStatus]; @@ -185,7 +185,7 @@ class LocationBarBridge : public LocationBar { - (void)updateToolbarWithContents:(TabContents*)tab { // TODO(pinkerton): there's a lot of ui code in autocomplete_edit.cc // that we'll want to duplicate. For now, just handle setting the text. - + // TODO(pinkerton): update the security lock icon and background color NSString* urlString = base::SysWideToNSString(toolbarModel_->GetText()); @@ -217,8 +217,8 @@ class LocationBarBridge : public LocationBar { localGrowBox = [contentView convertRect:localGrowBox fromView:[self view]]; // Flip the rect in view coordinates - localGrowBox.origin.y = - [contentView frame].size.height - localGrowBox.origin.y - + localGrowBox.origin.y = + [contentView frame].size.height - localGrowBox.origin.y - localGrowBox.size.height; } return localGrowBox; @@ -252,9 +252,9 @@ TabContentsCommandObserver::~TabContentsCommandObserver() { commands_->RemoveCommandObserver(this); } -void TabContentsCommandObserver::EnabledStateChangedForCommand(int command, +void TabContentsCommandObserver::EnabledStateChangedForCommand(int command, bool enabled) { - [controller_ enabledStateChangedForCommand:command + [controller_ enabledStateChangedForCommand:command enabled:enabled ? YES : NO]; } diff --git a/chrome/browser/cocoa/tab_strip_controller.h b/chrome/browser/cocoa/tab_strip_controller.h index 8a41c08..bc1f8c0 100644 --- a/chrome/browser/cocoa/tab_strip_controller.h +++ b/chrome/browser/cocoa/tab_strip_controller.h @@ -44,7 +44,7 @@ class ToolbarModel; // Initialize the controller with a view, model, and command updater for // tracking what's enabled and disabled. |commands| may be nil if no updating // is desired. -- (id)initWithView:(TabStripView*)view +- (id)initWithView:(TabStripView*)view tabModel:(TabStripModel*)tabModel toolbarModel:(ToolbarModel*)toolbarModel commands:(CommandUpdater*)commands; diff --git a/chrome/browser/cocoa/tab_strip_controller.mm b/chrome/browser/cocoa/tab_strip_controller.mm index 9f5e544..26717d1 100644 --- a/chrome/browser/cocoa/tab_strip_controller.mm +++ b/chrome/browser/cocoa/tab_strip_controller.mm @@ -20,13 +20,13 @@ const short kTabOverlap = 16; - (void)insertTabWithContents:(TabContents*)contents atIndex:(NSInteger)index inForeground:(bool)inForeground; -- (void)selectTabWithContents:(TabContents*)newContents +- (void)selectTabWithContents:(TabContents*)newContents previousContents:(TabContents*)oldContents atIndex:(NSInteger)index userGesture:(bool)wasUserGesture; - (void)tabDetachedWithContents:(TabContents*)contents atIndex:(NSInteger)index; -- (void)tabChangedWithContents:(TabContents*)contents +- (void)tabChangedWithContents:(TabContents*)contents atIndex:(NSInteger)index; @end @@ -60,7 +60,7 @@ class TabStripBridge : public TabStripModelObserver { @implementation TabStripController -- (id)initWithView:(TabStripView*)view +- (id)initWithView:(TabStripView*)view tabModel:(TabStripModel*)tabModel toolbarModel:(ToolbarModel*)toolbarModel commands:(CommandUpdater*)commands { @@ -72,7 +72,7 @@ class TabStripBridge : public TabStripModelObserver { commands_ = commands; bridge_ = new TabStripBridge(tabModel, self); tabControllerArray_ = [[NSMutableArray alloc] init]; - + // Create the new tab button separate from the nib so we can make sure // it's always at the end of the subview list. NSImage* image = [NSImage imageNamed:@"newtab"]; @@ -100,7 +100,7 @@ class TabStripBridge : public TabStripModelObserver { // out the sole child of the contentArea to display its contents. - (void)swapInTabAtIndex:(NSInteger)index { TabContentsController* controller = [tabControllerArray_ objectAtIndex:index]; - + // Resize the new view to fit the window NSView* contentView = [[tabView_ window] contentView]; NSView* newView = [controller view]; @@ -132,7 +132,7 @@ class TabStripBridge : public TabStripModelObserver { [button setBezelStyle:NSRegularSquareBezelStyle]; [button setTarget:self]; [button setAction:@selector(selectTab:)]; - + return button; } @@ -162,13 +162,13 @@ class TabStripBridge : public TabStripModelObserver { tabModel_->SelectTabContentsAt(index, true); } -// Return the frame for a new tab that will go to the immediate right of the +// Return the frame for a new tab that will go to the immediate right of the // tab at |index|. If |index| is 0, this will be the first tab, indented so // as to not cover the window controls. - (NSRect)frameForNewTabAtIndex:(NSInteger)index { const short kIndentLeavingSpaceForControls = 66; const short kNewTabWidth = 160; - + short xOffset = kIndentLeavingSpaceForControls; if (index > 0) { NSRect previousTab = [[[tabView_ subviews] objectAtIndex:index - 1] frame]; @@ -196,43 +196,43 @@ class TabStripBridge : public TabStripModelObserver { inForeground:(bool)inForeground { DCHECK(contents); DCHECK(index == TabStripModel::kNoTab || tabModel_->ContainsIndex(index)); - + // TODO(pinkerton): handle tab dragging in here // Make a new tab. Load the contents of this tab from the nib and associate // the new controller with |contents| so it can be looked up later. TabContentsController* contentsController = - [[[TabContentsController alloc] initWithNibName:@"TabContents" + [[[TabContentsController alloc] initWithNibName:@"TabContents" bundle:nil contents:contents commands:commands_ toolbarModel:toolbarModel_] autorelease]; [tabControllerArray_ insertObject:contentsController atIndex:index]; - + // Remove the new tab button so the only views present are the tabs, // we'll add it back when we're done [newTabButton_ removeFromSuperview]; - + // Make a new tab view and add it to the strip. // TODO(pinkerton): move everyone else over and animate. Also will need to // move the "add tab" button over. NSRect newTabFrame = [self frameForNewTabAtIndex:index]; NSButton* newView = [self newTabWithFrame:newTabFrame]; [tabView_ addSubview:newView]; - + [self setTabTitle:newView withContents:contents]; - + // Add the new tab button back in to the right of the last tab. const NSInteger kNewTabXOffset = 10; - NSRect lastTab = + NSRect lastTab = [[[tabView_ subviews] objectAtIndex:[[tabView_ subviews] count] - 1] frame]; NSInteger maxRightEdge = NSMaxX(lastTab); NSRect newTabButtonFrame = [newTabButton_ frame]; newTabButtonFrame.origin.x = maxRightEdge + kNewTabXOffset; [newTabButton_ setFrame:newTabButtonFrame]; [tabView_ addSubview:newTabButton_]; - + // Select the newly created tab if in the foreground if (inForeground) [self swapInTabAtIndex:index]; @@ -240,7 +240,7 @@ class TabStripBridge : public TabStripModelObserver { // Called when a notification is received from the model to select a particular // tab. Swaps in the toolbar and content area associated with |newContents|. -- (void)selectTabWithContents:(TabContents*)newContents +- (void)selectTabWithContents:(TabContents*)newContents previousContents:(TabContents*)oldContents atIndex:(NSInteger)index userGesture:(bool)wasUserGesture { @@ -250,7 +250,7 @@ class TabStripBridge : public TabStripModelObserver { NSButton* current = [[tabView_ subviews] objectAtIndex:i]; [current setState:(i == index) ? NSOnState : NSOffState]; } - + // Tell the new tab contents it is about to become the selected tab. Here it // can do things like make sure the toolbar is up to date. TabContentsController* newController = @@ -262,7 +262,7 @@ class TabStripBridge : public TabStripModelObserver { } // Called when a notification is received from the model that the given tab -// has gone away. Remove all knowledge about this tab and it's associated +// has gone away. Remove all knowledge about this tab and it's associated // controller and remove the view from the strip. - (void)tabDetachedWithContents:(TabContents*)contents atIndex:(NSInteger)index { @@ -276,7 +276,7 @@ class TabStripBridge : public TabStripModelObserver { NSView* tab = [[tabView_ subviews] objectAtIndex:index]; NSInteger tabWidth = [tab frame].size.width; [tab removeFromSuperview]; - + // Move all the views to the right the width of the tab that was closed. // TODO(pinkerton): Animate! const int numSubviews = [[tabView_ subviews] count]; @@ -290,11 +290,11 @@ class TabStripBridge : public TabStripModelObserver { // Called when a notification is received from the model that the given tab // has been updated. -- (void)tabChangedWithContents:(TabContents*)contents +- (void)tabChangedWithContents:(TabContents*)contents atIndex:(NSInteger)index { NSButton* tab = [[tabView_ subviews] objectAtIndex:index]; [self setTabTitle:tab withContents:contents]; - + TabContentsController* updatedController = [tabControllerArray_ objectAtIndex:index]; [updatedController tabDidChange:contents]; @@ -309,13 +309,13 @@ class TabStripBridge : public TabStripModelObserver { - (void)updateToolbarWithContents:(TabContents*)tab shouldRestoreState:(BOOL)shouldRestore { // TODO(pinkerton): OS_WIN maintains this, but I'm not sure why. It's - // available by querying the model, which we have available to us. + // available by querying the model, which we have available to us. currentTab_ = tab; - + // tell the appropriate controller to update its state. |shouldRestore| being // YES means we're going back to this tab and should put back any state // associated with it. - TabContentsController* controller = + TabContentsController* controller = [tabControllerArray_ objectAtIndex:tabModel_->GetIndexOfTabContents(tab)]; [controller updateToolbarWithContents:shouldRestore ? tab : nil]; } @@ -364,7 +364,7 @@ class TabStripBridge : public TabStripModelObserver { //-------------------------------------------------------------------------- -TabStripBridge::TabStripBridge(TabStripModel* model, +TabStripBridge::TabStripBridge(TabStripModel* model, TabStripController* controller) : controller_(controller), model_(model) { // Register to be a listener on the model so we can get updates and tell @@ -380,8 +380,8 @@ TabStripBridge::~TabStripBridge() { void TabStripBridge::TabInsertedAt(TabContents* contents, int index, bool foreground) { - [controller_ insertTabWithContents:contents - atIndex:index + [controller_ insertTabWithContents:contents + atIndex:index inForeground:foreground]; } @@ -393,7 +393,7 @@ void TabStripBridge::TabSelectedAt(TabContents* old_contents, TabContents* new_contents, int index, bool user_gesture) { - [controller_ selectTabWithContents:new_contents + [controller_ selectTabWithContents:new_contents previousContents:old_contents atIndex:index userGesture:user_gesture]; |