summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-29 17:58:47 +0000
committerrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-29 17:58:47 +0000
commitaf2fd777dae98b84279707490382002276dfc006 (patch)
tree74e7b41b42f7c92a540f9a108ea176fcbf6817c3
parentdce5df54b85ca90d4bd2d2a04c9f78d3a149072c (diff)
downloadchromium_src-af2fd777dae98b84279707490382002276dfc006.zip
chromium_src-af2fd777dae98b84279707490382002276dfc006.tar.gz
chromium_src-af2fd777dae98b84279707490382002276dfc006.tar.bz2
Removes our homespun grow box and replaces it with the
standard widget. This may also fix some of our resizing issues. BUG=http://crbug.com/14663 TEST=The resizer widget should still work as expected. Review URL: http://codereview.chromium.org/149094 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19501 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/nibs/en.lproj/BrowserWindow.xib4
-rw-r--r--chrome/app/nibs/en.lproj/TabContents.xib31
-rw-r--r--chrome/browser/cocoa/browser_window_controller.mm42
-rw-r--r--chrome/browser/cocoa/tab_contents_controller.h7
-rw-r--r--chrome/browser/cocoa/tab_contents_controller.mm25
-rw-r--r--chrome/browser/cocoa/tab_strip_controller.h6
-rw-r--r--chrome/browser/cocoa/tab_strip_controller.mm17
-rw-r--r--chrome/browser/cocoa/tab_strip_controller_unittest.mm7
8 files changed, 38 insertions, 101 deletions
diff --git a/chrome/app/nibs/en.lproj/BrowserWindow.xib b/chrome/app/nibs/en.lproj/BrowserWindow.xib
index a73b489..306c83d 100644
--- a/chrome/app/nibs/en.lproj/BrowserWindow.xib
+++ b/chrome/app/nibs/en.lproj/BrowserWindow.xib
@@ -8,8 +8,8 @@
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="56"/>
<integer value="1"/>
+ <integer value="56"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -36,7 +36,7 @@
<string key="NSClassName">NSApplication</string>
</object>
<object class="NSWindowTemplate" id="1005">
- <int key="NSWindowStyleMask">4359</int>
+ <int key="NSWindowStyleMask">4367</int>
<int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{60, 229}, {750, 600}}</string>
<int key="NSWTFlags">536872960</int>
diff --git a/chrome/app/nibs/en.lproj/TabContents.xib b/chrome/app/nibs/en.lproj/TabContents.xib
index c985de4..cf88b9c 100644
--- a/chrome/app/nibs/en.lproj/TabContents.xib
+++ b/chrome/app/nibs/en.lproj/TabContents.xib
@@ -2,9 +2,9 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03">
<data>
<int key="IBDocument.SystemTarget">1050</int>
- <string key="IBDocument.SystemVersion">9G55</string>
+ <string key="IBDocument.SystemVersion">9J61</string>
<string key="IBDocument.InterfaceBuilderVersion">677</string>
- <string key="IBDocument.AppKitVersion">949.43</string>
+ <string key="IBDocument.AppKitVersion">949.46</string>
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -100,13 +100,6 @@
<bool key="NSTransparent">NO</bool>
<reference key="NSFillColor2" ref="524635398"/>
</object>
- <object class="NSCustomView" id="995989345">
- <reference key="NSNextResponder" ref="675542922"/>
- <int key="NSvFlags">289</int>
- <string key="NSFrame">{{465, 0}, {15, 15}}</string>
- <reference key="NSSuperview" ref="675542922"/>
- <string key="NSClassName">GrowBoxView</string>
- </object>
</object>
<string key="NSFrameSize">{480, 360}</string>
<reference key="NSSuperview"/>
@@ -135,14 +128,6 @@
</object>
<int key="connectionID">169</int>
</object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">growBox_</string>
- <reference key="source" ref="326691890"/>
- <reference key="destination" ref="995989345"/>
- </object>
- <int key="connectionID">176</int>
- </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -183,7 +168,6 @@
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="753762894"/>
- <reference ref="995989345"/>
</object>
<reference key="parent" ref="886393115"/>
</object>
@@ -201,11 +185,6 @@
</object>
<reference key="parent" ref="675542922"/>
</object>
- <object class="IBObjectRecord">
- <int key="objectID">175</int>
- <reference key="object" ref="995989345"/>
- <reference key="parent" ref="675542922"/>
- </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -216,7 +195,6 @@
<string>-2.IBPluginDependency</string>
<string>-3.IBPluginDependency</string>
<string>164.IBPluginDependency</string>
- <string>175.IBPluginDependency</string>
<string>93.IBEditorWindowLastContentRect</string>
<string>93.IBViewEditorWindowController.showingLayoutRectangles</string>
<string>93.IBWindowTemplateEditedContentRect</string>
@@ -232,10 +210,9 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{769, 584}, {480, 360}}</string>
+ <string>{{769, 496}, {480, 360}}</string>
<boolean value="YES" id="5"/>
- <string>{{769, 584}, {480, 360}}</string>
+ <string>{{769, 496}, {480, 360}}</string>
<reference ref="5"/>
<reference ref="5"/>
<string>{480, 360}</string>
diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm
index 91a356f..6a58402 100644
--- a/chrome/browser/cocoa/browser_window_controller.mm
+++ b/chrome/browser/cocoa/browser_window_controller.mm
@@ -36,6 +36,20 @@ const int kWindowGradientHeight = 24;
}
+@interface NSWindow (NSPrivateApis)
+// Note: These functions are private, use -[NSObject respondsToSelector:]
+// before calling them.
+
+- (void)setAutorecalculatesContentBorderThickness:(BOOL)b
+ forEdge:(NSRectEdge)e;
+- (void)setContentBorderThickness:(CGFloat)b forEdge:(NSRectEdge)e;
+
+- (void)setBottomCornerRounded:(BOOL)rounded;
+
+- (NSRect)_growBoxRect;
+@end
+
+
@interface BrowserWindowController(Private)
- (void)positionToolbar;
@@ -95,6 +109,11 @@ willPositionSheet:(NSWindow *)sheet
// Retain it per the comment in the header.
window_.reset([[self window] retain]);
+ // Sets the window to not have rounded corners, which prevents
+ // the resize control from being inset slightly and looking ugly.
+ if ([window_ respondsToSelector:@selector(setBottomCornerRounded:)])
+ [window_ setBottomCornerRounded:NO];
+
// Since we don't have a standard resize control, Cocoa won't enable the
// zoom (green) button on the titlebar for us. Grab it and enable it
// manually. Note that when launched from XCode, the doesn't work for the
@@ -384,7 +403,17 @@ willPositionSheet:(NSWindow *)sheet
// 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_ selectedTabGrowBoxRect];
+ if (![window_ respondsToSelector:@selector(_growBoxRect)])
+ return NSZeroRect;
+
+ // Before we return a rect, we need to convert it from window coordinates
+ // to tab content area coordinates and flip the coordinate system.
+ NSRect growBoxRect =
+ [[self tabContentArea] convertRect:[window_ _growBoxRect] fromView:nil];
+ growBoxRect.origin.y =
+ [[self tabContentArea] frame].size.height - growBoxRect.size.height -
+ growBoxRect.origin.y;
+ return growBoxRect;
}
// Accept tabs from a BrowserWindowController with the same Profile.
@@ -630,17 +659,6 @@ willPositionSheet:(NSWindow *)sheet
@end
-
-@interface NSWindow (NSPrivateApis)
-// Note: These functions are private, use -[NSObject respondsToSelector:]
-// before calling them.
-
-- (void)setAutorecalculatesContentBorderThickness:(BOOL)b
- forEdge:(NSRectEdge)e;
-- (void)setContentBorderThickness:(CGFloat)b forEdge:(NSRectEdge)e;
-@end
-
-
@implementation BrowserWindowController (Private)
// Position |toolbarView_| below the tab strip, but not as a sibling. The
diff --git a/chrome/browser/cocoa/tab_contents_controller.h b/chrome/browser/cocoa/tab_contents_controller.h
index 123594b..0cd2e2c 100644
--- a/chrome/browser/cocoa/tab_contents_controller.h
+++ b/chrome/browser/cocoa/tab_contents_controller.h
@@ -7,8 +7,6 @@
#include <Cocoa/Cocoa.h>
-@class GrowBoxView;
-
class TabContents;
class TabContentsCommandObserver;
class TabStripModel;
@@ -22,7 +20,6 @@ class TabStripModel;
TabContents* contents_; // weak
IBOutlet NSBox* contentsBox_;
- IBOutlet GrowBoxView* growBox_;
}
// Create the contents of a tab represented by |contents| and loaded from the
@@ -43,10 +40,6 @@ class TabStripModel;
// an entirely new tab contents object.
- (void)tabDidChange:(TabContents*)updatedContents;
-// Return the rect, in WebKit coordinates (flipped), of the window's grow box
-// in the coordinate system of the content area of this tab.
-- (NSRect)growBoxRect;
-
@end
#endif // CHROME_BROWSER_COCOA_TAB_CONTENTS_CONTROLLER_H_
diff --git a/chrome/browser/cocoa/tab_contents_controller.mm b/chrome/browser/cocoa/tab_contents_controller.mm
index 8898a87..a51796d 100644
--- a/chrome/browser/cocoa/tab_contents_controller.mm
+++ b/chrome/browser/cocoa/tab_contents_controller.mm
@@ -58,29 +58,4 @@
}
}
-// Return the rect, in WebKit coordinates (flipped), of the window's grow box
-// in the coordinate system of the content area of this tab.
-- (NSRect)growBoxRect {
- NSRect localGrowBox = NSMakeRect(0, 0, 0, 0);
- NSView* contentView = contents_->GetNativeView();
- if (contentView) {
- // For the rect, we start with the grow box view which is a sibling of
- // the content view's containing box. It's in the coordinate system of
- // the controller view.
- localGrowBox = [growBox_ frame];
- // The scrollbar assumes that the resizer goes all the way down to the
- // bottom corner, so we ignore any y offset to the rect itself and use the
- // entire bottom corner.
- localGrowBox.origin.y = 0;
- // Convert to the content view's coordinates.
- localGrowBox = [contentView convertRect:localGrowBox
- fromView:[self view]];
- // Flip the rect in view coordinates
- localGrowBox.origin.y =
- [contentView frame].size.height - localGrowBox.origin.y -
- localGrowBox.size.height;
- }
- return localGrowBox;
-}
-
@end
diff --git a/chrome/browser/cocoa/tab_strip_controller.h b/chrome/browser/cocoa/tab_strip_controller.h
index 6004768..dea418d 100644
--- a/chrome/browser/cocoa/tab_strip_controller.h
+++ b/chrome/browser/cocoa/tab_strip_controller.h
@@ -54,7 +54,7 @@ class ToolbarModel;
CGFloat placeholderStretchiness_; // Vertical force shown by streching tab.
// Frame targets for all the current views.
// target frames are used because repeated requests to [NSView animator].
- // aren't coalesced, so we store frames to avoid redundant calls.
+ // aren't coalesced, so we store frames to avoid redundant calls.
scoped_nsobject<NSMutableDictionary> targetFrames_;
NSRect newTabTargetFrame_;
}
@@ -68,10 +68,6 @@ class ToolbarModel;
switchView:(NSView*)switchView
model:(TabStripModel*)model;
-// Return the rect, in WebKit coordinates (flipped), of the window's grow box
-// in the coordinate system of the content area of the currently selected tab.
-- (NSRect)selectedTabGrowBoxRect;
-
// Return the view for the currently selected tab.
- (NSView *)selectedTabView;
diff --git a/chrome/browser/cocoa/tab_strip_controller.mm b/chrome/browser/cocoa/tab_strip_controller.mm
index eae1bbb..0bf6a59 100644
--- a/chrome/browser/cocoa/tab_strip_controller.mm
+++ b/chrome/browser/cocoa/tab_strip_controller.mm
@@ -579,21 +579,4 @@ NSString* const kTabStripNumberOfTabsChanged = @"kTabStripNumberOfTabsChanged";
tabModel_->InsertTabContentsAt(index, contents, true, false);
}
-// Return the rect, in WebKit coordinates (flipped), of the window's grow box
-// in the coordinate system of the content area of the currently selected tab.
-- (NSRect)selectedTabGrowBoxRect {
- int selectedIndex = tabModel_->selected_index();
- if (selectedIndex == TabStripModel::kNoTab) {
- // When the window is initially being constructed, there may be no currently
- // selected tab, so pick the first one. If there aren't any, just bail with
- // an empty rect.
- selectedIndex = 0;
- }
- TabContentsController* selectedController =
- [tabContentsArray_ objectAtIndex:selectedIndex];
- if (!selectedController)
- return NSZeroRect;
- return [selectedController growBoxRect];
-}
-
@end
diff --git a/chrome/browser/cocoa/tab_strip_controller_unittest.mm b/chrome/browser/cocoa/tab_strip_controller_unittest.mm
index 7470bb9..71eeba5 100644
--- a/chrome/browser/cocoa/tab_strip_controller_unittest.mm
+++ b/chrome/browser/cocoa/tab_strip_controller_unittest.mm
@@ -96,11 +96,6 @@ class TabStripControllerTest : public testing::Test {
scoped_nsobject<NSView> tab_strip_;
};
-TEST_F(TabStripControllerTest, GrowBox) {
- // TODO(pinkerton): Creating a TabContents crashes an unrelated test, even
- // if you don't do anything with it. http://crbug.com/10899
-}
-
// Test adding and removing tabs and making sure that views get added to
// the tab strip.
TEST_F(TabStripControllerTest, AddRemoveTabs) {
@@ -127,7 +122,7 @@ TEST_F(TabStripControllerTest, RearrangeTabs) {
// if you don't do anything with it. http://crbug.com/10899
}
-// Test that changing the number of tabs broadcasts a
+// Test that changing the number of tabs broadcasts a
// kTabStripNumberOfTabsChanged notifiction.
TEST_F(TabStripControllerTest, Notifications) {
// TODO(pinkerton): Creating a TabContents crashes an unrelated test, even