diff options
author | andybons@chromium.org <andybons@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-12 18:53:09 +0000 |
---|---|---|
committer | andybons@chromium.org <andybons@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-12 18:53:09 +0000 |
commit | 5a2fb0052ba3649072a6a943474032e0f750c136 (patch) | |
tree | c517c33debaba26acb1ef1fc1e839dafa9a2f316 /chrome | |
parent | 8761dfd26bce81b5e438cbee1f020755cabaef7c (diff) | |
download | chromium_src-5a2fb0052ba3649072a6a943474032e0f750c136.zip chromium_src-5a2fb0052ba3649072a6a943474032e0f750c136.tar.gz chromium_src-5a2fb0052ba3649072a6a943474032e0f750c136.tar.bz2 |
Initial change for the implementation of browser actions on the mac.
Popups are not implemented within this change.
BUG=23881
TEST=Install a browser action extension on the mac. Observe that something actually happens in the UI.
Review URL: http://codereview.chromium.org/366029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31803 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/app/nibs/Toolbar.xib | 924 | ||||
-rw-r--r-- | chrome/browser/cocoa/extensions/browser_actions_controller.h | 76 | ||||
-rw-r--r-- | chrome/browser/cocoa/extensions/browser_actions_controller.mm | 421 | ||||
-rw-r--r-- | chrome/browser/cocoa/toolbar_controller.h | 3 | ||||
-rw-r--r-- | chrome/browser/cocoa/toolbar_controller.mm | 88 | ||||
-rw-r--r-- | chrome/browser/cocoa/toolbar_controller_unittest.mm | 3 | ||||
-rwxr-xr-x | chrome/chrome.gyp | 2 | ||||
-rwxr-xr-x | chrome/common/extensions/extension_action.cc | 14 |
8 files changed, 1464 insertions, 67 deletions
diff --git a/chrome/app/nibs/Toolbar.xib b/chrome/app/nibs/Toolbar.xib index ff10ecd..a4a7fde 100644 --- a/chrome/app/nibs/Toolbar.xib +++ b/chrome/app/nibs/Toolbar.xib @@ -1,15 +1,20 @@ <?xml version="1.0" encoding="UTF-8"?> -<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03"> +<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10"> <data> <int key="IBDocument.SystemTarget">1050</int> - <string key="IBDocument.SystemVersion">9L31a</string> - <string key="IBDocument.InterfaceBuilderVersion">680</string> - <string key="IBDocument.AppKitVersion">949.54</string> - <string key="IBDocument.HIToolboxVersion">353.00</string> + <string key="IBDocument.SystemVersion">10C540</string> + <string key="IBDocument.InterfaceBuilderVersion">732</string> + <string key="IBDocument.AppKitVersion">1038.25</string> + <string key="IBDocument.HIToolboxVersion">458.00</string> + <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> + <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string> + <string key="NS.object.0">732</string> + </object> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="42"/> <integer value="48"/> + <integer value="42"/> + <integer value="1"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -17,7 +22,7 @@ </object> <object class="NSMutableDictionary" key="IBDocument.Metadata"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys" id="0"> <bool key="EncodedWithXMLCoder">YES</bool> </object> <object class="NSMutableArray" key="dict.values"> @@ -36,10 +41,17 @@ <string key="NSClassName">NSApplication</string> </object> <object class="NSCustomView" id="928520650"> - <nil key="NSNextResponder"/> + <reference key="NSNextResponder"/> <int key="NSvFlags">266</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSCustomView" id="421615633"> + <reference key="NSNextResponder" ref="928520650"/> + <int key="NSvFlags">265</int> + <string key="NSFrame">{{540, 0}, {0.777771, 36}}</string> + <reference key="NSSuperview" ref="928520650"/> + <string key="NSClassName">NSView</string> + </object> <object class="NSTextField" id="535508469"> <reference key="NSNextResponder" ref="928520650"/> <int key="NSvFlags">266</int> @@ -53,7 +65,7 @@ <string key="NSContents">chromium.org</string> <object class="NSFont" key="NSSupport"> <string key="NSName">LucidaGrande</string> - <double key="NSSize">1.300000e+01</double> + <double key="NSSize">13</double> <int key="NSfFlags">16</int> </object> <reference key="NSControlView" ref="535508469"/> @@ -91,7 +103,7 @@ <string key="NSContents"/> <object class="NSFont" key="NSSupport" id="64724822"> <string key="NSName">LucidaGrande</string> - <double key="NSSize">1.300000e+01</double> + <double key="NSSize">13</double> <int key="NSfFlags">1044</int> </object> <reference key="NSControlView" ref="368496192"/> @@ -119,8 +131,8 @@ <int key="NSCellFlags2">134250496</int> <string key="NSContents"/> <reference key="NSSupport" ref="64724822"/> - <int key="NSTag">-1</int> <reference key="NSControlView" ref="559273956"/> + <int key="NSTag">-1</int> <int key="NSButtonFlags">-2030812929</int> <int key="NSButtonFlags2">6</int> <object class="NSCustomResource" key="NSNormalImage"> @@ -174,8 +186,8 @@ <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="NSTag">1</int> <int key="NSButtonFlags">-2031861505</int> <int key="NSButtonFlags2">6</int> <object class="NSCustomResource" key="NSNormalImage"> @@ -200,8 +212,8 @@ <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="NSTag">-2</int> <int key="NSButtonFlags">-2030812929</int> <int key="NSButtonFlags2">6</int> <object class="NSCustomResource" key="NSNormalImage"> @@ -226,8 +238,8 @@ <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="NSTag">1</int> <int key="NSButtonFlags">-2031861505</int> <int key="NSButtonFlags2">6</int> <object class="NSCustomResource" key="NSNormalImage"> @@ -292,6 +304,7 @@ </object> </object> <string key="NSFrameSize">{618, 36}</string> + <reference key="NSSuperview"/> <string key="NSClassName">ToolbarView</string> </object> <object class="NSMenu" id="1035953805"> @@ -1061,34 +1074,40 @@ </object> <int key="connectionID">143</int> </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">browserActionContainerView_</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="421615633"/> + </object> + <int key="connectionID">145</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="465075988"> - <bool key="EncodedWithXMLCoder">YES</bool> - </object> + <reference key="object" ref="0"/> <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="465075988"/> - <string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string> + <reference key="parent" ref="0"/> + <string key="objectName">File's Owner</string> </object> <object class="IBObjectRecord"> <int key="objectID">-1</int> <reference key="object" ref="1003"/> - <reference key="parent" ref="465075988"/> + <reference key="parent" ref="0"/> <string key="objectName">First Responder</string> </object> <object class="IBObjectRecord"> <int key="objectID">-3</int> <reference key="object" ref="1004"/> - <reference key="parent" ref="465075988"/> + <reference key="parent" ref="0"/> <string key="objectName">Application</string> </object> <object class="IBObjectRecord"> @@ -1105,8 +1124,9 @@ <reference ref="559273956"/> <reference ref="602421009"/> <reference ref="571076484"/> + <reference ref="421615633"/> </object> - <reference key="parent" ref="465075988"/> + <reference key="parent" ref="0"/> </object> <object class="IBObjectRecord"> <int key="objectID">2</int> @@ -1257,7 +1277,7 @@ <reference ref="236901479"/> <reference ref="633871226"/> </object> - <reference key="parent" ref="465075988"/> + <reference key="parent" ref="0"/> </object> <object class="IBObjectRecord"> <int key="objectID">43</int> @@ -1295,7 +1315,7 @@ <reference ref="163898806"/> <reference ref="1012539825"/> </object> - <reference key="parent" ref="465075988"/> + <reference key="parent" ref="0"/> </object> <object class="IBObjectRecord"> <int key="objectID">49</int> @@ -1497,7 +1517,7 @@ <object class="IBObjectRecord"> <int key="objectID">122</int> <reference key="object" ref="1044322163"/> - <reference key="parent" ref="465075988"/> + <reference key="parent" ref="0"/> </object> <object class="IBObjectRecord"> <int key="objectID">127</int> @@ -1512,7 +1532,7 @@ <object class="IBObjectRecord"> <int key="objectID">130</int> <reference key="object" ref="306232897"/> - <reference key="parent" ref="465075988"/> + <reference key="parent" ref="0"/> </object> <object class="IBObjectRecord"> <int key="objectID">141</int> @@ -1524,11 +1544,17 @@ <reference key="object" ref="1012539825"/> <reference key="parent" ref="558188039"/> </object> + <object class="IBObjectRecord"> + <int key="objectID">144</int> + <reference key="object" ref="421615633"/> + <reference key="parent" ref="928520650"/> + <string key="objectName">Browser Actions Container</string> + </object> </object> </object> <object class="NSMutableDictionary" key="flattenedProperties"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>-1.IBPluginDependency</string> <string>-2.IBPluginDependency</string> @@ -1554,6 +1580,7 @@ <string>14.IBPluginDependency</string> <string>141.IBPluginDependency</string> <string>142.IBPluginDependency</string> + <string>144.IBPluginDependency</string> <string>15.CustomClassName</string> <string>15.IBPluginDependency</string> <string>2.CustomClassName</string> @@ -1630,7 +1657,7 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{67, 254}, {618, 36}}</string> + <string>{{272, 827}, {618, 36}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <boolean value="YES"/> <string>ClickHoldButtonCell</string> @@ -1651,6 +1678,7 @@ <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>ClickHoldButtonCell</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>DelayedMenuButton</string> @@ -1674,9 +1702,7 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <object class="NSMutableDictionary"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSArray" key="dict.sortedKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - </object> + <reference key="dict.sortedKeys" ref="0"/> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> </object> @@ -1710,12 +1736,12 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>AutocompleteTextField</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{466, 432}, {235, 293}}</string> + <string>{{466, 432}, {232, 293}}</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>{{103, 206}, {335, 263}}</string> + <string>{{103, 206}, {332, 263}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -1775,9 +1801,7 @@ </object> <object class="NSMutableDictionary" key="unlocalizedProperties"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSArray" key="dict.sortedKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - </object> + <reference key="dict.sortedKeys" ref="0"/> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> </object> @@ -1785,15 +1809,13 @@ <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> + <reference key="dict.sortedKeys" ref="0"/> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> </object> </object> <nil key="sourceID"/> - <int key="maxID">143</int> + <int key="maxID">145</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -1803,7 +1825,7 @@ <string key="superclassName">NSObject</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>orderFrontStandardAboutPanel:</string> <string>showPreferences:</string> @@ -1816,7 +1838,7 @@ </object> <object class="NSMutableDictionary" key="outlets"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>closeTabMenuItem_</string> <string>closeWindowMenuItem_</string> @@ -1889,7 +1911,7 @@ <string key="superclassName">NSObject</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>commandDispatch:</string> <string>commandDispatchUsingKeyModifiers:</string> @@ -1910,7 +1932,7 @@ <string key="superclassName">NSObject</string> <object class="NSMutableDictionary" key="outlets"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>otherObjectToLocalize_</string> <string>owner_</string> @@ -1981,7 +2003,7 @@ <string key="superclassName">NSWindowController</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>addHomepage:</string> <string>browseDownloadLocation:</string> @@ -2020,7 +2042,7 @@ </object> <object class="NSMutableDictionary" key="outlets"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>basicsGroupDefaultBrowser_</string> <string>basicsGroupHomePage_</string> @@ -2097,7 +2119,7 @@ <string key="superclassName">NSViewController</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>closeTab:</string> <string>commandDispatch:</string> @@ -2110,7 +2132,7 @@ </object> <object class="NSMutableDictionary" key="outlets"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>closeButton_</string> <string>contextMenu_</string> @@ -2153,9 +2175,10 @@ <string key="superclassName">NSViewController</string> <object class="NSMutableDictionary" key="outlets"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>backButton_</string> + <string>browserActionContainerView_</string> <string>encodingMenu_</string> <string>forwardButton_</string> <string>goButton_</string> @@ -2170,6 +2193,7 @@ <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>DelayedMenuButton</string> + <string>NSView</string> <string>NSMenu</string> <string>DelayedMenuButton</string> <string>NSButton</string> @@ -2204,8 +2228,810 @@ </object> </object> </object> + <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBPartialClassDescription"> + <string key="className">NSActionCell</string> + <string key="superclassName">NSCell</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSActionCell.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSApplication</string> + <string key="superclassName">NSResponder</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="448931471"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSApplication.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSApplication</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="24911859"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSApplicationScripting.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSApplication</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="333010959"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSColorPanel.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSApplication</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSHelpManager.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSApplication</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSPageLayout.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSArray</string> + <string key="superclassName">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSArray.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSArray</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="758534001"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSArray</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="31693783"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSArray</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSPathUtilities.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSArray</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSPredicate.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSArray</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSSortDescriptor.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSArrayController</string> + <string key="superclassName">NSObjectController</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSArrayController.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSButton</string> + <string key="superclassName">NSControl</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSButton.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSButtonCell</string> + <string key="superclassName">NSActionCell</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSButtonCell.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSCell</string> + <string key="superclassName">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSCell.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSControl</string> + <string key="superclassName">NSView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="495848827"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSControl.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSController</string> + <string key="superclassName">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSController.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSFormatter</string> + <string key="superclassName">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSFormatter.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSMenu</string> + <string key="superclassName">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="746478996"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSMenu.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSMenuItem</string> + <string key="superclassName">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="248912629"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSMenuItem.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSMovieView</string> + <string key="superclassName">NSView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSMovieView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSAccessibility.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSAlert.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSAnimation.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <reference key="sourceIdentifier" ref="448931471"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <reference key="sourceIdentifier" ref="24911859"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSBrowser.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <reference key="sourceIdentifier" ref="333010959"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSComboBox.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSComboBoxCell.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <reference key="sourceIdentifier" ref="495848827"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSDatePickerCell.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSDictionaryController.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSDragging.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="695193368"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSDrawer.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSFontManager.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSFontPanel.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSImage.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSKeyValueBinding.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <reference key="sourceIdentifier" ref="746478996"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSNibLoading.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSOutlineView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSPasteboard.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSRuleEditor.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSSavePanel.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSSound.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSSpeechRecognizer.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSSpeechSynthesizer.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSSplitView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSTabView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSTableView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="848836323"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSText.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSTextStorage.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSTextView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSTokenField.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSTokenFieldCell.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="5306983"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSToolbar.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSToolbarItem.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="78763847"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="137514384"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSWindow.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSArchiver.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSClassDescription.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSConnection.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSError.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <reference key="sourceIdentifier" ref="758534001"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <reference key="sourceIdentifier" ref="31693783"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSMetadata.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSNetServices.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSObject.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSObjectScripting.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSPort.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSPortCoder.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSScriptClassDescription.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSScriptKeyValueCoding.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSScriptObjectSpecifiers.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSScriptWhoseTests.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSSpellServer.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSStream.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSThread.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSURL.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSURLDownload.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSXMLParser.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Print.framework/Headers/PDEPluginInterface.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">QuartzCore.framework/Headers/CAAnimation.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">QuartzCore.framework/Headers/CALayer.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">QuartzCore.framework/Headers/CIImageProvider.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">SecurityInterface.framework/Headers/SFAuthorizationView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">SecurityInterface.framework/Headers/SFCertificatePanel.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">SecurityInterface.framework/Headers/SFChooseIdentityPanel.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObjectController</string> + <string key="superclassName">NSController</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSObjectController.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSPathControl</string> + <string key="superclassName">NSControl</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSPathControl.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSResponder</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSInterfaceStyle.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSResponder</string> + <string key="superclassName">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSResponder.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSScrollView</string> + <string key="superclassName">NSView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSScrollView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSText</string> + <string key="superclassName">NSView</string> + <reference key="sourceIdentifier" ref="848836323"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSTextField</string> + <string key="superclassName">NSControl</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSTextField.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSTextFieldCell</string> + <string key="superclassName">NSActionCell</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSTextFieldCell.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSToolbar</string> + <string key="superclassName">NSObject</string> + <reference key="sourceIdentifier" ref="5306983"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSUserDefaultsController</string> + <string key="superclassName">NSController</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSUserDefaultsController.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSClipView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSView</string> + <reference key="sourceIdentifier" ref="248912629"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSRulerView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSView</string> + <string key="superclassName">NSResponder</string> + <reference key="sourceIdentifier" ref="78763847"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSViewController</string> + <string key="superclassName">NSResponder</string> + <object class="NSMutableDictionary" key="outlets"> + <string key="NS.key.0">view</string> + <string key="NS.object.0">NSView</string> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSViewController.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSWindow</string> + <reference key="sourceIdentifier" ref="695193368"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSWindow</string> + <string key="superclassName">NSResponder</string> + <reference key="sourceIdentifier" ref="137514384"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSWindow</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSWindowScripting.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSWindowController</string> + <string key="superclassName">NSResponder</string> + <object class="NSMutableDictionary" key="actions"> + <string key="NS.key.0">showWindow:</string> + <string key="NS.object.0">id</string> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSWindowController.h</string> + </object> + </object> + </object> </object> <int key="IBDocument.localizationMode">0</int> + <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies"> + <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string> + <integer value="1050" key="NS.object.0"/> + </object> + <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults"> + <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string> + <integer value="1050" key="NS.object.0"/> + </object> + <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies"> + <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string> + <integer value="3000" key="NS.object.0"/> + </object> + <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool> <string key="IBDocument.LastKnownRelativeProjectPath">../../chrome.xcodeproj</string> <int key="IBDocument.defaultPropertyAccessControl">3</int> </data> diff --git a/chrome/browser/cocoa/extensions/browser_actions_controller.h b/chrome/browser/cocoa/extensions/browser_actions_controller.h new file mode 100644 index 0000000..eb026c1 --- /dev/null +++ b/chrome/browser/cocoa/extensions/browser_actions_controller.h @@ -0,0 +1,76 @@ +// 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_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_ +#define CHROME_BROWSER_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_ + +#import <Cocoa/Cocoa.h> + +#import "base/scoped_nsobject.h" +#include "base/scoped_ptr.h" + +class Browser; +@class BrowserActionButton; +class Extension; +class ExtensionsServiceObserverBridge; +class Profile; + +extern const CGFloat kBrowserActionButtonPadding; +extern const CGFloat kBrowserActionWidth; + +extern NSString* const kBrowserActionsChangedNotification; + +@interface BrowserActionsController : NSObject { + @private + // Reference to the current browser. Weak. + Browser* browser_; + + // The view from Toolbar.xib we'll be rendering our browser actions in. Weak. + NSView* containerView_; + + // The current profile. Weak. + Profile* profile_; + + // The observer for the ExtensionsService we're getting events from. + scoped_ptr<ExtensionsServiceObserverBridge> observer_; + + // A dictionary of Extension ID -> BrowserActionButton pairs representing the + // buttons present in the container view. The ID is a string unique to each + // extension. + scoped_nsobject<NSMutableDictionary> buttons_; + + // The order of the BrowserActionButton objects within the dictionary. + scoped_nsobject<NSMutableArray> buttonOrder_; +} + +// Initializes the controller given the current browser and container view that +// will hold the browser action buttons. +- (id)initWithBrowser:(Browser*)browser + containerView:(NSView*)container; + +// Creates and appends any existing browser action buttons present within the +// extensions service to the toolbar. +- (void)createButtons; + +// Hides the browser action's popup menu (if one is present and visible). +- (void)hidePopup; + +// Marks the container view for redraw. Called by the extension service +// notification bridge. +- (void)browserActionVisibilityHasChanged; + +// Returns the current number of browser action buttons displayed in the +// container. +- (int)buttonCount; + +// Executes the action designated by the extension. +- (void)browserActionClicked:(BrowserActionButton*)sender; + +// Returns the current ID of the active tab, -1 in the case where the user is in +// incognito mode. +- (int)currentTabId; + +@end // @interface BrowserActionsController + +#endif // CHROME_BROWSER_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_ diff --git a/chrome/browser/cocoa/extensions/browser_actions_controller.mm b/chrome/browser/cocoa/extensions/browser_actions_controller.mm new file mode 100644 index 0000000..bf7707f --- /dev/null +++ b/chrome/browser/cocoa/extensions/browser_actions_controller.mm @@ -0,0 +1,421 @@ +// 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 "browser_actions_controller.h" + +#include <string> + +#include "app/gfx/canvas_paint.h" +#include "base/sys_string_conversions.h" +#include "chrome/browser/browser.h" +#include "chrome/browser/cocoa/toolbar_button_cell.h" +#include "chrome/browser/extensions/extension_browser_event_router.h" +#include "chrome/browser/extensions/extensions_service.h" +#include "chrome/browser/extensions/extension_tabs_module.h" +#include "chrome/browser/extensions/image_loading_tracker.h" +#include "chrome/browser/profile.h" +#include "chrome/browser/tab_contents/tab_contents.h" +#include "chrome/common/notification_observer.h" +#include "chrome/common/notification_registrar.h" +#include "skia/ext/skia_utils_mac.h" + +static const CGFloat kBrowserActionBadgeOriginYOffset = -4; + +// Since the container is the maximum height of the toolbar, we have to move the +// buttons up by this amount in order to have them look vertically centered +// within the toolbar. +static const CGFloat kBrowserActionOriginYOffset = 5; + +// The size of each button on the toolbar. +static const CGFloat kBrowserActionHeight = 27; +extern const CGFloat kBrowserActionWidth = 29; + +// The padding between browser action buttons. +extern const CGFloat kBrowserActionButtonPadding = 3; + +NSString* const kBrowserActionsChangedNotification = @"BrowserActionsChanged"; + +@interface BrowserActionBadgeView : NSView { + @private + // The current tab ID used when drawing the badge. + int tabId_; + + // The action we're drawing the badge for. Weak. + ExtensionAction* extensionAction_; +} + +@property(readwrite, nonatomic) int tabId; +@property(readwrite, nonatomic) ExtensionAction* extensionAction; + +@end + +@implementation BrowserActionBadgeView + +- (void)drawRect:(NSRect)dirtyRect { + // CanvasPaint draws its content to the current NSGraphicsContext in its + // destructor. If anything needs to be drawn afterwards, then enclose this + // in a nested block. + NSRect badgeBounds = [self bounds]; + badgeBounds.origin.y += kBrowserActionBadgeOriginYOffset; + gfx::CanvasPaint canvas(badgeBounds, false); + canvas.set_composite_alpha(true); + gfx::Rect boundingRect(NSRectToCGRect(badgeBounds)); + extensionAction_->PaintBadge(&canvas, boundingRect, tabId_); +} + +@synthesize tabId = tabId_; +@synthesize extensionAction = extensionAction_; + +@end + +class ExtensionImageTrackerBridge; + +@interface BrowserActionButton : NSButton { + @private + scoped_ptr<ExtensionImageTrackerBridge> imageLoadingBridge_; + + scoped_nsobject<NSImage> defaultIcon_; + + scoped_nsobject<NSImage> tabSpecificIcon_; + + scoped_nsobject<NSView> badgeView_; + + // The extension for this button. Weak. + Extension* extension_; + + // Weak. Owns us. + BrowserActionsController* controller_; +} + +- (id)initWithExtension:(Extension*)extension + controller:(BrowserActionsController*)controller + xOffset:(int)xOffset; + +- (void)setDefaultIcon:(NSImage*)image; + +- (void)setTabSpecificIcon:(NSImage*)image; + +- (void)updateState; + +@property(readonly, nonatomic) Extension* extension; + +@end + +// A helper class to bridge the asynchronous Skia bitmap loading mechanism to +// the extension's button. +class ExtensionImageTrackerBridge : public NotificationObserver, + public ImageLoadingTracker::Observer { + public: + ExtensionImageTrackerBridge(BrowserActionButton* owner, Extension* extension) + : owner_(owner), + tracker_(NULL) { + // The Browser Action API does not allow the default icon path to be + // changed at runtime, so we can load this now and cache it. + std::string path = extension->browser_action()->default_icon_path(); + if (!path.empty()) { + tracker_ = new ImageLoadingTracker(this, 1); + tracker_->PostLoadImageTask(extension->GetResource(path), + gfx::Size(Extension::kBrowserActionIconMaxSize, + Extension::kBrowserActionIconMaxSize)); + } + registrar_.Add(this, NotificationType::EXTENSION_BROWSER_ACTION_UPDATED, + Source<ExtensionAction>(extension->browser_action())); + } + + ~ExtensionImageTrackerBridge() { + if (tracker_) + tracker_->StopTrackingImageLoad(); + } + + // ImageLoadingTracker::Observer implementation. + void OnImageLoaded(SkBitmap* image, size_t index) { + if (image) + [owner_ setDefaultIcon:gfx::SkBitmapToNSImage(*image)]; + tracker_ = NULL; + [owner_ updateState]; + } + + // Overridden from NotificationObserver. + void Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details) { + if (type == NotificationType::EXTENSION_BROWSER_ACTION_UPDATED) + [owner_ updateState]; + else + NOTREACHED(); + } + + private: + // Weak. Owns us. + BrowserActionButton* owner_; + + // Loads the button's icons for us on the file thread. Weak. + ImageLoadingTracker* tracker_; + + // Used for registering to receive notifications and automatic clean up. + NotificationRegistrar registrar_; + + DISALLOW_COPY_AND_ASSIGN(ExtensionImageTrackerBridge); +}; + +@implementation BrowserActionButton + +- (id)initWithExtension:(Extension*)extension + controller:(BrowserActionsController*)controller + xOffset:(int)xOffset { + NSRect frame = NSMakeRect(xOffset, + kBrowserActionOriginYOffset, + kBrowserActionWidth, + kBrowserActionHeight); + if ((self = [super initWithFrame:frame])) { + ToolbarButtonCell* cell = [[[ToolbarButtonCell alloc] init] autorelease]; + // [NSButton setCell:] warns to NOT use setCell: other than in the + // initializer of a control. However, we are using a basic + // NSButton whose initializer does not take an NSCell as an + // object. To honor the assumed semantics, we do nothing with + // NSButton between alloc/init and setCell:. + [self setCell:cell]; + [self setTitle:@""]; + [self setButtonType:NSMomentaryChangeButton]; + [self setShowsBorderOnlyWhileMouseInside:YES]; + + [self setTarget:controller]; + [self setAction:@selector(browserActionClicked:)]; + + extension_ = extension; + controller_ = controller; + imageLoadingBridge_.reset(new ExtensionImageTrackerBridge(self, extension)); + + NSRect badgeFrame = [self bounds]; + badgeView_.reset([[BrowserActionBadgeView alloc] initWithFrame:badgeFrame]); + [badgeView_ setTabId:[controller currentTabId]]; + [badgeView_ setExtensionAction:extension->browser_action()]; + [self addSubview:badgeView_]; + + [self updateState]; + } + + return self; +} + +- (void)setDefaultIcon:(NSImage*)image { + defaultIcon_.reset([image retain]); +} + +- (void)setTabSpecificIcon:(NSImage*)image { + tabSpecificIcon_.reset([image retain]); +} + +- (void)updateState { + int tabId = [controller_ currentTabId]; + if (tabId < 0) + return; + + std::string tooltip = extension_->browser_action()->GetTitle(tabId); + if (!tooltip.empty()) + [self setToolTip:base::SysUTF8ToNSString(tooltip)]; + + SkBitmap image = extension_->browser_action()->GetIcon(tabId); + if (!image.isNull()) { + [self setTabSpecificIcon:gfx::SkBitmapToNSImage(image)]; + [self setImage:tabSpecificIcon_]; + } else if (defaultIcon_) { + [self setImage:defaultIcon_]; + } + + [badgeView_ setTabId:tabId]; + + [self setNeedsDisplay:YES]; +} + +@synthesize extension = extension_; + +@end + +@interface BrowserActionsController(Private) + +- (void)createActionButtonForExtension:(Extension*)extension; +- (void)removeActionButtonForExtension:(Extension*)extension; +- (void)repositionActionButtons; + +@end + +// A helper class to proxy extension notifications to the view controller's +// appropriate methods. +class ExtensionsServiceObserverBridge : public NotificationObserver { + public: + ExtensionsServiceObserverBridge(BrowserActionsController* owner, + Profile* profile) : owner_(owner) { + registrar_.Add(this, NotificationType::EXTENSION_LOADED, + Source<Profile>(profile)); + registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, + Source<Profile>(profile)); + registrar_.Add(this, NotificationType::EXTENSION_UNLOADED_DISABLED, + Source<Profile>(profile)); + registrar_.Add(this, NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE, + Source<Profile>(profile)); + } + + // Runs |owner_|'s method corresponding to the event type received from the + // notification system. + // Overridden from NotificationObserver. + void Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details) { + switch (type.value) { + case NotificationType::EXTENSION_LOADED: { + Extension* extension = Details<Extension>(details).ptr(); + [owner_ createActionButtonForExtension:extension]; + [owner_ browserActionVisibilityHasChanged]; + break; + } + case NotificationType::EXTENSION_UNLOADED: + case NotificationType::EXTENSION_UNLOADED_DISABLED: { + Extension* extension = Details<Extension>(details).ptr(); + [owner_ removeActionButtonForExtension:extension]; + [owner_ browserActionVisibilityHasChanged]; + break; + } + case NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE: + //if (Details<ExtensionHost>(popup_->host()) != details) + // return; + [owner_ hidePopup]; + break; + default: + NOTREACHED() << L"Unexpected notification"; + } + } + + private: + // The object we need to inform when we get a notification. Weak. Owns us. + BrowserActionsController* owner_; + + // Used for registering to receive notifications and automatic clean up. + NotificationRegistrar registrar_; + + DISALLOW_COPY_AND_ASSIGN(ExtensionsServiceObserverBridge); +}; + +@implementation BrowserActionsController + +- (id)initWithBrowser:(Browser*)browser + containerView:(NSView*)container { + DCHECK(browser && container); + + if ((self = [super init])) { + browser_ = browser; + profile_ = browser->profile(); + + containerView_ = container; + [containerView_ setHidden:YES]; + observer_.reset(new ExtensionsServiceObserverBridge(self, profile_)); + buttons_.reset([[NSMutableDictionary alloc] init]); + buttonOrder_.reset([[NSMutableArray alloc] init]); + } + + return self; +} + +- (void)hidePopup { + NOTIMPLEMENTED(); +} + +- (void)browserActionVisibilityHasChanged { + [containerView_ setNeedsDisplay:YES]; +} + +- (void)createButtons { + ExtensionsService* extensionsService = profile_->GetExtensionsService(); + if (!extensionsService) // |extensionsService| can be NULL in Incognito. + return; + + for (size_t i = 0; i < extensionsService->extensions()->size(); ++i) { + Extension* extension = extensionsService->GetExtensionById( + extensionsService->extensions()->at(i)->id(), false); + if (extension->browser_action()) { + [self createActionButtonForExtension:extension]; + } + } +} + +- (void)createActionButtonForExtension:(Extension*)extension { + if (!extension->browser_action()) + return; + + if ([buttons_ count] == 0) { + // Only call if we're adding our first button, otherwise it will be shown + // already. + [containerView_ setHidden:NO]; + } + + int xOffset = + [buttons_ count] * (kBrowserActionWidth + kBrowserActionButtonPadding); + BrowserActionButton* newButton = + [[[BrowserActionButton alloc] initWithExtension:extension + controller:self + xOffset:xOffset] autorelease]; + NSString* buttonKey = base::SysUTF8ToNSString(extension->id()); + [buttons_ setObject:newButton forKey:buttonKey]; + [buttonOrder_ addObject:newButton]; + [containerView_ addSubview:newButton]; + + [[NSNotificationCenter defaultCenter] + postNotificationName:kBrowserActionsChangedNotification object:self]; +} + +- (void)removeActionButtonForExtension:(Extension*)extension { + NSString* buttonKey = base::SysUTF8ToNSString(extension->id()); + + BrowserActionButton* button = [buttons_ objectForKey:buttonKey]; + [button removeFromSuperview]; + [buttons_ removeObjectForKey:buttonKey]; + [buttonOrder_ removeObject:button]; + if ([buttons_ count] == 0) { + // No more buttons? Hide the container. + [containerView_ setHidden:YES]; + } else { + // repositionActionButtons only needs to be called if removing a browser + // action button because adding one will always append to the end of the + // container, while removing one may require that those to the right of it + // be shifted to the left. + [self repositionActionButtons]; + } + [[NSNotificationCenter defaultCenter] + postNotificationName:kBrowserActionsChangedNotification object:self]; +} + +- (void)repositionActionButtons { + for (NSUInteger i = 0; i < [buttonOrder_ count]; ++i) { + CGFloat xOffset = i * (kBrowserActionWidth + kBrowserActionButtonPadding); + BrowserActionButton* button = [buttonOrder_ objectAtIndex:i]; + NSRect buttonFrame = [button frame]; + buttonFrame.origin.x = xOffset; + [button setFrame:buttonFrame]; + } +} + +- (int)buttonCount { + return [buttons_ count]; +} + +- (void)browserActionClicked:(BrowserActionButton*)sender { + ExtensionAction* action = [sender extension]->browser_action(); + if (action->has_popup()) { + // Popups are not implemented for Mac yet. + NOTIMPLEMENTED(); + } else { + ExtensionBrowserEventRouter::GetInstance()->BrowserActionExecuted( + profile_, action->extension_id(), browser_); + } +} + +- (int)currentTabId { + TabContents* selected_tab = browser_->GetSelectedTabContents(); + if (!selected_tab) + return -1; + + return selected_tab->controller().session_id().id(); +} + +@end diff --git a/chrome/browser/cocoa/toolbar_controller.h b/chrome/browser/cocoa/toolbar_controller.h index 6af4241..991ff39 100644 --- a/chrome/browser/cocoa/toolbar_controller.h +++ b/chrome/browser/cocoa/toolbar_controller.h @@ -20,6 +20,7 @@ @class BackForwardMenuController; @class BackgroundGradientView; class Browser; +@class BrowserActionsController; class BubblePositioner; class CommandUpdater; @class DelayedMenuButton; @@ -52,6 +53,7 @@ class ToolbarView; id<ViewResizer> resizeDelegate_; // weak scoped_nsobject<BackForwardMenuController> backMenuController_; scoped_nsobject<BackForwardMenuController> forwardMenuController_; + scoped_nsobject<BrowserActionsController> browserActionsController_; // Used for monitoring the optional toolbar button prefs. scoped_ptr<ToolbarControllerInternal::PrefObserverBridge> prefObserver_; @@ -88,6 +90,7 @@ class ToolbarView; IBOutlet MenuButton* wrenchButton_; IBOutlet AutocompleteTextField* locationBar_; IBOutlet NSMenu* encodingMenu_; + IBOutlet NSView* browserActionContainerView_; } // Initialize the toolbar and register for command updates. The profile is diff --git a/chrome/browser/cocoa/toolbar_controller.mm b/chrome/browser/cocoa/toolbar_controller.mm index ac896f8..9092b51 100644 --- a/chrome/browser/cocoa/toolbar_controller.mm +++ b/chrome/browser/cocoa/toolbar_controller.mm @@ -16,6 +16,7 @@ #import "chrome/browser/cocoa/autocomplete_text_field_editor.h" #import "chrome/browser/cocoa/back_forward_menu_controller.h" #import "chrome/browser/cocoa/encoding_menu_controller_delegate_mac.h" +#import "chrome/browser/cocoa/extensions/browser_actions_controller.h" #import "chrome/browser/cocoa/gradient_button_cell.h" #import "chrome/browser/cocoa/location_bar_view_mac.h" #import "chrome/browser/cocoa/menu_button.h" @@ -50,6 +51,8 @@ static const float kBookmarkBarOverlap = 6.0; @interface ToolbarController(Private) - (void)initCommandStatus:(CommandUpdater*)commands; - (void)prefChanged:(std::wstring*)prefName; +- (void)browserActionsChanged; +- (void)adjustLocationAndGoPositionsBy:(CGFloat)dX; @end namespace { @@ -126,6 +129,8 @@ class PrefObserverBridge : public NotificationObserver { // the "parent" view continues to work. hasToolbar_ = YES; + [[NSNotificationCenter defaultCenter] removeObserver:self]; + if (trackingArea_.get()) [[self view] removeTrackingArea:trackingArea_.get()]; [super dealloc]; @@ -178,7 +183,18 @@ class PrefObserverBridge : public NotificationObserver { initWithBrowser:browser_ modelType:BACK_FORWARD_MENU_TYPE_FORWARD button:forwardButton_]); - + browserActionsController_.reset([[BrowserActionsController alloc] + initWithBrowser:browser_ + containerView:browserActionContainerView_]); + // When new browser actions are added/removed, the container view for them is + // resized, necessitating the probable resizing of surrounding elements + // handled by this controller. + [[NSNotificationCenter defaultCenter] + addObserver:self + selector:@selector(browserActionsChanged) + name:kBrowserActionsChangedNotification + object:browserActionsController_]; + [browserActionsController_ createButtons]; // For a popup window, the toolbar is really just a location bar // (see override for [ToolbarController view], below). When going // fullscreen, we remove the toolbar controller's view from the view @@ -362,13 +378,13 @@ class PrefObserverBridge : public NotificationObserver { - (NSArray*)toolbarViews { return [NSArray arrayWithObjects:backButton_, forwardButton_, reloadButton_, homeButton_, starButton_, goButton_, pageButton_, wrenchButton_, - locationBar_, encodingMenu_, nil]; + locationBar_, encodingMenu_, browserActionContainerView_, nil]; } // Moves |rect| to the right by |delta|, keeping the right side fixed by // shrinking the width to compensate. Passing a negative value for |deltaX| // moves to the left and increases the width. -- (NSRect)adjustRect:(NSRect)rect byAmount:(float)deltaX { +- (NSRect)adjustRect:(NSRect)rect byAmount:(CGFloat)deltaX { NSRect frame = NSOffsetRect(rect, deltaX, 0); frame.size.width -= deltaX; return frame; @@ -377,7 +393,7 @@ class PrefObserverBridge : public NotificationObserver { // Computes the padding between the buttons that should have a separation from // the positions in the nib. Since the forward and reload buttons are always // visible, we use those buttons as the canonical spacing. -- (float)interButtonSpacing { +- (CGFloat)interButtonSpacing { NSRect forwardFrame = [forwardButton_ frame]; NSRect reloadFrame = [reloadButton_ frame]; DCHECK(NSMinX(reloadFrame) > NSMaxX(forwardFrame)); @@ -396,7 +412,7 @@ class PrefObserverBridge : public NotificationObserver { // Always shift the star and text field by the width of the home button plus // the appropriate gap width. If we're hiding the button, we have to // reverse the direction of the movement (to the left). - float moveX = [self interButtonSpacing] + [homeButton_ frame].size.width; + CGFloat moveX = [self interButtonSpacing] + [homeButton_ frame].size.width; if (hide) moveX *= -1; // Reverse the direction of the move. @@ -421,14 +437,20 @@ class PrefObserverBridge : public NotificationObserver { // buttons, we have to reverse the direction of movement (to the left). Unlike // the home button above, we only ever have to resize the text field, we don't // have to move it. - float moveX = 2 * [self interButtonSpacing] + NSWidth([pageButton_ frame]) + - NSWidth([wrenchButton_ frame]); + CGFloat moveX = 2 * [self interButtonSpacing] + NSWidth([pageButton_ frame]) + + NSWidth([wrenchButton_ frame]); + + // Adjust for the extra unit of inter-button spacing added when the page and + // wrench buttons are hidden. + if ([browserActionsController_ buttonCount] > 0) + moveX -= [self interButtonSpacing]; + if (!hide) moveX *= -1; // Reverse the direction of the move. - [goButton_ setFrame:NSOffsetRect([goButton_ frame], moveX, 0)]; - NSRect locationFrame = [locationBar_ frame]; - locationFrame.size.width += moveX; - [locationBar_ setFrame:locationFrame]; + + [self adjustLocationAndGoPositionsBy:moveX]; + [browserActionContainerView_ setFrame:NSOffsetRect( + [browserActionContainerView_ frame], moveX, 0)]; [pageButton_ setHidden:hide]; [wrenchButton_ setHidden:hide]; @@ -443,6 +465,50 @@ class PrefObserverBridge : public NotificationObserver { } } +- (void)browserActionsChanged { + // Calculate the new width. + int buttonCount = [browserActionsController_ buttonCount]; + + CGFloat width = 0.0; + if (buttonCount > 0) { + width = (buttonCount * + (kBrowserActionWidth + kBrowserActionButtonPadding)) - + kBrowserActionButtonPadding; // No padding after last button. + } + + NSRect containerFrame = [browserActionContainerView_ frame]; + CGFloat buttonSpacing = [self interButtonSpacing]; + CGFloat dX = containerFrame.size.width - width; + containerFrame.size.width = width; + + bool addingButton = (dX < 0); + // If a button is being added, add spacing inward by negating the value. + if (addingButton) + buttonSpacing *= -1; + + // If the first button is being added or the last button is being removed, + // then account for the right padding it will need. + if ((buttonCount == 1 && addingButton) || + (buttonCount == 0 && !addingButton)) { + dX += buttonSpacing; + // The offset of the buttons from the right side will be one button spacing + // unit more than if the wrench and page buttons were shown. + if ([pageButton_ isHidden] && [wrenchButton_ isHidden]) { + dX += buttonSpacing; + } + } + + [browserActionContainerView_ setFrame:NSOffsetRect(containerFrame, dX, 0)]; + [self adjustLocationAndGoPositionsBy:dX]; +} + +- (void)adjustLocationAndGoPositionsBy:(CGFloat)dX { + [goButton_ setFrame:NSOffsetRect([goButton_ frame], dX, 0)]; + NSRect locationFrame = [locationBar_ frame]; + locationFrame.size.width += dX; + [locationBar_ setFrame:locationFrame]; +} + - (NSRect)starButtonInWindowCoordinates { return [[[starButton_ window] contentView] convertRect:[starButton_ bounds] fromView:starButton_]; diff --git a/chrome/browser/cocoa/toolbar_controller_unittest.mm b/chrome/browser/cocoa/toolbar_controller_unittest.mm index 4b96644..5c731fd 100644 --- a/chrome/browser/cocoa/toolbar_controller_unittest.mm +++ b/chrome/browser/cocoa/toolbar_controller_unittest.mm @@ -44,7 +44,8 @@ class ToolbarControllerTest : public PlatformTest { // |-toolbarViews| method. enum { kBackIndex, kForwardIndex, kReloadIndex, kHomeIndex, kStarIndex, kGoIndex, - kPageIndex, kWrenchIndex, kLocationIndex, kEncodingMenuIndex + kPageIndex, kWrenchIndex, kLocationIndex, kEncodingMenuIndex, + kBrowserActionContainerViewIndex }; ToolbarControllerTest() { diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 8ded5582..cc5c492 100755 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -1143,6 +1143,8 @@ 'browser/cocoa/extension_shelf_controller.mm', 'browser/cocoa/extension_view_mac.h', 'browser/cocoa/extension_view_mac.mm', + 'browser/cocoa/extensions/browser_actions_controller.h', + 'browser/cocoa/extensions/browser_actions_controller.mm', 'browser/cocoa/external_protocol_dialog.h', 'browser/cocoa/external_protocol_dialog.mm', 'browser/cocoa/fast_resize_view.h', diff --git a/chrome/common/extensions/extension_action.cc b/chrome/common/extensions/extension_action.cc index 13d6186..088e24c 100755 --- a/chrome/common/extensions/extension_action.cc +++ b/chrome/common/extensions/extension_action.cc @@ -23,24 +23,26 @@ const int kTextSize = 9; const int kBottomMargin = 0; const int kPadding = 2; const int kTopTextPadding = 0; -const int kBadgeHeight = 11; -const int kMaxTextWidth = 23; -// The minimum width for center-aligning the badge. -const int kCenterAlignThreshold = 20; +#elif defined(OS_MACOSX) +const int kTextSize = 9; +const int kBottomMargin = 5; +const int kPadding = 2; +const int kTopTextPadding = 0; #else const int kTextSize = 8; const int kBottomMargin = 5; const int kPadding = 2; // The padding between the top of the badge and the top of the text. const int kTopTextPadding = 1; +#endif + const int kBadgeHeight = 11; const int kMaxTextWidth = 23; // The minimum width for center-aligning the badge. const int kCenterAlignThreshold = 20; -#endif #if defined(OS_MACOSX) -const char kPreferredTypeface[] = "Helvetica"; +const char kPreferredTypeface[] = "Helvetica Bold"; #else const char kPreferredTypeface[] = "Arial"; #endif |