diff options
-rw-r--r-- | chrome/app/nibs/en.lproj/BrowserWindow.xib | 128 | ||||
-rw-r--r-- | chrome/app/nibs/en.lproj/TabContents.xib | 573 | ||||
-rw-r--r-- | chrome/app/nibs/en.lproj/Toolbar.xib | 695 | ||||
-rw-r--r-- | chrome/browser/cocoa/browser_window_controller.h | 3 | ||||
-rw-r--r-- | chrome/browser/cocoa/browser_window_controller.mm | 54 | ||||
-rw-r--r-- | chrome/browser/cocoa/command_observer_bridge.h | 41 | ||||
-rw-r--r-- | chrome/browser/cocoa/command_observer_bridge.mm | 26 | ||||
-rw-r--r-- | chrome/browser/cocoa/tab_contents_controller.h | 36 | ||||
-rw-r--r-- | chrome/browser/cocoa/tab_contents_controller.mm | 147 | ||||
-rw-r--r-- | chrome/browser/cocoa/tab_strip_controller.h | 27 | ||||
-rw-r--r-- | chrome/browser/cocoa/tab_strip_controller.mm | 63 | ||||
-rw-r--r-- | chrome/browser/cocoa/tab_window_controller.h | 18 | ||||
-rw-r--r-- | chrome/browser/cocoa/tab_window_controller.mm | 26 | ||||
-rw-r--r-- | chrome/browser/cocoa/toolbar_controller.h | 60 | ||||
-rw-r--r-- | chrome/browser/cocoa/toolbar_controller.mm | 123 | ||||
-rw-r--r-- | chrome/chrome.gyp | 5 |
16 files changed, 1117 insertions, 908 deletions
diff --git a/chrome/app/nibs/en.lproj/BrowserWindow.xib b/chrome/app/nibs/en.lproj/BrowserWindow.xib index dd5073b..d9a64e8 100644 --- a/chrome/app/nibs/en.lproj/BrowserWindow.xib +++ b/chrome/app/nibs/en.lproj/BrowserWindow.xib @@ -8,7 +8,7 @@ <string key="IBDocument.HIToolboxVersion">352.00</string> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="56"/> + <integer value="2"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -44,62 +44,26 @@ <nil key="NSViewClass"/> <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <object class="NSView" key="NSWindowView" id="1006"> - <nil key="NSNextResponder"/> + <reference key="NSNextResponder"/> <int key="NSvFlags">256</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSBox" id="332491870"> + <object class="NSCustomView" id="1858870"> <reference key="NSNextResponder" ref="1006"/> - <int key="NSvFlags">18</int> - <object class="NSMutableArray" key="NSSubviews"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSView" id="734052543"> - <reference key="NSNextResponder" ref="332491870"/> - <int key="NSvFlags">256</int> - <string key="NSFrameSize">{750, 586}</string> - <reference key="NSSuperview" ref="332491870"/> - </object> - </object> + <int key="NSvFlags">274</int> <string key="NSFrameSize">{750, 586}</string> <reference key="NSSuperview" ref="1006"/> - <string key="NSOffsets">{0, 0}</string> - <object class="NSTextFieldCell" key="NSTitleCell"> - <int key="NSCellFlags">67239424</int> - <int key="NSCellFlags2">0</int> - <string key="NSContents">Box</string> - <object class="NSFont" key="NSSupport"> - <string key="NSName">LucidaGrande</string> - <double key="NSSize">1.100000e+01</double> - <int key="NSfFlags">3100</int> - </object> - <object class="NSColor" key="NSBackgroundColor"> - <int key="NSColorSpace">6</int> - <string key="NSCatalogName">System</string> - <string key="NSColorName">textBackgroundColor</string> - <object class="NSColor" key="NSColor"> - <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MQA</bytes> - </object> - </object> - <object class="NSColor" key="NSTextColor"> - <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MCAwLjgwMDAwMDAxAA</bytes> - </object> - </object> - <reference key="NSContentView" ref="734052543"/> - <int key="NSBorderType">0</int> - <int key="NSBoxType">4</int> - <int key="NSTitlePosition">0</int> - <bool key="NSTransparent">NO</bool> + <string key="NSClassName">NSView</string> </object> </object> <string key="NSFrameSize">{750, 600}</string> + <reference key="NSSuperview"/> </object> <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string> <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> </object> <object class="NSCustomView" id="1029219716"> - <reference key="NSNextResponder"/> + <nil key="NSNextResponder"/> <int key="NSvFlags">266</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -133,7 +97,6 @@ </object> </object> <string key="NSFrameSize">{483, 25}</string> - <reference key="NSSuperview"/> <string key="NSClassName">TabStripView</string> </object> </object> @@ -158,19 +121,19 @@ </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> - <string key="label">contentBox_</string> + <string key="label">tabStripView_</string> <reference key="source" ref="1001"/> - <reference key="destination" ref="332491870"/> + <reference key="destination" ref="1029219716"/> </object> - <int key="connectionID">63</int> + <int key="connectionID">65</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> - <string key="label">tabStripView_</string> + <string key="label">tabContentArea_</string> <reference key="source" ref="1001"/> - <reference key="destination" ref="1029219716"/> + <reference key="destination" ref="1858870"/> </object> - <int key="connectionID">65</int> + <int key="connectionID">86</int> </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> @@ -217,16 +180,11 @@ <reference key="object" ref="1006"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="332491870"/> + <reference ref="1858870"/> </object> <reference key="parent" ref="1005"/> </object> <object class="IBObjectRecord"> - <int key="objectID">55</int> - <reference key="object" ref="332491870"/> - <reference key="parent" ref="1006"/> - </object> - <object class="IBObjectRecord"> <int key="objectID">56</int> <reference key="object" ref="1029219716"/> <object class="NSMutableArray" key="children"> @@ -250,6 +208,11 @@ <reference key="object" ref="517448702"/> <reference key="parent" ref="131944810"/> </object> + <object class="IBObjectRecord"> + <int key="objectID">84</int> + <reference key="object" ref="1858870"/> + <reference key="parent" ref="1006"/> + </object> </object> </object> <object class="NSMutableDictionary" key="flattenedProperties"> @@ -270,11 +233,11 @@ <string>2.IBViewIntegration.shadowColor</string> <string>2.IBViewIntegration.shadowOffsetHeight</string> <string>2.IBViewIntegration.shadowOffsetWidth</string> - <string>55.IBPluginDependency</string> <string>56.IBEditorWindowLastContentRect</string> <string>56.IBPluginDependency</string> <string>66.IBPluginDependency</string> <string>67.IBPluginDependency</string> + <string>84.IBPluginDependency</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -295,11 +258,11 @@ </object> <real value="0.000000e+00"/> <real value="0.000000e+00"/> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{160, 204}, {483, 25}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> </object> </object> <object class="NSMutableDictionary" key="unlocalizedProperties"> @@ -322,31 +285,14 @@ </object> </object> <nil key="sourceID"/> - <int key="maxID">67</int> + <int key="maxID">86</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBPartialClassDescription"> <string key="className">BrowserWindowController</string> - <string key="superclassName">NSWindowController</string> - <object class="NSMutableDictionary" key="outlets"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>contentBox_</string> - <string>tabStripView_</string> - <string>toolbarView_</string> - <string>urlBarView_</string> - </object> - <object class="NSMutableArray" key="dict.values"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>NSBox</string> - <string>TabStripView</string> - <string>NSView</string> - <string>NSTextField</string> - </object> - </object> + <string key="superclassName">TabWindowController</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBProjectSource</string> <string key="minorKey">browser/cocoa/browser_window_controller.h</string> @@ -365,6 +311,13 @@ </object> </object> <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">browser/cocoa/tab_strip_model_observer_bridge.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> <string key="className">TabStripView</string> <string key="superclassName">NSView</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> @@ -372,6 +325,27 @@ <string key="minorKey">browser/cocoa/tab_strip_view.h</string> </object> </object> + <object class="IBPartialClassDescription"> + <string key="className">TabWindowController</string> + <string key="superclassName">NSWindowController</string> + <object class="NSMutableDictionary" key="outlets"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>tabContentArea_</string> + <string>tabStripView_</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>NSView</string> + <string>TabStripView</string> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">browser/cocoa/tab_window_controller.h</string> + </object> + </object> </object> </object> <int key="IBDocument.localizationMode">0</int> diff --git a/chrome/app/nibs/en.lproj/TabContents.xib b/chrome/app/nibs/en.lproj/TabContents.xib index 7f6d0b1..154a722 100644 --- a/chrome/app/nibs/en.lproj/TabContents.xib +++ b/chrome/app/nibs/en.lproj/TabContents.xib @@ -2,13 +2,13 @@ <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">9F33</string> <string key="IBDocument.InterfaceBuilderVersion">677</string> - <string key="IBDocument.AppKitVersion">949.43</string> - <string key="IBDocument.HIToolboxVersion">353.00</string> + <string key="IBDocument.AppKitVersion">949.34</string> + <string key="IBDocument.HIToolboxVersion">352.00</string> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="164"/> + <integer value="94"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -58,7 +58,7 @@ <object class="NSCustomView" id="741487837"> <reference key="NSNextResponder" ref="675542922"/> <int key="NSvFlags">266</int> - <string key="NSFrame">{{0, 284}, {480, 38}}</string> + <string key="NSFrame">{{0, 322}, {480, 38}}</string> <reference key="NSSuperview" ref="675542922"/> <string key="NSClassName">ToolbarView</string> </object> @@ -70,11 +70,11 @@ <object class="NSView" id="250835567"> <reference key="NSNextResponder" ref="753762894"/> <int key="NSvFlags">256</int> - <string key="NSFrameSize">{480, 322}</string> + <string key="NSFrameSize">{480, 360}</string> <reference key="NSSuperview" ref="753762894"/> </object> </object> - <string key="NSFrameSize">{480, 322}</string> + <string key="NSFrameSize">{480, 360}</string> <reference key="NSSuperview" ref="675542922"/> <string key="NSOffsets">{0, 0}</string> <object class="NSTextFieldCell" key="NSTitleCell"> @@ -86,7 +86,7 @@ <double key="NSSize">1.100000e+01</double> <int key="NSfFlags">3100</int> </object> - <object class="NSColor" key="NSBackgroundColor" id="619004855"> + <object class="NSColor" key="NSBackgroundColor"> <int key="NSColorSpace">6</int> <string key="NSCatalogName">System</string> <string key="NSColorName">textBackgroundColor</string> @@ -107,228 +107,6 @@ <bool key="NSTransparent">NO</bool> <reference key="NSFillColor2" ref="524635398"/> </object> - <object class="NSCustomView" id="588745489"> - <reference key="NSNextResponder" ref="675542922"/> - <int key="NSvFlags">266</int> - <object class="NSMutableArray" key="NSSubviews"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSButton" id="17343997"> - <reference key="NSNextResponder" ref="588745489"/> - <int key="NSvFlags">265</int> - <string key="NSFrame">{{411, 5}, {24, 27}}</string> - <reference key="NSSuperview" ref="588745489"/> - <bool key="NSEnabled">YES</bool> - <object class="NSButtonCell" key="NSCell" id="145095454"> - <int key="NSCellFlags">67239424</int> - <int key="NSCellFlags2">134217728</int> - <string key="NSContents"/> - <object class="NSFont" key="NSSupport" id="573615954"> - <string key="NSName">LucidaGrande</string> - <double key="NSSize">1.300000e+01</double> - <int key="NSfFlags">1044</int> - </object> - <reference key="NSControlView" ref="17343997"/> - <int key="NSButtonFlags">105136383</int> - <int key="NSButtonFlags2">134</int> - <object class="NSCustomResource" key="NSNormalImage"> - <string key="NSClassName">NSImage</string> - <string key="NSResourceName">NSEnterFullScreenTemplate</string> - </object> - <object class="NSCustomResource" key="NSAlternateImage"> - <string key="NSClassName">NSImage</string> - <string key="NSResourceName">NSExitFullScreenTemplate</string> - </object> - <string key="NSAlternateContents"/> - <string key="NSKeyEquivalent"/> - <int key="NSPeriodicDelay">400</int> - <int key="NSPeriodicInterval">75</int> - </object> - </object> - <object class="NSTextField" id="146626462"> - <reference key="NSNextResponder" ref="588745489"/> - <int key="NSvFlags">266</int> - <string key="NSFrame">{{131, 5}, {308, 27}}</string> - <reference key="NSSuperview" ref="588745489"/> - <int key="NSTag">33004</int> - <bool key="NSEnabled">YES</bool> - <object class="NSTextFieldCell" key="NSCell" id="971876011"> - <int key="NSCellFlags">-1804468671</int> - <int key="NSCellFlags2">33792</int> - <object class="NSAttributedString" key="NSContents"> - <string key="NSString">chromium.org</string> - <object class="NSDictionary" key="NSAttributes"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>NSColor</string> - <string>NSFont</string> - <string>NSOriginalFont</string> - <string>NSParagraphStyle</string> - </object> - <object class="NSMutableArray" key="dict.values"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSColor" id="821614029"> - <int key="NSColorSpace">6</int> - <string key="NSCatalogName">System</string> - <string key="NSColorName">textColor</string> - <object class="NSColor" key="NSColor"> - <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MAA</bytes> - </object> - </object> - <object class="NSFont" id="632923964"> - <string key="NSName">LucidaGrande</string> - <double key="NSSize">1.600000e+01</double> - <int key="NSfFlags">16</int> - </object> - <reference ref="632923964"/> - <object class="NSMutableParagraphStyle"> - <nil key="NSTabStops"/> - </object> - </object> - </object> - </object> - <reference key="NSSupport" ref="632923964"/> - <reference key="NSControlView" ref="146626462"/> - <bool key="NSDrawsBackground">YES</bool> - <reference key="NSBackgroundColor" ref="619004855"/> - <reference key="NSTextColor" ref="821614029"/> - </object> - </object> - <object class="NSButton" id="574811940"> - <reference key="NSNextResponder" ref="588745489"/> - <int key="NSvFlags">268</int> - <string key="NSFrame">{{102, 4}, {29, 29}}</string> - <reference key="NSSuperview" ref="588745489"/> - <int key="NSTag">35000</int> - <bool key="NSEnabled">YES</bool> - <object class="NSButtonCell" key="NSCell" id="279099892"> - <int key="NSCellFlags">67239424</int> - <int key="NSCellFlags2">134250496</int> - <string key="NSContents"/> - <reference key="NSSupport" ref="573615954"/> - <int key="NSTag">-1</int> - <reference key="NSControlView" ref="574811940"/> - <int key="NSButtonFlags">-2030812929</int> - <int key="NSButtonFlags2">6</int> - <object class="NSCustomResource" key="NSNormalImage"> - <string key="NSClassName">NSImage</string> - <string key="NSResourceName">star</string> - </object> - <string key="NSAlternateContents"/> - <string key="NSKeyEquivalent"/> - <int key="NSPeriodicDelay">400</int> - <int key="NSPeriodicInterval">75</int> - </object> - </object> - <object class="NSButton" id="1046981093"> - <reference key="NSNextResponder" ref="588745489"/> - <int key="NSvFlags">268</int> - <string key="NSFrame">{{67, 4}, {31, 29}}</string> - <reference key="NSSuperview" ref="588745489"/> - <int key="NSTag">33002</int> - <bool key="NSEnabled">YES</bool> - <object class="NSButtonCell" key="NSCell" id="352237189"> - <int key="NSCellFlags">67239424</int> - <int key="NSCellFlags2">134250496</int> - <string key="NSContents"/> - <reference key="NSSupport" ref="573615954"/> - <reference key="NSControlView" ref="1046981093"/> - <int key="NSButtonFlags">-2033434369</int> - <int key="NSButtonFlags2">6</int> - <object class="NSCustomResource" key="NSNormalImage"> - <string key="NSClassName">NSImage</string> - <string key="NSResourceName">reload</string> - </object> - <string key="NSAlternateContents"/> - <string key="NSKeyEquivalent"/> - <int key="NSPeriodicDelay">400</int> - <int key="NSPeriodicInterval">75</int> - </object> - </object> - <object class="NSButton" id="131791940"> - <reference key="NSNextResponder" ref="588745489"/> - <int key="NSvFlags">268</int> - <string key="NSFrame">{{34, 4}, {28, 29}}</string> - <reference key="NSSuperview" ref="588745489"/> - <int key="NSTag">33001</int> - <bool key="NSEnabled">YES</bool> - <object class="NSButtonCell" key="NSCell" id="616960232"> - <int key="NSCellFlags">-2080244224</int> - <int key="NSCellFlags2">134250496</int> - <string key="NSContents"/> - <reference key="NSSupport" ref="573615954"/> - <int key="NSTag">1</int> - <reference key="NSControlView" ref="131791940"/> - <int key="NSButtonFlags">-2031337217</int> - <int key="NSButtonFlags2">6</int> - <object class="NSCustomResource" key="NSNormalImage"> - <string key="NSClassName">NSImage</string> - <string key="NSResourceName">forward</string> - </object> - <string key="NSAlternateContents"/> - <string key="NSKeyEquivalent"/> - <int key="NSPeriodicDelay">400</int> - <int key="NSPeriodicInterval">75</int> - </object> - </object> - <object class="NSButton" id="213122875"> - <reference key="NSNextResponder" ref="588745489"/> - <int key="NSvFlags">268</int> - <string key="NSFrame">{{6, 4}, {29, 29}}</string> - <reference key="NSSuperview" ref="588745489"/> - <int key="NSTag">33000</int> - <bool key="NSEnabled">YES</bool> - <object class="NSButtonCell" key="NSCell" id="599914932"> - <int key="NSCellFlags">67239424</int> - <int key="NSCellFlags2">134250496</int> - <string key="NSContents"/> - <reference key="NSSupport" ref="573615954"/> - <int key="NSTag">-2</int> - <reference key="NSControlView" ref="213122875"/> - <int key="NSButtonFlags">-2030288641</int> - <int key="NSButtonFlags2">6</int> - <object class="NSCustomResource" key="NSNormalImage"> - <string key="NSClassName">NSImage</string> - <string key="NSResourceName">back</string> - </object> - <string key="NSAlternateContents"/> - <string key="NSKeyEquivalent"/> - <int key="NSPeriodicDelay">400</int> - <int key="NSPeriodicInterval">75</int> - </object> - </object> - <object class="NSButton" id="742185090"> - <reference key="NSNextResponder" ref="588745489"/> - <int key="NSvFlags">265</int> - <string key="NSFrame">{{439, 4}, {29, 29}}</string> - <reference key="NSSuperview" ref="588745489"/> - <int key="NSTag">33005</int> - <bool key="NSEnabled">YES</bool> - <object class="NSButtonCell" key="NSCell" id="932073098"> - <int key="NSCellFlags">67239424</int> - <int key="NSCellFlags2">134250496</int> - <string key="NSContents"/> - <reference key="NSSupport" ref="573615954"/> - <int key="NSTag">1</int> - <reference key="NSControlView" ref="742185090"/> - <int key="NSButtonFlags">-2031861505</int> - <int key="NSButtonFlags2">6</int> - <object class="NSCustomResource" key="NSNormalImage"> - <string key="NSClassName">NSImage</string> - <string key="NSResourceName">go</string> - </object> - <string key="NSAlternateContents"/> - <string key="NSKeyEquivalent"/> - <int key="NSPeriodicDelay">400</int> - <int key="NSPeriodicInterval">75</int> - </object> - </object> - </object> - <string key="NSFrame">{{0, 322}, {480, 38}}</string> - <reference key="NSSuperview" ref="675542922"/> - <string key="NSClassName">ToolbarView</string> - </object> <object class="NSCustomView" id="995989345"> <reference key="NSNextResponder" ref="675542922"/> <int key="NSvFlags">289</int> @@ -349,14 +127,6 @@ <object class="NSMutableArray" key="connectionRecords"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> - <string key="label">fullScreen:</string> - <reference key="source" ref="326691890"/> - <reference key="destination" ref="17343997"/> - </object> - <int key="connectionID">139</int> - </object> - <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">view</string> <reference key="source" ref="326691890"/> @@ -366,86 +136,6 @@ </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> - <string key="label">locationBar_</string> - <reference key="source" ref="326691890"/> - <reference key="destination" ref="146626462"/> - </object> - <int key="connectionID">157</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> - <string key="label">commandDispatch:</string> - <reference key="source" ref="865634543"/> - <reference key="destination" ref="213122875"/> - </object> - <int key="connectionID">158</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> - <string key="label">commandDispatch:</string> - <reference key="source" ref="865634543"/> - <reference key="destination" ref="131791940"/> - </object> - <int key="connectionID">159</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> - <string key="label">commandDispatch:</string> - <reference key="source" ref="865634543"/> - <reference key="destination" ref="1046981093"/> - </object> - <int key="connectionID">160</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> - <string key="label">commandDispatch:</string> - <reference key="source" ref="865634543"/> - <reference key="destination" ref="574811940"/> - </object> - <int key="connectionID">161</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> - <string key="label">commandDispatch:</string> - <reference key="source" ref="865634543"/> - <reference key="destination" ref="742185090"/> - </object> - <int key="connectionID">162</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> - <string key="label">commandDispatch:</string> - <reference key="source" ref="865634543"/> - <reference key="destination" ref="146626462"/> - </object> - <int key="connectionID">163</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> - <string key="label">backButton_</string> - <reference key="source" ref="326691890"/> - <reference key="destination" ref="213122875"/> - </object> - <int key="connectionID">165</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> - <string key="label">forwardButton_</string> - <reference key="source" ref="326691890"/> - <reference key="destination" ref="131791940"/> - </object> - <int key="connectionID">166</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> - <string key="label">starButton_</string> - <reference key="source" ref="326691890"/> - <reference key="destination" ref="574811940"/> - </object> - <int key="connectionID">168</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> <string key="label">contentsBox_</string> <reference key="source" ref="326691890"/> <reference key="destination" ref="753762894"/> @@ -462,22 +152,6 @@ </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> - <string key="label">reloadButton_</string> - <reference key="source" ref="326691890"/> - <reference key="destination" ref="1046981093"/> - </object> - <int key="connectionID">177</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> - <string key="label">goButton_</string> - <reference key="source" ref="326691890"/> - <reference key="destination" ref="742185090"/> - </object> - <int key="connectionID">178</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> <string key="label">bookmarkView_</string> <reference key="source" ref="326691890"/> <reference key="destination" ref="741487837"/> @@ -523,7 +197,6 @@ <reference key="object" ref="675542922"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="588745489"/> <reference ref="753762894"/> <reference ref="995989345"/> <reference ref="741487837"/> @@ -537,119 +210,6 @@ <string key="objectName">Application</string> </object> <object class="IBObjectRecord"> - <int key="objectID">112</int> - <reference key="object" ref="588745489"/> - <object class="NSMutableArray" key="children"> - <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="213122875"/> - <reference ref="1046981093"/> - <reference ref="146626462"/> - <reference ref="742185090"/> - <reference ref="17343997"/> - <reference ref="131791940"/> - <reference ref="574811940"/> - </object> - <reference key="parent" ref="675542922"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">117</int> - <reference key="object" ref="146626462"/> - <object class="NSMutableArray" key="children"> - <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="971876011"/> - </object> - <reference key="parent" ref="588745489"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">118</int> - <reference key="object" ref="971876011"/> - <reference key="parent" ref="146626462"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">124</int> - <reference key="object" ref="574811940"/> - <object class="NSMutableArray" key="children"> - <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="279099892"/> - </object> - <reference key="parent" ref="588745489"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">125</int> - <reference key="object" ref="279099892"/> - <reference key="parent" ref="574811940"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">126</int> - <reference key="object" ref="1046981093"/> - <object class="NSMutableArray" key="children"> - <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="352237189"/> - </object> - <reference key="parent" ref="588745489"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">127</int> - <reference key="object" ref="352237189"/> - <reference key="parent" ref="1046981093"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">128</int> - <reference key="object" ref="131791940"/> - <object class="NSMutableArray" key="children"> - <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="616960232"/> - </object> - <reference key="parent" ref="588745489"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">129</int> - <reference key="object" ref="616960232"/> - <reference key="parent" ref="131791940"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">130</int> - <reference key="object" ref="213122875"/> - <object class="NSMutableArray" key="children"> - <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="599914932"/> - </object> - <reference key="parent" ref="588745489"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">131</int> - <reference key="object" ref="599914932"/> - <reference key="parent" ref="213122875"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">132</int> - <reference key="object" ref="742185090"/> - <object class="NSMutableArray" key="children"> - <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="932073098"/> - </object> - <reference key="parent" ref="588745489"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">133</int> - <reference key="object" ref="932073098"/> - <reference key="parent" ref="742185090"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">137</int> - <reference key="object" ref="17343997"/> - <object class="NSMutableArray" key="children"> - <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="145095454"/> - </object> - <reference key="parent" ref="588745489"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">138</int> - <reference key="object" ref="145095454"/> - <reference key="parent" ref="17343997"/> - </object> - <object class="IBObjectRecord"> <int key="objectID">164</int> <reference key="object" ref="753762894"/> <object class="NSMutableArray" key="children"> @@ -679,26 +239,6 @@ <string>-1.IBPluginDependency</string> <string>-2.IBPluginDependency</string> <string>-3.IBPluginDependency</string> - <string>112.IBPluginDependency</string> - <string>117.IBPluginDependency</string> - <string>118.IBPluginDependency</string> - <string>124.IBPluginDependency</string> - <string>125.CustomClassName</string> - <string>125.IBPluginDependency</string> - <string>126.IBPluginDependency</string> - <string>127.CustomClassName</string> - <string>127.IBPluginDependency</string> - <string>128.IBPluginDependency</string> - <string>129.CustomClassName</string> - <string>129.IBPluginDependency</string> - <string>130.IBPluginDependency</string> - <string>131.CustomClassName</string> - <string>131.IBPluginDependency</string> - <string>132.IBPluginDependency</string> - <string>133.CustomClassName</string> - <string>133.IBPluginDependency</string> - <string>137.IBPluginDependency</string> - <string>138.IBPluginDependency</string> <string>164.IBPluginDependency</string> <string>175.IBPluginDependency</string> <string>179.IBPluginDependency</string> @@ -719,29 +259,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>ToolbarButtonCell</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>ToolbarButtonCell</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>ToolbarButtonCell</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>ToolbarButtonCell</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>ToolbarButtonCell</string> - <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>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{273, 255}, {480, 360}}</string> + <string>{{1032, 413}, {480, 360}}</string> <boolean value="YES" id="5"/> - <string>{{273, 255}, {480, 360}}</string> + <string>{{1032, 413}, {480, 360}}</string> <reference ref="5"/> <reference ref="5"/> <string>{480, 360}</string> @@ -795,6 +315,13 @@ </object> </object> <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">browser/cocoa/tab_strip_model_observer_bridge.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> <string key="className">TabContentsController</string> <string key="superclassName">NSViewController</string> <object class="NSMutableDictionary" key="actions"> @@ -805,25 +332,15 @@ <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMutableArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> - <string>backButton_</string> + <string>bookmarkView_</string> <string>contentsBox_</string> - <string>forwardButton_</string> - <string>goButton_</string> <string>growBox_</string> - <string>locationBar_</string> - <string>reloadButton_</string> - <string>starButton_</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> - <string>NSButton</string> + <string>ToolbarView</string> <string>NSBox</string> - <string>NSButton</string> - <string>NSButton</string> <string>GrowBoxView</string> - <string>NSTextField</string> - <string>NSButton</string> - <string>NSButton</string> </object> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> @@ -832,14 +349,6 @@ </object> </object> <object class="IBPartialClassDescription"> - <string key="className">ToolbarButtonCell</string> - <string key="superclassName">NSButtonCell</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBProjectSource</string> - <string key="minorKey">browser/cocoa/toolbar_button_cell.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> <string key="className">ToolbarView</string> <string key="superclassName">NSView</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> @@ -848,50 +357,6 @@ </object> </object> </object> - <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.1+"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="IBPartialClassDescription"> - <string key="className">TabContentsController</string> - <string key="superclassName">NSViewController</string> - <object class="NSMutableDictionary" key="actions"> - <string key="NS.key.0">fullScreen:</string> - <string key="NS.object.0">id</string> - </object> - <object class="NSMutableDictionary" key="outlets"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>backButton_</string> - <string>bookmarkView_</string> - <string>contentsBox_</string> - <string>forwardButton_</string> - <string>goButton_</string> - <string>growBox_</string> - <string>locationBar_</string> - <string>reloadButton_</string> - <string>starButton_</string> - <string>toolbarView_</string> - </object> - <object class="NSMutableArray" key="dict.values"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>NSButton</string> - <string>ToolbarView</string> - <string>NSBox</string> - <string>NSButton</string> - <string>NSButton</string> - <string>GrowBoxView</string> - <string>NSTextField</string> - <string>NSButton</string> - <string>NSButton</string> - <string>ToolbarView</string> - </object> - </object> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBDocumentRelativeSource</string> - <string key="minorKey">../../../browser/cocoa/tab_contents_controller.h</string> - </object> - </object> - </object> </object> <int key="IBDocument.localizationMode">0</int> <string key="IBDocument.LastKnownRelativeProjectPath">../../../chrome.xcodeproj</string> diff --git a/chrome/app/nibs/en.lproj/Toolbar.xib b/chrome/app/nibs/en.lproj/Toolbar.xib new file mode 100644 index 0000000..2fb84bd --- /dev/null +++ b/chrome/app/nibs/en.lproj/Toolbar.xib @@ -0,0 +1,695 @@ +<?xml version="1.0" encoding="UTF-8"?> +<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03"> + <data> + <int key="IBDocument.SystemTarget">1050</int> + <string key="IBDocument.SystemVersion">9F33</string> + <string key="IBDocument.InterfaceBuilderVersion">677</string> + <string key="IBDocument.AppKitVersion">949.34</string> + <string key="IBDocument.HIToolboxVersion">352.00</string> + <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> + <bool key="EncodedWithXMLCoder">YES</bool> + <integer value="4"/> + </object> + <object class="NSArray" key="IBDocument.PluginDependencies"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + </object> + <object class="NSMutableDictionary" key="IBDocument.Metadata"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + </object> + <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSCustomObject" id="1001"> + <string key="NSClassName">ToolbarController</string> + </object> + <object class="NSCustomObject" id="1003"> + <string key="NSClassName">FirstResponder</string> + </object> + <object class="NSCustomObject" id="1004"> + <string key="NSClassName">NSApplication</string> + </object> + <object class="NSCustomView" id="928520650"> + <reference key="NSNextResponder"/> + <int key="NSvFlags">266</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSButton" id="534801803"> + <reference key="NSNextResponder" ref="928520650"/> + <int key="NSvFlags">265</int> + <string key="NSFrame">{{411, 5}, {24, 27}}</string> + <reference key="NSSuperview" ref="928520650"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="123797077"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">134217728</int> + <string key="NSContents"/> + <object class="NSFont" key="NSSupport" id="64724822"> + <string key="NSName">LucidaGrande</string> + <double key="NSSize">1.300000e+01</double> + <int key="NSfFlags">1044</int> + </object> + <reference key="NSControlView" ref="534801803"/> + <int key="NSButtonFlags">105136383</int> + <int key="NSButtonFlags2">134</int> + <object class="NSCustomResource" key="NSNormalImage"> + <string key="NSClassName">NSImage</string> + <string key="NSResourceName">NSEnterFullScreenTemplate</string> + </object> + <object class="NSCustomResource" key="NSAlternateImage"> + <string key="NSClassName">NSImage</string> + <string key="NSResourceName">NSExitFullScreenTemplate</string> + </object> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">400</int> + <int key="NSPeriodicInterval">75</int> + </object> + </object> + <object class="NSTextField" id="535508469"> + <reference key="NSNextResponder" ref="928520650"/> + <int key="NSvFlags">266</int> + <string key="NSFrame">{{131, 5}, {308, 27}}</string> + <reference key="NSSuperview" ref="928520650"/> + <int key="NSTag">33004</int> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="464583340"> + <int key="NSCellFlags">-1804468671</int> + <int key="NSCellFlags2">33792</int> + <object class="NSAttributedString" key="NSContents"> + <string key="NSString">chromium.org</string> + <object class="NSDictionary" key="NSAttributes"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>NSColor</string> + <string>NSFont</string> + <string>NSOriginalFont</string> + <string>NSParagraphStyle</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSColor" id="573052423"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">textColor</string> + <object class="NSColor" key="NSColor"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MAA</bytes> + </object> + </object> + <object class="NSFont" id="381849655"> + <string key="NSName">LucidaGrande</string> + <double key="NSSize">1.600000e+01</double> + <int key="NSfFlags">16</int> + </object> + <reference ref="381849655"/> + <object class="NSMutableParagraphStyle"> + <nil key="NSTabStops"/> + </object> + </object> + </object> + </object> + <reference key="NSSupport" ref="381849655"/> + <reference key="NSControlView" ref="535508469"/> + <bool key="NSDrawsBackground">YES</bool> + <object class="NSColor" key="NSBackgroundColor"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">textBackgroundColor</string> + <object class="NSColor" key="NSColor"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MQA</bytes> + </object> + </object> + <reference key="NSTextColor" ref="573052423"/> + </object> + </object> + <object class="NSButton" id="368496192"> + <reference key="NSNextResponder" ref="928520650"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{102, 4}, {29, 29}}</string> + <reference key="NSSuperview" ref="928520650"/> + <int key="NSTag">35000</int> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="760046712"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">134250496</int> + <string key="NSContents"/> + <reference key="NSSupport" ref="64724822"/> + <int key="NSTag">-1</int> + <reference key="NSControlView" ref="368496192"/> + <int key="NSButtonFlags">-2030812929</int> + <int key="NSButtonFlags2">6</int> + <object class="NSCustomResource" key="NSNormalImage"> + <string key="NSClassName">NSImage</string> + <string key="NSResourceName">star</string> + </object> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">400</int> + <int key="NSPeriodicInterval">75</int> + </object> + </object> + <object class="NSButton" id="458854861"> + <reference key="NSNextResponder" ref="928520650"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{67, 4}, {31, 29}}</string> + <reference key="NSSuperview" ref="928520650"/> + <int key="NSTag">33002</int> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="386107000"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">134250496</int> + <string key="NSContents"/> + <reference key="NSSupport" ref="64724822"/> + <reference key="NSControlView" ref="458854861"/> + <int key="NSButtonFlags">-2033434369</int> + <int key="NSButtonFlags2">6</int> + <object class="NSCustomResource" key="NSNormalImage"> + <string key="NSClassName">NSImage</string> + <string key="NSResourceName">reload</string> + </object> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">400</int> + <int key="NSPeriodicInterval">75</int> + </object> + </object> + <object class="NSButton" id="781044416"> + <reference key="NSNextResponder" ref="928520650"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{34, 4}, {28, 29}}</string> + <reference key="NSSuperview" ref="928520650"/> + <int key="NSTag">33001</int> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="3781855"> + <int key="NSCellFlags">-2080244224</int> + <int key="NSCellFlags2">134250496</int> + <string key="NSContents"/> + <reference key="NSSupport" ref="64724822"/> + <int key="NSTag">1</int> + <reference key="NSControlView" ref="781044416"/> + <int key="NSButtonFlags">-2031337217</int> + <int key="NSButtonFlags2">6</int> + <object class="NSCustomResource" key="NSNormalImage"> + <string key="NSClassName">NSImage</string> + <string key="NSResourceName">forward</string> + </object> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">400</int> + <int key="NSPeriodicInterval">75</int> + </object> + </object> + <object class="NSButton" id="634265909"> + <reference key="NSNextResponder" ref="928520650"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{6, 4}, {29, 29}}</string> + <reference key="NSSuperview" ref="928520650"/> + <int key="NSTag">33000</int> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="697431051"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">134250496</int> + <string key="NSContents"/> + <reference key="NSSupport" ref="64724822"/> + <int key="NSTag">-2</int> + <reference key="NSControlView" ref="634265909"/> + <int key="NSButtonFlags">-2030288641</int> + <int key="NSButtonFlags2">6</int> + <object class="NSCustomResource" key="NSNormalImage"> + <string key="NSClassName">NSImage</string> + <string key="NSResourceName">back</string> + </object> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">400</int> + <int key="NSPeriodicInterval">75</int> + </object> + </object> + <object class="NSButton" id="480525277"> + <reference key="NSNextResponder" ref="928520650"/> + <int key="NSvFlags">265</int> + <string key="NSFrame">{{439, 4}, {29, 29}}</string> + <reference key="NSSuperview" ref="928520650"/> + <int key="NSTag">33005</int> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="203834804"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">134250496</int> + <string key="NSContents"/> + <reference key="NSSupport" ref="64724822"/> + <int key="NSTag">1</int> + <reference key="NSControlView" ref="480525277"/> + <int key="NSButtonFlags">-2031861505</int> + <int key="NSButtonFlags2">6</int> + <object class="NSCustomResource" key="NSNormalImage"> + <string key="NSClassName">NSImage</string> + <string key="NSResourceName">go</string> + </object> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">400</int> + <int key="NSPeriodicInterval">75</int> + </object> + </object> + </object> + <string key="NSFrameSize">{480, 38}</string> + <reference key="NSSuperview"/> + <string key="NSClassName">ToolbarView</string> + </object> + </object> + <object class="IBObjectContainer" key="IBDocument.Objects"> + <object class="NSMutableArray" key="connectionRecords"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">backButton_</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="634265909"/> + </object> + <int key="connectionID">17</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">forwardButton_</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="781044416"/> + </object> + <int key="connectionID">18</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">reloadButton_</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="458854861"/> + </object> + <int key="connectionID">19</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">starButton_</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="368496192"/> + </object> + <int key="connectionID">20</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">goButton_</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="480525277"/> + </object> + <int key="connectionID">21</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">view</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="928520650"/> + </object> + <int key="connectionID">22</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">commandDispatch:</string> + <reference key="source" ref="1003"/> + <reference key="destination" ref="534801803"/> + </object> + <int key="connectionID">23</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">commandDispatch:</string> + <reference key="source" ref="1003"/> + <reference key="destination" ref="535508469"/> + </object> + <int key="connectionID">24</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">commandDispatch:</string> + <reference key="source" ref="1003"/> + <reference key="destination" ref="368496192"/> + </object> + <int key="connectionID">25</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">commandDispatch:</string> + <reference key="source" ref="1003"/> + <reference key="destination" ref="458854861"/> + </object> + <int key="connectionID">26</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">commandDispatch:</string> + <reference key="source" ref="1003"/> + <reference key="destination" ref="781044416"/> + </object> + <int key="connectionID">27</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">commandDispatch:</string> + <reference key="source" ref="1003"/> + <reference key="destination" ref="634265909"/> + </object> + <int key="connectionID">28</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">commandDispatch:</string> + <reference key="source" ref="1003"/> + <reference key="destination" ref="480525277"/> + </object> + <int key="connectionID">29</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">locationBar_</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="535508469"/> + </object> + <int key="connectionID">31</int> + </object> + </object> + <object class="IBMutableOrderedSet" key="objectRecords"> + <object class="NSArray" key="orderedObjects"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBObjectRecord"> + <int key="objectID">0</int> + <object class="NSArray" key="object" id="1002"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + <reference key="children" ref="1000"/> + <nil key="parent"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-2</int> + <reference key="object" ref="1001"/> + <reference key="parent" ref="1002"/> + <string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-1</int> + <reference key="object" ref="1003"/> + <reference key="parent" ref="1002"/> + <string key="objectName">First Responder</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-3</int> + <reference key="object" ref="1004"/> + <reference key="parent" ref="1002"/> + <string key="objectName">Application</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">1</int> + <reference key="object" ref="928520650"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="634265909"/> + <reference ref="458854861"/> + <reference ref="535508469"/> + <reference ref="480525277"/> + <reference ref="534801803"/> + <reference ref="781044416"/> + <reference ref="368496192"/> + </object> + <reference key="parent" ref="1002"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">2</int> + <reference key="object" ref="634265909"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="697431051"/> + </object> + <reference key="parent" ref="928520650"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">3</int> + <reference key="object" ref="458854861"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="386107000"/> + </object> + <reference key="parent" ref="928520650"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">4</int> + <reference key="object" ref="535508469"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="464583340"/> + </object> + <reference key="parent" ref="928520650"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">5</int> + <reference key="object" ref="480525277"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="203834804"/> + </object> + <reference key="parent" ref="928520650"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">6</int> + <reference key="object" ref="534801803"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="123797077"/> + </object> + <reference key="parent" ref="928520650"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">7</int> + <reference key="object" ref="781044416"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="3781855"/> + </object> + <reference key="parent" ref="928520650"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">8</int> + <reference key="object" ref="368496192"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="760046712"/> + </object> + <reference key="parent" ref="928520650"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">9</int> + <reference key="object" ref="760046712"/> + <reference key="parent" ref="368496192"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">10</int> + <reference key="object" ref="3781855"/> + <reference key="parent" ref="781044416"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">11</int> + <reference key="object" ref="123797077"/> + <reference key="parent" ref="534801803"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">12</int> + <reference key="object" ref="203834804"/> + <reference key="parent" ref="480525277"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">13</int> + <reference key="object" ref="464583340"/> + <reference key="parent" ref="535508469"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">14</int> + <reference key="object" ref="386107000"/> + <reference key="parent" ref="458854861"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">15</int> + <reference key="object" ref="697431051"/> + <reference key="parent" ref="634265909"/> + </object> + </object> + </object> + <object class="NSMutableDictionary" key="flattenedProperties"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>-1.IBPluginDependency</string> + <string>-2.IBPluginDependency</string> + <string>-3.IBPluginDependency</string> + <string>1.IBEditorWindowLastContentRect</string> + <string>1.IBPluginDependency</string> + <string>10.CustomClassName</string> + <string>10.IBPluginDependency</string> + <string>11.IBPluginDependency</string> + <string>12.CustomClassName</string> + <string>12.IBPluginDependency</string> + <string>13.IBPluginDependency</string> + <string>14.CustomClassName</string> + <string>14.IBPluginDependency</string> + <string>15.CustomClassName</string> + <string>15.IBPluginDependency</string> + <string>2.IBPluginDependency</string> + <string>3.IBPluginDependency</string> + <string>4.IBPluginDependency</string> + <string>5.IBPluginDependency</string> + <string>6.IBPluginDependency</string> + <string>7.IBPluginDependency</string> + <string>8.IBPluginDependency</string> + <string>9.CustomClassName</string> + <string>9.IBPluginDependency</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>{{527, 656}, {480, 38}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>ToolbarButtonCell</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>ToolbarButtonCell</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>ToolbarButtonCell</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>ToolbarButtonCell</string> + <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>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>ToolbarButtonCell</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + </object> + </object> + <object class="NSMutableDictionary" key="unlocalizedProperties"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + </object> + <nil key="activeLocalization"/> + <object class="NSMutableDictionary" key="localizations"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + </object> + <nil key="sourceID"/> + <int key="maxID">31</int> + </object> + <object class="IBClassDescriber" key="IBDocument.Classes"> + <object class="NSMutableArray" key="referencedPartialClassDescriptions"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBPartialClassDescription"> + <string key="className">FirstResponder</string> + <object class="NSMutableDictionary" key="actions"> + <string key="NS.key.0">commandDispatch:</string> + <string key="NS.object.0">id</string> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBUserSource</string> + <string key="minorKey"/> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">browser/cocoa/tab_strip_model_observer_bridge.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">ToolbarButtonCell</string> + <string key="superclassName">NSButtonCell</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">browser/cocoa/toolbar_button_cell.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">ToolbarButtonCell</string> + <string key="superclassName">NSButtonCell</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBUserSource</string> + <string key="minorKey"/> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">ToolbarController</string> + <string key="superclassName">NSViewController</string> + <object class="NSMutableDictionary" key="outlets"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>backButton_</string> + <string>forwardButton_</string> + <string>goButton_</string> + <string>locationBar_</string> + <string>reloadButton_</string> + <string>starButton_</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>NSButton</string> + <string>NSButton</string> + <string>NSButton</string> + <string>NSTextField</string> + <string>NSButton</string> + <string>NSButton</string> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">browser/cocoa/toolbar_controller.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">ToolbarView</string> + <string key="superclassName">NSView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">browser/cocoa/toolbar_view.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">ToolbarView</string> + <string key="superclassName">NSView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBUserSource</string> + <string key="minorKey"/> + </object> + </object> + </object> + </object> + <int key="IBDocument.localizationMode">0</int> + <string key="IBDocument.LastKnownRelativeProjectPath">../../../chrome.xcodeproj</string> + <int key="IBDocument.defaultPropertyAccessControl">3</int> + </data> +</archive> diff --git a/chrome/browser/cocoa/browser_window_controller.h b/chrome/browser/cocoa/browser_window_controller.h index f89d979..04deaf58 100644 --- a/chrome/browser/cocoa/browser_window_controller.h +++ b/chrome/browser/cocoa/browser_window_controller.h @@ -11,6 +11,7 @@ #import <Cocoa/Cocoa.h> #import "chrome/browser/cocoa/tab_window_controller.h" +#import "chrome/browser/cocoa/toolbar_view.h" class Browser; class BrowserWindow; @@ -21,11 +22,13 @@ class TabContents; @class TabStripController; class TabStripModelObserverBridge; @class TabStripView; +@class ToolbarController; @interface BrowserWindowController : TabWindowController<NSUserInterfaceValidations> { @private TabStripController* tabStripController_; + ToolbarController* toolbarController_; Browser* browser_; TabStripModelObserverBridge* tabObserver_; BrowserWindowCocoa* windowShim_; diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm index 024b5f5..ac78712 100644 --- a/chrome/browser/cocoa/browser_window_controller.mm +++ b/chrome/browser/cocoa/browser_window_controller.mm @@ -14,7 +14,11 @@ #import "chrome/browser/cocoa/tab_strip_view.h" #import "chrome/browser/cocoa/tab_strip_controller.h" #import "chrome/browser/cocoa/tab_view.h" +#import "chrome/browser/cocoa/toolbar_controller.h" +@interface BrowserWindowController(Private) +- (void)positionToolbar; +@end @implementation BrowserWindowController @@ -43,7 +47,17 @@ // registering for the appropriate tab notifications from the back-end and // managing the creation of new tabs. tabStripController_ = [[TabStripController alloc] - initWithView:[self tabStripView] browser:browser_]; + initWithView:[self tabStripView] + switchView:[self tabContentArea] + browser:browser_]; + + // 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()]; + [self positionToolbar]; } return self; } @@ -51,6 +65,7 @@ - (void)dealloc { browser_->CloseAllTabs(); [tabStripController_ release]; + [toolbarController_ release]; delete windowShim_; delete tabObserver_; delete browser_; @@ -62,6 +77,28 @@ return windowShim_; } +// Position |toolbarView_| below the tab strip, but not as a sibling. The +// toolbar is part of the window's contentView, mainly because we want the +// opacity during drags to be the same as the web content. +- (void)positionToolbar { + NSView* contentView = [self tabContentArea]; + NSRect contentFrame = [contentView frame]; + NSView* toolbarView = [toolbarController_ view]; + NSRect toolbarFrame = [toolbarView frame]; + + // Shrink the content area by the height of the toolbar. + contentFrame.size.height -= toolbarFrame.size.height; + [contentView setFrame:contentFrame]; + + // Move the toolbar above the content area, within the window's content view + // (as opposed to the tab strip, which is a sibling). + toolbarFrame.origin.y = NSMaxY(contentFrame); + toolbarFrame.origin.x = 0; + toolbarFrame.size.width = contentFrame.size.width; + [toolbarView setFrame:toolbarFrame]; + [[[self window] contentView] addSubview:toolbarView]; +} + - (void)destroyBrowser { // We need the window to go away now. [self autorelease]; @@ -172,29 +209,27 @@ } - (LocationBar*)locationBar { - return [tabStripController_ locationBar]; + return [toolbarController_ locationBar]; } - (void)updateToolbarWithContents:(TabContents*)tab shouldRestoreState:(BOOL)shouldRestore { - [tabStripController_ updateToolbarWithContents:tab - shouldRestoreState:shouldRestore]; + [toolbarController_ updateToolbarWithContents:shouldRestore ? tab : NULL]; } - (void)setStarredState:(BOOL)isStarred { - [tabStripController_ setStarredState:isStarred]; + [toolbarController_ setStarredState:isStarred]; } // 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. // |windowGrowBox| needs to be in the window's coordinate system. - (NSRect)selectedTabGrowBoxRect { - return [tabStripController_ - selectedTabGrowBoxRect]; + return [tabStripController_ selectedTabGrowBoxRect]; } - (void)setIsLoading:(BOOL)isLoading { - [tabStripController_ setIsLoading:isLoading]; + [toolbarController_ setIsLoading:isLoading]; } // Called to start/stop the loading animations. @@ -211,7 +246,7 @@ // Make the location bar the first responder, if possible. - (void)focusLocationBar { - [tabStripController_ focusLocationBar]; + [toolbarController_ focusLocationBar]; } - (void)arrangeTabs { @@ -313,4 +348,5 @@ UpdateUIForContents(new_contents); #endif } + @end diff --git a/chrome/browser/cocoa/command_observer_bridge.h b/chrome/browser/cocoa/command_observer_bridge.h new file mode 100644 index 0000000..042c0d1 --- /dev/null +++ b/chrome/browser/cocoa/command_observer_bridge.h @@ -0,0 +1,41 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import <Cocoa/Cocoa.h> + +#include "chrome/browser/command_updater.h" + +@protocol CommandObserverProtocol; + +// A C++ bridge class that handles listening for updates to commands and +// passing them back to an object that supports the protocol delcared below. +// The observer will create one of these bridges, call ObserveCommand() on the +// command ids it cares about, and then wait for update notifications, +// delivered via -enabledStateChangedForCommand:enabled:. Destroying this +// bridge will handle automatically unregistering for updates, so there's no +// need to do that manually. + +class CommandObserverBridge : public CommandUpdater::CommandObserver { + public: + CommandObserverBridge(id<CommandObserverProtocol> observer, + CommandUpdater* commands); + virtual ~CommandObserverBridge(); + + // Register for updates about |command|. + void ObserveCommand(int command); + + protected: + // Overridden from CommandUpdater::CommandObserver + virtual void EnabledStateChangedForCommand(int command, bool enabled); + + private: + id<CommandObserverProtocol> observer_; // weak, owns me + CommandUpdater* commands_; // weak +}; + +// Implemented by the observing Objective-C object, called when there is a +// state change for the given command. +@protocol CommandObserverProtocol +- (void)enabledStateChangedForCommand:(NSInteger)command enabled:(BOOL)enabled; +@end diff --git a/chrome/browser/cocoa/command_observer_bridge.mm b/chrome/browser/cocoa/command_observer_bridge.mm new file mode 100644 index 0000000..47ea888 --- /dev/null +++ b/chrome/browser/cocoa/command_observer_bridge.mm @@ -0,0 +1,26 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "chrome/browser/cocoa/command_observer_bridge.h" + +CommandObserverBridge::CommandObserverBridge( + id<CommandObserverProtocol> observer, CommandUpdater* commands) + : observer_(observer), commands_(commands) { + DCHECK(observer_ && commands_); +} + +CommandObserverBridge::~CommandObserverBridge() { + // Unregister the notifications + commands_->RemoveCommandObserver(this); +} + +void CommandObserverBridge::ObserveCommand(int command) { + commands_->AddCommandObserver(command, this); +} + +void CommandObserverBridge::EnabledStateChangedForCommand(int command, + bool enabled) { + [observer_ enabledStateChangedForCommand:command + enabled:enabled ? YES : NO]; +} diff --git a/chrome/browser/cocoa/tab_contents_controller.h b/chrome/browser/cocoa/tab_contents_controller.h index bf97dc3..ac8bd30 100644 --- a/chrome/browser/cocoa/tab_contents_controller.h +++ b/chrome/browser/cocoa/tab_contents_controller.h @@ -9,16 +9,12 @@ @class BookmarkView; @class GrowBoxView; -@class ToolbarView; class BookmarkModel; -class CommandUpdater; -class LocationBar; -class LocationBarViewMac; class TabContents; class TabContentsCommandObserver; class TabStripModel; -class ToolbarModel; +@class ToolbarView; // A class that controls the contents of a tab, including the toolbar and // web area. @@ -36,25 +32,14 @@ class ToolbarModel; @interface TabContentsController : NSViewController { @private - CommandUpdater* commands_; // weak, may be nil TabContentsCommandObserver* observer_; // nil if |commands_| is nil - LocationBarViewMac* locationBarView_; TabContents* contents_; // weak - ToolbarModel* toolbarModel_; // weak, one per window - IBOutlet ToolbarView* toolbarView_; - BookmarkModel* bookmarkModel_; // weak; one per window // TODO(jrg): write a BookmarkView IBOutlet ToolbarView* /* BookmarkView* */ bookmarkView_; - IBOutlet NSButton* backButton_; - IBOutlet NSButton* forwardButton_; - IBOutlet NSButton* reloadButton_; - IBOutlet NSButton* starButton_; - IBOutlet NSButton* goButton_; - IBOutlet NSTextField* locationBar_; IBOutlet NSBox* contentsBox_; IBOutlet GrowBoxView* growBox_; @@ -69,16 +54,11 @@ class ToolbarModel; - (id)initWithNibName:(NSString*)name bundle:(NSBundle*)bundle contents:(TabContents*)contents - commands:(CommandUpdater*)commands - toolbarModel:(ToolbarModel*)toolbarModel bookmarkModel:(BookmarkModel*)bookmarkModel; // Take this view (toolbar and web contents) full screen - (IBAction)fullScreen:(id)sender; -// Get the C++ bridge object representing the location bar for this tab. -- (LocationBar*)locationBar; - // Called when the tab contents is about to be put into the view hierarchy as // the selected tab. Handles things such as ensuring the toolbar is correctly // enabled. @@ -89,24 +69,10 @@ class ToolbarModel; // an entirely new tab contents object. - (void)tabDidChange:(TabContents*)updatedContents; -// Called when any url bar state changes. If |tabForRestoring| is non-NULL, -// it points to a TabContents whose state we should restore. -- (void)updateToolbarWithContents:(TabContents*)tabForRestoring; - -// Sets whether or not the current page in the frontmost tab is bookmarked. -- (void)setStarredState:(BOOL)isStarred; - // 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; -// Called to update the loading state. Handles updating the go/stop button -// state. -- (void)setIsLoading:(BOOL)isLoading; - -// Make the location bar the first responder, if possible. -- (void)focusLocationBar; - // Change the visibility state of the bookmark bar. - (void)toggleBookmarkBar:(BOOL)enable; diff --git a/chrome/browser/cocoa/tab_contents_controller.mm b/chrome/browser/cocoa/tab_contents_controller.mm index 1ceb2a3..ce00782 100644 --- a/chrome/browser/cocoa/tab_contents_controller.mm +++ b/chrome/browser/cocoa/tab_contents_controller.mm @@ -5,56 +5,21 @@ #import "chrome/browser/cocoa/tab_contents_controller.h" #include "base/sys_string_conversions.h" -#include "chrome/app/chrome_dll_resource.h" #include "chrome/browser/bookmarks/bookmark_model.h" -#import "chrome/browser/cocoa/location_bar_view_mac.h" -#include "chrome/browser/command_updater.h" #include "chrome/browser/tab_contents/tab_contents.h" -#include "chrome/browser/toolbar_model.h" - -// Names of images in the bundle for the star icon (normal and 'starred'). -static NSString* const kStarImageName = @"star"; -static NSString* const kStarredImageName = @"starred"; - -@interface TabContentsController(CommandUpdates) -- (void)enabledStateChangedForCommand:(NSInteger)command enabled:(BOOL)enabled; -@end @interface TabContentsController(Private) -- (void)updateToolbarCommandStatus; - (void)applyContentsBoxOffset:(BOOL)apply; @end -// A C++ bridge class that handles listening for updates to commands and -// passing them back to the controller. -class TabContentsCommandObserver : public CommandUpdater::CommandObserver { - public: - TabContentsCommandObserver(TabContentsController* controller, - CommandUpdater* commands); - ~TabContentsCommandObserver(); - - // Overridden from CommandUpdater::CommandObserver - void EnabledStateChangedForCommand(int command, bool enabled); - - private: - TabContentsController* controller_; // weak, owns me - CommandUpdater* commands_; // weak -}; - @implementation TabContentsController - (id)initWithNibName:(NSString*)name bundle:(NSBundle*)bundle contents:(TabContents*)contents - commands:(CommandUpdater*)commands - toolbarModel:(ToolbarModel*)toolbarModel bookmarkModel:(BookmarkModel*)bookmarkModel { if ((self = [super initWithNibName:name bundle:bundle])) { - commands_ = commands; - if (commands_) - observer_ = new TabContentsCommandObserver(self, commands); contents_ = contents; - toolbarModel_ = toolbarModel; bookmarkModel_ = bookmarkModel; } return self; @@ -63,27 +28,12 @@ class TabContentsCommandObserver : public CommandUpdater::CommandObserver { - (void)dealloc { // make sure our contents have been removed from the window [[self view] removeFromSuperview]; - delete observer_; - delete locationBarView_; [super dealloc]; } - (void)awakeFromNib { [contentsBox_ setContentView:contents_->GetNativeView()]; [self applyContentsBoxOffset:YES]; - - // Provide a starting point since we won't get notifications if the state - // doesn't change between tabs. - [self updateToolbarCommandStatus]; - - locationBarView_ = new LocationBarViewMac(locationBar_); - locationBarView_->Init(); - - [locationBar_ setStringValue:@"http://dev.chromium.org"]; -} - -- (LocationBar*)locationBar { - return locationBarView_; } // Returns YES if the tab represented by this controller is the front-most. @@ -93,34 +43,6 @@ class TabContentsCommandObserver : public CommandUpdater::CommandObserver { return [[self view] superview] ? YES : NO; } -// Called when the state for a command changes to |enabled|. Update the -// corresponding UI element. -- (void)enabledStateChangedForCommand:(NSInteger)command enabled:(BOOL)enabled { - // We don't need to update anything if we're not the frontmost tab. - // TODO(pinkerton): i'm worried that observer ordering could cause the - // notification to be sent before we've been put into the view, but we - // appear to be called in the right order so far. - if (![self isCurrentTab]) - return; - - NSButton* button = nil; - switch (command) { - case IDC_BACK: - button = backButton_; - break; - case IDC_FORWARD: - button = forwardButton_; - break; - case IDC_HOME: - // TODO(pinkerton): add home button - break; - case IDC_STAR: - button = starButton_; - break; - } - [button setEnabled:enabled]; -} - - (IBAction)fullScreen:(id)sender { if ([[self view] isInFullScreenMode]) { [[self view] exitFullScreenModeWithOptions:nil]; @@ -129,21 +51,7 @@ class TabContentsCommandObserver : public CommandUpdater::CommandObserver { } } -// Set the enabled state of the buttons on the toolbar to match the state in -// the controller. We can't only rely on notifications to do this because the -// command model only assumes a single toolbar and won't send notifications if -// the state doesn't change. -- (void)updateToolbarCommandStatus { - [backButton_ setEnabled:commands_->IsCommandEnabled(IDC_BACK) ? YES : NO]; - [forwardButton_ - setEnabled:commands_->IsCommandEnabled(IDC_FORWARD) ? YES : NO]; - [reloadButton_ - setEnabled:commands_->IsCommandEnabled(IDC_RELOAD) ? YES : NO]; - [starButton_ setEnabled:commands_->IsCommandEnabled(IDC_STAR) ? YES : NO]; -} - - (void)willBecomeSelectedTab { - [self updateToolbarCommandStatus]; } - (void)tabDidChange:(TabContents*)updatedContents { @@ -151,29 +59,6 @@ class TabContentsCommandObserver : public CommandUpdater::CommandObserver { [contentsBox_ setContentView:contents_->GetNativeView()]; } -- (void)focusLocationBar { - if (locationBarView_) { - locationBarView_->FocusLocation(); - } -} - -- (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()); - [locationBar_ setStringValue:urlString]; -} - -- (void)setStarredState:(BOOL)isStarred { - NSString* starImageName = kStarImageName; - if (isStarred) - starImageName = kStarredImageName; - [starButton_ setImage:[NSImage imageNamed:starImageName]]; -} - // 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 { @@ -199,13 +84,6 @@ class TabContentsCommandObserver : public CommandUpdater::CommandObserver { return localGrowBox; } -- (void)setIsLoading:(BOOL)isLoading { - NSString* imageName = @"go"; - if (isLoading) - imageName = @"stop"; - [goButton_ setImage:[NSImage imageNamed:imageName]]; -} - - (void)toggleBookmarkBar:(BOOL)enable { contentsBoxHasOffset_ = enable; [self applyContentsBoxOffset:enable]; @@ -248,28 +126,3 @@ class TabContentsCommandObserver : public CommandUpdater::CommandObserver { } @end - -//-------------------------------------------------------------------------- - -TabContentsCommandObserver::TabContentsCommandObserver( - TabContentsController* controller, CommandUpdater* commands) - : controller_(controller), commands_(commands) { - DCHECK(controller_ && commands); - // Register for notifications about state changes for the toolbar buttons - commands_->AddCommandObserver(IDC_BACK, this); - commands_->AddCommandObserver(IDC_FORWARD, this); - commands_->AddCommandObserver(IDC_RELOAD, this); - commands_->AddCommandObserver(IDC_HOME, this); - commands_->AddCommandObserver(IDC_STAR, this); -} - -TabContentsCommandObserver::~TabContentsCommandObserver() { - // Unregister the notifications - commands_->RemoveCommandObserver(this); -} - -void TabContentsCommandObserver::EnabledStateChangedForCommand(int command, - bool enabled) { - [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 7159d8d..ab6b902 100644 --- a/chrome/browser/cocoa/tab_strip_controller.h +++ b/chrome/browser/cocoa/tab_strip_controller.h @@ -36,10 +36,10 @@ class ToolbarModel; @private TabContents* currentTab_; // weak, tab for which we're showing state TabStripView* tabView_; // weak + NSView* switchView_; // weak NSButton* newTabButton_; // weak, obtained from the nib. TabStripModelObserverBridge* bridge_; TabStripModel* tabModel_; // weak - ToolbarModel* toolbarModel_; // weak, one per browser BookmarkModel* bookmarkModel_; // weak, one per profile (= one per Browser*) CommandUpdater* commands_; // weak, may be nil // access to the TabContentsControllers (which own the parent view @@ -56,33 +56,18 @@ class ToolbarModel; } // Initialize the controller with a view and browser that contains -// everything else we'll need. +// everything else we'll need. |switchView| is the view whose contents get +// "switched" every time the user switches tabs. The children of this view +// will be released, so if you want them to stay around, make sure +// you have retained them. - (id)initWithView:(TabStripView*)view + switchView:(NSView*)switchView browser:(Browser*)browser; -// Get the C++ bridge object representing the location bar for the current tab. -- (LocationBar*)locationBar; - -// Updates the toolbar (and transitively the location bar) with the states of -// the specified |tab|. If |shouldRestore| is true, we're switching -// (back?) to this tab and should restore any previous location bar state -// (such as user editing) as well. -- (void)updateToolbarWithContents:(TabContents*)tab - shouldRestoreState:(BOOL)shouldRestore; - -// Sets whether or not the current page in the frontmost tab is bookmarked. -- (void)setStarredState:(BOOL)isStarred; - // 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; -// Called to tell the selected tab to update its loading state. -- (void)setIsLoading:(BOOL)isLoading; - -// Make the location bar the first responder, if possible. -- (void)focusLocationBar; - // Return a boolean (ObjC BOOL, not C++ bool) to say if the bookmark // bar is visible. - (BOOL)isBookmarkBarVisible; diff --git a/chrome/browser/cocoa/tab_strip_controller.mm b/chrome/browser/cocoa/tab_strip_controller.mm index 6e3e70b..e4d669a 100644 --- a/chrome/browser/cocoa/tab_strip_controller.mm +++ b/chrome/browser/cocoa/tab_strip_controller.mm @@ -20,12 +20,13 @@ @implementation TabStripController - (id)initWithView:(TabStripView*)view + switchView:(NSView*)switchView browser:(Browser*)browser { - DCHECK(view && browser); + DCHECK(view && switchView && browser); if ((self = [super init])) { tabView_ = view; + switchView_ = switchView; tabModel_ = browser->tabstrip_model(); - toolbarModel_ = browser->toolbar_model(); bookmarkModel_ = browser->profile()->GetBookmarkModel(); commands_ = browser->command_updater(); bridge_ = new TabStripModelObserverBridge(tabModel_, self); @@ -62,22 +63,20 @@ TabContentsController* controller = [tabContentsArray_ objectAtIndex:index]; // Resize the new view to fit the window - NSView* contentView = [[tabView_ window] contentView]; NSView* newView = [controller view]; - NSRect frame = [contentView bounds]; - frame.size.height -= 14.0; + NSRect frame = [switchView_ bounds]; [newView setFrame:frame]; // Remove the old view from the view hierarchy. We know there's only one - // child of the contentView because we're the one who put it there. There + // child of |switchView_| because we're the one who put it there. There // may not be any children in the case of a tab that's been closed, in // which case there's no swapping going on. - NSArray* subviews = [contentView subviews]; + NSArray* subviews = [switchView_ subviews]; if ([subviews count]) { NSView* oldView = [subviews objectAtIndex:0]; - [contentView replaceSubview:oldView with:newView]; + [switchView_ replaceSubview:oldView with:newView]; } else { - [contentView addSubview:newView]; + [switchView_ addSubview:newView]; } } @@ -224,8 +223,6 @@ [[[TabContentsController alloc] initWithNibName:@"TabContents" bundle:nil contents:contents - commands:commands_ - toolbarModel:toolbarModel_ bookmarkModel:bookmarkModel_] autorelease]; if ([self isBookmarkBarVisible]) @@ -315,32 +312,6 @@ [updatedController tabDidChange:contents]; } -- (LocationBar*)locationBar { - TabContentsController* selectedController = - [tabContentsArray_ objectAtIndex:tabModel_->selected_index()]; - return [selectedController locationBar]; -} - -- (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. - 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 = - [tabContentsArray_ objectAtIndex:tabModel_->GetIndexOfTabContents(tab)]; - [controller updateToolbarWithContents:shouldRestore ? tab : nil]; -} - -- (void)setStarredState:(BOOL)isStarred { - TabContentsController* selectedController = - [tabContentsArray_ objectAtIndex:tabModel_->selected_index()]; - [selectedController setStarredState:isStarred]; -} - // 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 { @@ -358,23 +329,6 @@ return [selectedController growBoxRect]; } -// Called to tell the selected tab to update its loading state. -- (void)setIsLoading:(BOOL)isLoading { - // TODO(pinkerton): update the favicon on the selected tab view to/from - // a spinner? - - TabContentsController* selectedController = - [tabContentsArray_ objectAtIndex:tabModel_->selected_index()]; - [selectedController setIsLoading:isLoading]; -} - -// Make the location bar the first responder, if possible. -- (void)focusLocationBar { - TabContentsController* selectedController = - [tabContentsArray_ objectAtIndex:tabModel_->selected_index()]; - [selectedController focusLocationBar]; -} - - (BOOL)isBookmarkBarVisible { return [bookmarkBarStateController_ visible]; } @@ -386,7 +340,6 @@ for (TabContentsController *controller in tabContentsArray_) { [controller toggleBookmarkBar:visible]; } - } @end diff --git a/chrome/browser/cocoa/tab_window_controller.h b/chrome/browser/cocoa/tab_window_controller.h index f0fcb524..43df6f2 100644 --- a/chrome/browser/cocoa/tab_window_controller.h +++ b/chrome/browser/cocoa/tab_window_controller.h @@ -11,6 +11,12 @@ // know anything about the actual tab implementation or model, as that is fairly // application-specific. It only provides an API to be overridden by subclasses // to fill in the details. +// +// This assumes that there will be a view in the nib, connected to +// |tabContentArea_|, that indicates the content that it switched when switching +// between tabs. It needs to be a regular NSView, not something like an NSBox +// because the TabStripController makes certain assumptions about how it can +// swap out subviews. #import <Cocoa/Cocoa.h> @@ -19,9 +25,7 @@ @interface TabWindowController : NSWindowController { @private - IBOutlet NSBox* contentBox_; // Only valid at window creation time, used - // to position the tab strip. nil afterwards. - // TODO(pinkerton): get rid of this. + IBOutlet NSView* tabContentArea_; IBOutlet TabStripView* tabStripView_; NSWindow* overlayWindow_; // Used during dragging for window opacity tricks NSView* cachedContentView_; // Used during dragging for identifying which @@ -29,6 +33,7 @@ // (weak) } @property(readonly, nonatomic) TabStripView* tabStripView; +@property(readonly, nonatomic) NSView* tabContentArea; // Used during tab dragging to turn on/off the overlay window when a tab // is torn off. @@ -62,4 +67,11 @@ @end +@interface TabWindowController(ProtectedMethods) +// A list of all the views that need to move to the overlay window. Subclasses +// can override this to add more things besides the tab strip. Be sure to +// call the superclass' version if overridden. +- (NSArray*)viewsToMoveToOverlay; +@end + #endif // CHROME_BROWSER_TAB_WINDOW_CONTROLLER_H_ diff --git a/chrome/browser/cocoa/tab_window_controller.mm b/chrome/browser/cocoa/tab_window_controller.mm index 691095f..456c973 100644 --- a/chrome/browser/cocoa/tab_window_controller.mm +++ b/chrome/browser/cocoa/tab_window_controller.mm @@ -13,19 +13,16 @@ @implementation TabWindowController @synthesize tabStripView = tabStripView_; +@synthesize tabContentArea = tabContentArea_; - (void)windowDidLoad { // Place the tab bar above the content box and add it to the view hierarchy // as a sibling of the content view so it can overlap with the window frame. - NSRect tabFrame = [contentBox_ frame]; + NSRect tabFrame = [tabContentArea_ frame]; tabFrame.origin = NSMakePoint(0, NSMaxY(tabFrame)); tabFrame.size.height = NSHeight([tabStripView_ frame]); [tabStripView_ setFrame:tabFrame]; [[[[self window] contentView] superview] addSubview:tabStripView_]; - - // tab switching will destroy the content area, so nil this out to ensure - // that nobody tries to use it. - contentBox_ = nil; } - (void)removeOverlay { @@ -45,6 +42,21 @@ [self setUseOverlay:YES]; } +- (NSArray*)viewsToMoveToOverlay { + return [NSArray arrayWithObject:[self tabStripView]]; +} + +// if |useOverlay| is true, we're moving views into the overlay's content +// area. If false, we're moving out of the overlay back into the window's +// content. +- (void)moveViewsBetweenWindowAndOverlay:(BOOL)useOverlay { + NSView* moveTo = useOverlay ? + [overlayWindow_ contentView] : [cachedContentView_ superview]; + NSArray* viewsToMove = [self viewsToMoveToOverlay]; + for (NSView* view in viewsToMove) + [moveTo addSubview:view]; +} + // If |useOverlay| is YES, creates a new overlay window and puts the tab strip // and the content area inside of it. This allows it to have a different opacity // from the title bar. If NO, returns everything to the previous state and @@ -66,7 +78,7 @@ NSView *contentView = [overlayWindow_ contentView]; [contentView addSubview:[self tabStripView]]; cachedContentView_ = [[self window] contentView]; - [contentView addSubview:cachedContentView_]; + [self moveViewsBetweenWindowAndOverlay:useOverlay]; [overlayWindow_ setHasShadow:YES]; [[self window] addChildWindow:overlayWindow_ ordered:NSWindowAbove]; [overlayWindow_ orderFront:nil]; @@ -75,7 +87,7 @@ DCHECK(cachedContentView_); [[self window] setHasShadow:YES]; [[self window] setContentView:cachedContentView_]; - [[cachedContentView_ superview] addSubview:[self tabStripView]]; + [self moveViewsBetweenWindowAndOverlay:useOverlay]; [[self window] makeFirstResponder:cachedContentView_]; [[self window] display]; [[self window] removeChildWindow:overlayWindow_]; diff --git a/chrome/browser/cocoa/toolbar_controller.h b/chrome/browser/cocoa/toolbar_controller.h new file mode 100644 index 0000000..d2cc2c4 --- /dev/null +++ b/chrome/browser/cocoa/toolbar_controller.h @@ -0,0 +1,60 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_COCOA_TOOLBAR_CONTROLLER_H_ +#define CHROME_BROWSER_COCOA_TOOLBAR_CONTROLLER_H_ + +#import <Cocoa/Cocoa.h> + +#import "chrome/browser/cocoa/command_observer_bridge.h" + +class CommandUpdater; +class LocationBar; +class LocationBarViewMac; +class TabContents; +class ToolbarModel; +class ToolbarView; + +// A controller for the toolbar in the browser window. Manages updating the +// state for location bar and back/fwd/reload/go buttons. + +@interface ToolbarController : NSViewController<CommandObserverProtocol> { + @private + ToolbarModel* toolbarModel_; // weak, one per window + CommandUpdater* commands_; // weak, one per window + CommandObserverBridge* commandObserver_; + LocationBarViewMac* locationBarView_; + + IBOutlet NSButton* backButton_; + IBOutlet NSButton* forwardButton_; + IBOutlet NSButton* reloadButton_; + IBOutlet NSButton* starButton_; + IBOutlet NSButton* goButton_; + IBOutlet NSTextField* locationBar_; +} + +// Initialize the toolbar and register for command updates. +- (id)initWithModel:(ToolbarModel*)model + commands:(CommandUpdater*)commands; + +// Get the C++ bridge object representing the location bar for this tab. +- (LocationBar*)locationBar; + +// Make the location bar the first responder, if possible. +- (void)focusLocationBar; + +// Called when any url bar state changes. If |tabForRestoring| is non-NULL, +// it points to a TabContents whose state we should restore. +- (void)updateToolbarWithContents:(TabContents*)tabForRestoring; + +// Sets whether or not the current page in the frontmost tab is bookmarked. +- (void)setStarredState:(BOOL)isStarred; + +// Called to update the loading state. Handles updating the go/stop button +// state. +- (void)setIsLoading:(BOOL)isLoading; + +@end + +#endif // CHROME_BROWSER_COCOA_TOOLBAR_CONTROLLER_H_ diff --git a/chrome/browser/cocoa/toolbar_controller.mm b/chrome/browser/cocoa/toolbar_controller.mm new file mode 100644 index 0000000..e77c30c --- /dev/null +++ b/chrome/browser/cocoa/toolbar_controller.mm @@ -0,0 +1,123 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "chrome/browser/cocoa/toolbar_controller.h" + +#include "base/sys_string_conversions.h" +#include "chrome/app/chrome_dll_resource.h" +#import "chrome/browser/cocoa/location_bar_view_mac.h" +#include "chrome/browser/toolbar_model.h" + +// Names of images in the bundle for the star icon (normal and 'starred'). +static NSString* const kStarImageName = @"star"; +static NSString* const kStarredImageName = @"starred"; + +@interface ToolbarController(Private) +- (void)initCommandStatus:(CommandUpdater*)commands; +@end + +@implementation ToolbarController + +- (id)initWithModel:(ToolbarModel*)model + commands:(CommandUpdater*)commands { + DCHECK(model && commands); + if ((self = [super initWithNibName:@"Toolbar" bundle:nil])) { + toolbarModel_ = model; + commands_ = commands; + + // Register for notifications about state changes for the toolbar buttons + commandObserver_ = new CommandObserverBridge(self, commands); + commandObserver_->ObserveCommand(IDC_BACK); + commandObserver_->ObserveCommand(IDC_FORWARD); + commandObserver_->ObserveCommand(IDC_RELOAD); + commandObserver_->ObserveCommand(IDC_HOME); + commandObserver_->ObserveCommand(IDC_STAR); + } + return self; +} + +// Called after the view is done loading and the outlets have been hooked up. +// Now we can hook up bridges that rely on UI objects such as the location +// bar and button state. +- (void)awakeFromNib { + [self initCommandStatus:commands_]; + locationBarView_ = new LocationBarViewMac(locationBar_); + locationBarView_->Init(); + [locationBar_ setStringValue:@"http://dev.chromium.org"]; +} + +- (void)dealloc { + delete locationBarView_; + delete commandObserver_; + [super dealloc]; +} + +- (LocationBar*)locationBar { + return locationBarView_; +} + +- (void)focusLocationBar { + if (locationBarView_) { + locationBarView_->FocusLocation(); + } +} + +// Called when the state for a command changes to |enabled|. Update the +// corresponding UI element. +- (void)enabledStateChangedForCommand:(NSInteger)command enabled:(BOOL)enabled { + NSButton* button = nil; + switch (command) { + case IDC_BACK: + button = backButton_; + break; + case IDC_FORWARD: + button = forwardButton_; + break; + case IDC_HOME: + // TODO(pinkerton): add home button + break; + case IDC_STAR: + button = starButton_; + break; + } + [button setEnabled:enabled]; +} + +// Init the enabled state of the buttons on the toolbar to match the state in +// the controller. +- (void)initCommandStatus:(CommandUpdater*)commands { + [backButton_ setEnabled:commands->IsCommandEnabled(IDC_BACK) ? YES : NO]; + [forwardButton_ + setEnabled:commands->IsCommandEnabled(IDC_FORWARD) ? YES : NO]; + [reloadButton_ + setEnabled:commands->IsCommandEnabled(IDC_RELOAD) ? YES : NO]; + // TODO(pinkerton): Add home button. + [starButton_ setEnabled:commands->IsCommandEnabled(IDC_STAR) ? YES : NO]; +} + +- (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()); + [locationBar_ setStringValue:urlString]; +} + +- (void)setStarredState:(BOOL)isStarred { + NSString* starImageName = kStarImageName; + if (isStarred) + starImageName = kStarredImageName; + [starButton_ setImage:[NSImage imageNamed:starImageName]]; +} + +- (void)setIsLoading:(BOOL)isLoading { + NSString* imageName = @"go"; + if (isLoading) + imageName = @"stop"; + [goButton_ setImage:[NSImage imageNamed:imageName]]; +} + +@end diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 8742f32..0b76044 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -524,6 +524,8 @@ 'browser/cocoa/browser_window_cocoa.mm', 'browser/cocoa/browser_window_controller.h', 'browser/cocoa/browser_window_controller.mm', + 'browser/cocoa/command_observer_bridge.h', + 'browser/cocoa/command_observer_bridge.mm', 'browser/cocoa/grow_box_view.h', 'browser/cocoa/grow_box_view.m', 'browser/cocoa/location_bar_view_mac.h', @@ -551,6 +553,8 @@ 'browser/cocoa/tab_window_controller.mm', 'browser/cocoa/toolbar_button_cell.h', 'browser/cocoa/toolbar_button_cell.mm', + 'browser/cocoa/toolbar_controller.h', + 'browser/cocoa/toolbar_controller.mm', 'browser/cocoa/toolbar_view.h', 'browser/cocoa/toolbar_view.mm', 'browser/command_updater.cc', @@ -1547,6 +1551,7 @@ 'app/nibs/en.lproj/MainMenu.xib', 'app/nibs/en.lproj/TabContents.xib', 'app/nibs/en.lproj/TabView.xib', + 'app/nibs/en.lproj/Toolbar.xib', 'app/theme/back.pdf', 'app/theme/forward.pdf', 'app/theme/go.pdf', |