summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/app/nibs/BookmarkBar.xib805
-rw-r--r--chrome/browser/cocoa/bookmark_bar_controller.h6
-rw-r--r--chrome/browser/cocoa/bookmark_bar_controller.mm99
-rw-r--r--chrome/browser/cocoa/bookmark_bar_controller_unittest.mm77
-rw-r--r--chrome/browser/cocoa/bookmark_button_cell.mm9
-rw-r--r--chrome/browser/cocoa/bookmark_button_cell_unittest.mm16
-rw-r--r--chrome/browser/cocoa/bookmark_menu.h18
-rw-r--r--chrome/browser/cocoa/bookmark_menu.mm22
-rw-r--r--chrome/browser/cocoa/bookmark_menu_unittest.mm28
-rwxr-xr-xchrome/chrome.gyp9
10 files changed, 308 insertions, 781 deletions
diff --git a/chrome/app/nibs/BookmarkBar.xib b/chrome/app/nibs/BookmarkBar.xib
index 56d376b..5098893 100644
--- a/chrome/app/nibs/BookmarkBar.xib
+++ b/chrome/app/nibs/BookmarkBar.xib
@@ -1,19 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
-<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
+<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03">
<data>
<int key="IBDocument.SystemTarget">1050</int>
- <string key="IBDocument.SystemVersion">10B504</string>
- <string key="IBDocument.InterfaceBuilderVersion">732</string>
- <string key="IBDocument.AppKitVersion">1038.2</string>
- <string key="IBDocument.HIToolboxVersion">437.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>
+ <string key="IBDocument.SystemVersion">9L30</string>
+ <string key="IBDocument.InterfaceBuilderVersion">677</string>
+ <string key="IBDocument.AppKitVersion">949.54</string>
+ <string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="18"/>
<integer value="4"/>
+ <integer value="18"/>
<integer value="1"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
@@ -22,7 +18,7 @@
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys" id="0">
+ <object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
@@ -62,7 +58,7 @@
<string key="NSContents">^IDS_BOOKMARKS_NO_ITEMS</string>
<object class="NSFont" key="NSSupport">
<string key="NSName">LucidaGrande</string>
- <double key="NSSize">11</double>
+ <double key="NSSize">1.100000e+01</double>
<int key="NSfFlags">3100</int>
</object>
<reference key="NSControlView" ref="1013234954"/>
@@ -72,7 +68,7 @@
<string key="NSColorName">controlColor</string>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
+ <bytes key="NSWhite">MC42NjY2NjY2OQA</bytes>
</object>
</object>
<object class="NSColor" key="NSTextColor">
@@ -386,22 +382,6 @@
<object class="IBActionConnection" key="connection">
<string key="label">commandDispatch:</string>
<reference key="source" ref="1003"/>
- <reference key="destination" ref="112128065"/>
- </object>
- <int key="connectionID">35</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">commandDispatch:</string>
- <reference key="source" ref="1003"/>
- <reference key="destination" ref="168951506"/>
- </object>
- <int key="connectionID">36</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">commandDispatch:</string>
- <reference key="source" ref="1003"/>
<reference key="destination" ref="61770624"/>
</object>
<int key="connectionID">39</int>
@@ -654,32 +634,66 @@
</object>
<int key="connectionID">101</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="183701277"/>
+ <reference key="destination" ref="1001"/>
+ </object>
+ <int key="connectionID">102</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="672481054"/>
+ <reference key="destination" ref="1001"/>
+ </object>
+ <int key="connectionID">103</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">editBookmark:</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="112128065"/>
+ </object>
+ <int key="connectionID">104</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">deleteBookmark:</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="168951506"/>
+ </object>
+ <int key="connectionID">105</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>
- <reference key="object" ref="0"/>
+ <object class="NSArray" key="object" id="538603655">
+ <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="0"/>
- <string key="objectName">File's Owner</string>
+ <reference key="parent" ref="538603655"/>
+ <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="0"/>
+ <reference key="parent" ref="538603655"/>
<string key="objectName">First Responder</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-3</int>
<reference key="object" ref="1004"/>
- <reference key="parent" ref="0"/>
+ <reference key="parent" ref="538603655"/>
<string key="objectName">Application</string>
</object>
<object class="IBObjectRecord">
@@ -690,7 +704,7 @@
<reference ref="610146462"/>
<reference ref="1071220197"/>
</object>
- <reference key="parent" ref="0"/>
+ <reference key="parent" ref="538603655"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">4</int>
@@ -710,7 +724,7 @@
<reference ref="23014313"/>
<reference ref="149427359"/>
</object>
- <reference key="parent" ref="0"/>
+ <reference key="parent" ref="538603655"/>
<string key="objectName">Bar Menu</string>
</object>
<object class="IBObjectRecord">
@@ -792,7 +806,7 @@
<reference ref="1071747565"/>
<reference ref="377013426"/>
</object>
- <reference key="parent" ref="0"/>
+ <reference key="parent" ref="538603655"/>
<string key="objectName">Button Menu</string>
</object>
<object class="IBObjectRecord">
@@ -881,7 +895,7 @@
<object class="IBObjectRecord">
<int key="objectID">72</int>
<reference key="object" ref="849863465"/>
- <reference key="parent" ref="0"/>
+ <reference key="parent" ref="538603655"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">75</int>
@@ -890,7 +904,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="582055256"/>
</object>
- <reference key="parent" ref="0"/>
+ <reference key="parent" ref="538603655"/>
<string key="objectName">Off-the-side Menu</string>
</object>
<object class="IBObjectRecord">
@@ -921,7 +935,7 @@
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
+ <object class="NSMutableArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.IBPluginDependency</string>
<string>-2.IBPluginDependency</string>
@@ -935,6 +949,7 @@
<string>14.IBPluginDependency</string>
<string>15.IBPluginDependency</string>
<string>16.IBPluginDependency</string>
+ <string>18.CustomClassName</string>
<string>18.IBEditorWindowLastContentRect</string>
<string>18.IBPluginDependency</string>
<string>19.IBPluginDependency</string>
@@ -949,6 +964,7 @@
<string>28.IBPluginDependency</string>
<string>29.IBPluginDependency</string>
<string>30.IBPluginDependency</string>
+ <string>4.CustomClassName</string>
<string>4.IBEditorWindowLastContentRect</string>
<string>4.IBPluginDependency</string>
<string>5.IBPluginDependency</string>
@@ -983,7 +999,8 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{364, 332}, {362, 233}}</string>
+ <string>BookmarkMenu</string>
+ <string>{{364, 332}, {365, 233}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -997,7 +1014,8 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{64, 637}, {372, 213}}</string>
+ <string>BookmarkMenu</string>
+ <string>{{21, 637}, {375, 213}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -1020,7 +1038,9 @@
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
- <reference key="dict.sortedKeys" ref="0"/>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
@@ -1028,13 +1048,15 @@
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
- <reference key="dict.sortedKeys" ref="0"/>
+ <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">101</int>
+ <int key="maxID">105</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -1044,7 +1066,7 @@
<string key="superclassName">BackgroundGradientView</string>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
+ <object class="NSMutableArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>delegate_</string>
<string>resizeDelegate_</string>
@@ -1073,7 +1095,7 @@
<string key="superclassName">NSViewController</string>
<object class="NSMutableDictionary" key="actions">
<bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
+ <object class="NSMutableArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>addFolder:</string>
<string>addPage:</string>
@@ -1108,7 +1130,7 @@
</object>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
+ <object class="NSMutableArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>buttonContextMenu_</string>
<string>buttonView_</string>
@@ -1147,7 +1169,7 @@
<string key="superclassName">NSView</string>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
+ <object class="NSMutableArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>controller_</string>
<string>noItemTextfield_</string>
@@ -1172,6 +1194,14 @@
</object>
</object>
<object class="IBPartialClassDescription">
+ <string key="className">BookmarkMenu</string>
+ <string key="superclassName">NSMenu</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">browser/cocoa/bookmark_menu.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">ChromeUILocalizer</string>
<string key="superclassName">GTMUILocalizer</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
@@ -1196,7 +1226,7 @@
<string key="superclassName">NSObject</string>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
+ <object class="NSMutableArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>otherObjectToLocalize_</string>
<string>owner_</string>
@@ -1260,7 +1290,7 @@
<string key="superclassName">NSViewController</string>
<object class="NSMutableDictionary" key="actions">
<bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
+ <object class="NSMutableArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>closeTab:</string>
<string>commandDispatch:</string>
@@ -1273,7 +1303,7 @@
</object>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
+ <object class="NSMutableArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>closeButton_</string>
<string>contextMenu_</string>
@@ -1296,679 +1326,8 @@
</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="801885704">
- <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="447441832">
- <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="975965104">
- <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">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="110824619">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSControl.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="1018913278">
- <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="921599287">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSMenuItem.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="801885704"/>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <reference key="sourceIdentifier" ref="447441832"/>
- </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="975965104"/>
- </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="110824619"/>
- </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">
- <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="1018913278"/>
- </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">
- <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">
- <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="602172652">
- <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">
- <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>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.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/NSKeyValueObserving.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/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">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">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">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="921599287"/>
- </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="602172652"/>
- </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>
</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/bookmark_bar_controller.h b/chrome/browser/cocoa/bookmark_bar_controller.h
index c390893..648a9ad 100644
--- a/chrome/browser/cocoa/bookmark_bar_controller.h
+++ b/chrome/browser/cocoa/bookmark_bar_controller.h
@@ -19,6 +19,7 @@
class BookmarkModel;
class BookmarkNode;
@class BookmarkBarView;
+@class BookmarkMenu;
class Browser;
class GURL;
@class MenuButton;
@@ -127,6 +128,10 @@ willAnimateFromState:(bookmarks::VisualState)oldState
// "Other bookmarks" button on the right side.
scoped_nsobject<NSButton> otherBookmarksButton_;
+
+ // We have a special menu for folder buttons. This starts as a copy
+ // of the bar menu.
+ scoped_nsobject<BookmarkMenu> buttonFolderContextMenu_;
}
@property(readonly, nonatomic) bookmarks::VisualState visualState;
@@ -238,6 +243,7 @@ willAnimateFromState:(bookmarks::VisualState)oldState
- (NSMenu*)offTheSideMenu;
- (NSButton*)offTheSideButton;
- (NSButton*)otherBookmarksButton;
+- (BookmarkNode*)nodeFromMenuItem:(id)sender;
@end
#endif // CHROME_BROWSER_COCOA_BOOKMARK_BAR_CONTROLLER_H_
diff --git a/chrome/browser/cocoa/bookmark_bar_controller.mm b/chrome/browser/cocoa/bookmark_bar_controller.mm
index 3db0e8b..3694999 100644
--- a/chrome/browser/cocoa/bookmark_bar_controller.mm
+++ b/chrome/browser/cocoa/bookmark_bar_controller.mm
@@ -19,6 +19,7 @@
#import "chrome/browser/cocoa/bookmark_button_cell.h"
#import "chrome/browser/cocoa/bookmark_editor_controller.h"
#import "chrome/browser/cocoa/bookmark_name_folder_controller.h"
+#import "chrome/browser/cocoa/bookmark_menu.h"
#import "chrome/browser/cocoa/bookmark_menu_cocoa_controller.h"
#import "chrome/browser/cocoa/event_utils.h"
#import "chrome/browser/cocoa/menu_button.h"
@@ -118,6 +119,7 @@ const NSTimeInterval kBookmarkBarAnimationDuration = 0.12;
}
@end
+
@interface BookmarkBarController(Private)
// Determines the appropriate state for the given situation.
+ (bookmarks::VisualState)visualStateToShowNormalBar:(BOOL)showNormalBar
@@ -157,6 +159,7 @@ const NSTimeInterval kBookmarkBarAnimationDuration = 0.12;
- (void)resizeButtons;
- (void)centerNoItemsLabel;
- (NSImage*)getFavIconForNode:(const BookmarkNode*)node;
+- (void)setNodeForBarMenu;
@end
@implementation BookmarkBarController
@@ -215,10 +218,6 @@ const NSTimeInterval kBookmarkBarAnimationDuration = 0.12;
// We are enabled by default.
barIsEnabled_ = YES;
- // Don't pass ourself along (as 'self') until our init is completely
- // done. Thus, this call is (almost) last.
- bridge_.reset(new BookmarkBarBridge(self, bookmarkModel_));
-
DCHECK([offTheSideButton_ attachedMenu]);
// To make life happier when the bookmark bar is floating, the chevron is a
@@ -226,6 +225,10 @@ const NSTimeInterval kBookmarkBarAnimationDuration = 0.12;
[offTheSideButton_ removeFromSuperview];
[buttonView_ addSubview:offTheSideButton_];
+ // Copy the bar menu so we know if it's from the bar or a folder.
+ // Then we set its represented item to be the bookmark bar.
+ buttonFolderContextMenu_.reset([[[self view] menu] copy]);
+
// When resized we may need to add new buttons, or remove them (if
// no longer visible), or add/remove the "off the side" menu.
[[self view] setPostsFrameChangedNotifications:YES];
@@ -234,6 +237,10 @@ const NSTimeInterval kBookmarkBarAnimationDuration = 0.12;
selector:@selector(frameDidChange)
name:NSViewFrameDidChangeNotification
object:[self view]];
+
+ // Don't pass ourself along (as 'self') until our init is completely
+ // done. Thus, this call is (almost) last.
+ bridge_.reset(new BookmarkBarBridge(self, bookmarkModel_));
}
// (Private) Method is the same as [self view], but is provided to be explicit.
@@ -469,16 +476,6 @@ const NSTimeInterval kBookmarkBarAnimationDuration = 0.12;
return browser_->profile()->GetThemeProvider();
}
-// Return nil if menuItem has no delegate.
-- (BookmarkNode*)nodeFromMenuItem:(id)menuItem {
- NSCell* cell = reinterpret_cast<NSCell*>([[menuItem menu] delegate]);
- if (!cell)
- return nil;
- BookmarkNode* node = static_cast<BookmarkNode*>(
- [[cell representedObject] pointerValue]);
- return node;
-}
-
- (BookmarkNode*)nodeFromButton:(id)button {
NSCell* cell = [button cell];
BookmarkNode* node = static_cast<BookmarkNode*>(
@@ -487,16 +484,47 @@ const NSTimeInterval kBookmarkBarAnimationDuration = 0.12;
return node;
}
-// At this time, the only items which ever get disabled are the "Open All
-// Bookmarks" options.
-- (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item {
+// Enable or disable items. We are the menu delegate for both the bar
+// and for bookmark folder buttons.
+- (BOOL)validateUserInterfaceItem:(id)item {
+ if (![item isKindOfClass:[NSMenuItem class]])
+ return YES;
+
+ BookmarkNode* node = [self nodeFromMenuItem:item];
+
+ // If this is the bar menu, we only have things to do if there are
+ // buttons. If this is a folder button menu, we only have things to
+ // do if the folder has items.
+ NSMenu* menu = [item menu];
+ BOOL thingsToDo = NO;
+ if (menu == [[self view] menu]) {
+ thingsToDo = [buttons_ count] ? YES : NO;
+ } else {
+ if (node && node->is_folder() && node->GetChildCount()) {
+ thingsToDo = YES;
+ }
+ }
+
+ // Disable openAll* if we have nothing to do.
SEL action = [item action];
- if (((action == @selector(openAllBookmarks:)) ||
+ if ((!thingsToDo) &&
+ ((action == @selector(openAllBookmarks:)) ||
(action == @selector(openAllBookmarksNewWindow:)) ||
- (action == @selector(openAllBookmarksIncognitoWindow:))) &&
- (![buttons_ count])) {
+ (action == @selector(openAllBookmarksIncognitoWindow:)))) {
return NO;
}
+
+ if ((action == @selector(editBookmark:)) ||
+ (action == @selector(deleteBookmark:))) {
+ // Don't allow edit/delete of the bar node, or of "Other Bookmarks"
+ if ((node == nil) ||
+ (node == bookmarkModel_->other_node()) ||
+ (node == bookmarkModel_->GetBookmarkBarNode())) {
+ return NO;
+ }
+ }
+
+ // Enabled by default.
return YES;
}
@@ -723,26 +751,28 @@ const NSTimeInterval kBookmarkBarAnimationDuration = 0.12;
}
}
+// Return the BookmarkNode associated with the given NSMenuItem.
+- (BookmarkNode*)nodeFromMenuItem:(id)sender {
+ BookmarkMenu* menu = (BookmarkMenu*)[sender menu];
+ if ([menu isKindOfClass:[BookmarkMenu class]])
+ return const_cast<BookmarkNode*>([menu node]);
+ return NULL;
+}
+
- (IBAction)openAllBookmarks:(id)sender {
- // TODO(jrg):
- // Is there an easier way to get a non-const root node for the bookmark bar?
- // I can't iterate over them unless it's non-const.
- BookmarkNode* node = const_cast<BookmarkNode*>(
- bookmarkModel_->GetBookmarkBarNode());
+ BookmarkNode* node = [self nodeFromMenuItem:sender];
[self openBookmarkNodesRecursive:node disposition:NEW_FOREGROUND_TAB];
UserMetrics::RecordAction(L"OpenAllBookmarks", browser_->profile());
}
- (IBAction)openAllBookmarksNewWindow:(id)sender {
- BookmarkNode* node = const_cast<BookmarkNode*>(
- bookmarkModel_->GetBookmarkBarNode());
+ BookmarkNode* node = [self nodeFromMenuItem:sender];
[self openBookmarkNodesRecursive:node disposition:NEW_WINDOW];
UserMetrics::RecordAction(L"OpenAllBookmarksNewWindow", browser_->profile());
}
- (IBAction)openAllBookmarksIncognitoWindow:(id)sender {
- BookmarkNode* node = const_cast<BookmarkNode*>(
- bookmarkModel_->GetBookmarkBarNode());
+ BookmarkNode* node = [self nodeFromMenuItem:sender];
[self openBookmarkNodesRecursive:node disposition:OFF_THE_RECORD];
UserMetrics::RecordAction(L"OpenAllBookmarksIncognitoWindow", browser_->profile());
}
@@ -795,7 +825,7 @@ const NSTimeInterval kBookmarkBarAnimationDuration = 0.12;
NSImage* image = [self getFavIconForNode:node];
[cell setBookmarkCellText:title image:image];
if (node->is_folder())
- [cell setMenu:[[self view] menu]];
+ [cell setMenu:buttonFolderContextMenu_];
else
[cell setMenu:buttonContextMenu_];
return cell;
@@ -1015,6 +1045,15 @@ const NSTimeInterval kBookmarkBarAnimationDuration = 0.12;
[self addNonBookmarkButtonsToView];
[self addButtonsToView];
[self showOrHideOffTheSideButton];
+ [self setNodeForBarMenu];
+}
+
+// Now that the model is loaded, set the bookmark bar root as the node
+// represented by the bookmark bar (default, background) menu.
+- (void)setNodeForBarMenu {
+ const BookmarkNode* node = bookmarkModel_->GetBookmarkBarNode();
+ BookmarkMenu* menu = static_cast<BookmarkMenu*>([[self view] menu]);
+ [menu setRepresentedObject:[NSValue valueWithPointer:node]];
}
- (void)beingDeleted:(BookmarkModel*)model {
diff --git a/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm b/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm
index 228bd68..7433bf2 100644
--- a/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm
+++ b/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm
@@ -10,6 +10,7 @@
#import "chrome/browser/cocoa/bookmark_bar_constants.h"
#import "chrome/browser/cocoa/bookmark_bar_controller.h"
#import "chrome/browser/cocoa/bookmark_bar_view.h"
+#import "chrome/browser/cocoa/bookmark_menu.h"
#include "chrome/browser/cocoa/browser_test_helper.h"
#import "chrome/browser/cocoa/cocoa_test_helper.h"
#include "chrome/browser/cocoa/test_event_utils.h"
@@ -100,7 +101,7 @@ class BookmarkBarControllerTest : public PlatformTest {
InstallAndToggleBar(bar_.get());
// Create a menu/item to act like a sender
- menu_.reset([[NSMenu alloc] initWithTitle:@"I_dont_care"]);
+ menu_.reset([[BookmarkMenu alloc] initWithTitle:@"I_dont_care"]);
menu_item_.reset([[NSMenuItem alloc]
initWithTitle:@"still_dont_care"
action:NULL
@@ -135,13 +136,13 @@ class BookmarkBarControllerTest : public PlatformTest {
// Return a menu item that points to the right URL.
NSMenuItem* ItemForBookmarkBarMenu(GURL& gurl) {
node_.reset(new BookmarkNode(gurl));
- [cell_ setRepresentedObject:[NSValue valueWithPointer:node_.get()]];
+ [menu_ setRepresentedObject:[NSValue valueWithPointer:node_.get()]];
return menu_item_;
}
// Does NOT take ownership of node.
NSMenuItem* ItemForBookmarkBarMenu(const BookmarkNode* node) {
- [cell_ setRepresentedObject:[NSValue valueWithPointer:node]];
+ [menu_ setRepresentedObject:[NSValue valueWithPointer:node]];
return menu_item_;
}
@@ -150,7 +151,7 @@ class BookmarkBarControllerTest : public PlatformTest {
BrowserTestHelper helper_;
scoped_nsobject<ViewResizerPong> resizeDelegate_;
scoped_nsobject<BookmarkBarControllerNoOpen> bar_;
- scoped_nsobject<NSMenu> menu_;
+ scoped_nsobject<BookmarkMenu> menu_;
scoped_nsobject<NSMenuItem> menu_item_;
scoped_nsobject<NSButtonCell> cell_;
scoped_ptr<BookmarkNode> node_;
@@ -520,8 +521,9 @@ TEST_F(BookmarkBarControllerTest, OpenAllBookmarks) {
L"title", GURL("http://two-two.com"));
model->AddURL(parent, parent->GetChildCount(),
L"title", GURL("https://three.com"));
- [bar_ openAllBookmarks:nil];
+ // Our first OpenAll... is from the bar itself.
+ [bar_ openAllBookmarks:ItemForBookmarkBarMenu(parent)];
EXPECT_EQ(bar_.get()->urls_.size(), 4U);
EXPECT_EQ(bar_.get()->dispositions_.size(), 4U);
@@ -538,6 +540,14 @@ TEST_F(BookmarkBarControllerTest, OpenAllBookmarks) {
EXPECT_TRUE(i == end);
EXPECT_EQ(bar_.get()->dispositions_[3], NEW_BACKGROUND_TAB);
+
+ // Now try an OpenAll... from a folder node.
+ bar_.get()->urls_.clear();
+ bar_.get()->dispositions_.clear();
+ [bar_ openAllBookmarks:ItemForBookmarkBarMenu(folder)];
+
+ EXPECT_EQ(bar_.get()->urls_.size(), 2U);
+ EXPECT_EQ(bar_.get()->dispositions_.size(), 2U);
}
// TODO(jrg): write a test to confirm that nodeFavIconLoaded calls
@@ -691,4 +701,61 @@ TEST_F(BookmarkBarControllerTest, DropBookmarks) {
}
}
+TEST_F(BookmarkBarControllerTest, TestButtonOrBar) {
+ BookmarkModel* model = helper_.profile()->GetBookmarkModel();
+ GURL gurl1("http://www.google.com");
+ std::wstring title1(L"x");
+ model->SetURLStarred(gurl1, title1, true);
+
+ GURL gurl2("http://www.google.com/gurl_power");
+ std::wstring title2(L"gurl power");
+ model->SetURLStarred(gurl2, title2, true);
+
+ NSButton* first = [[bar_ buttons] objectAtIndex:0];
+ NSButton* second = [[bar_ buttons] objectAtIndex:1];
+ EXPECT_TRUE(first && second);
+
+ NSMenuItem* menuItem = [[[first cell] menu] itemAtIndex:0];
+ BookmarkNode* node = [bar_ nodeFromMenuItem:menuItem];
+ EXPECT_TRUE(node);
+ EXPECT_EQ(node, model->GetBookmarkBarNode()->GetChild(0));
+
+ menuItem = [[[second cell] menu] itemAtIndex:0];
+ node = [bar_ nodeFromMenuItem:menuItem];
+ EXPECT_TRUE(node);
+ EXPECT_EQ(node, model->GetBookmarkBarNode()->GetChild(1));
+
+ menuItem = [[[bar_ view] menu] itemAtIndex:0];
+ node = [bar_ nodeFromMenuItem:menuItem];
+ EXPECT_TRUE(node);
+ EXPECT_EQ(node, model->GetBookmarkBarNode());
+}
+
+TEST_F(BookmarkBarControllerTest, TestMenuNodeAndDisable) {
+ BookmarkModel* model = helper_.profile()->GetBookmarkModel();
+ const BookmarkNode* parent = model->GetBookmarkBarNode();
+ const BookmarkNode* folder = model->AddGroup(parent,
+ parent->GetChildCount(),
+ L"group");
+ NSButton* button = [[bar_ buttons] objectAtIndex:0];
+ EXPECT_TRUE(button);
+
+ // Confirm the menu knows which node it is talking about
+ BookmarkMenu* menu = static_cast<BookmarkMenu*>([[button cell] menu]);
+ EXPECT_TRUE(menu);
+ EXPECT_TRUE([menu isKindOfClass:[BookmarkMenu class]]);
+ EXPECT_EQ(folder, [menu node]);
+
+ // Make sure "Open All" is disabled (nothing to open -- no children!)
+ // (Assumes "Open All" is the 1st item)
+ NSMenuItem* item = [menu itemAtIndex:0];
+ EXPECT_FALSE([bar_ validateUserInterfaceItem:item]);
+
+ // Now add a child and make sure the item would be enabled.
+ model->AddURL(folder, folder->GetChildCount(),
+ L"super duper wide title",
+ GURL("http://superfriends.hall-of-justice.edu"));
+ EXPECT_TRUE([bar_ validateUserInterfaceItem:item]);
+}
+
} // namespace
diff --git a/chrome/browser/cocoa/bookmark_button_cell.mm b/chrome/browser/cocoa/bookmark_button_cell.mm
index 1e2190b..147ae04 100644
--- a/chrome/browser/cocoa/bookmark_button_cell.mm
+++ b/chrome/browser/cocoa/bookmark_button_cell.mm
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#import "chrome/browser/cocoa/bookmark_button_cell.h"
+#import "chrome/browser/cocoa/bookmark_menu.h"
#import "third_party/GTM/AppKit/GTMTheme.h"
@implementation BookmarkButtonCell
@@ -53,12 +54,10 @@
// We share the context menu among all bookmark buttons. To allow us
// to disambiguate when needed (e.g. "open bookmark"), we set the
-// menu's delegate to be us. We (the cell) have the bookmark encoded
-// in our represented object.
-// Convention needed in -[BookmarkBarController openBookmarkIn***] calls.
+// menu's associated node to be our represented object.
- (NSMenu*)menu {
- NSMenu* menu = [super menu];
- [menu setDelegate:self];
+ BookmarkMenu* menu = (BookmarkMenu*)[super menu];
+ [menu setRepresentedObject:[self representedObject]];
return menu;
}
diff --git a/chrome/browser/cocoa/bookmark_button_cell_unittest.mm b/chrome/browser/cocoa/bookmark_button_cell_unittest.mm
index 9cb6ca6..aabe1af 100644
--- a/chrome/browser/cocoa/bookmark_button_cell_unittest.mm
+++ b/chrome/browser/cocoa/bookmark_button_cell_unittest.mm
@@ -4,6 +4,7 @@
#include "base/scoped_nsobject.h"
#import "chrome/browser/cocoa/bookmark_button_cell.h"
+#import "chrome/browser/cocoa/bookmark_menu.h"
#import "chrome/browser/cocoa/cocoa_test_helper.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
@@ -31,21 +32,6 @@ TEST_F(BookmarkButtonCellTest, SizeForBounds) {
EXPECT_TRUE(size.width < 200 && size.height < 200);
}
-// Make sure a cell's menu has the cell itself as the delegate. This
-// is our convention for reusing the context menu across all bookmarks
-// while being unambiguous when used.
-TEST_F(BookmarkButtonCellTest, MenuDelegate) {
- scoped_nsobject<BookmarkButtonCell> cell([[BookmarkButtonCell alloc]
- initTextCell:@"Testing"]);
- EXPECT_FALSE([cell.get() menu]);
-
- scoped_nsobject<NSMenu> menu([[NSMenu alloc] initWithTitle:@"foo"]);
- [cell setMenu:menu.get()];
- EXPECT_TRUE([cell.get() menu]);
- EXPECT_EQ([[cell.get() menu] delegate], cell.get());
- [cell setMenu:nil];
-}
-
// Make sure the default from the base class is overridden
TEST_F(BookmarkButtonCellTest, MouseEnterStuff) {
scoped_nsobject<BookmarkButtonCell> cell([[BookmarkButtonCell alloc]
diff --git a/chrome/browser/cocoa/bookmark_menu.h b/chrome/browser/cocoa/bookmark_menu.h
new file mode 100644
index 0000000..7a5ff25
--- /dev/null
+++ b/chrome/browser/cocoa/bookmark_menu.h
@@ -0,0 +1,18 @@
+// 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>
+struct BookmarkNode;
+
+// The context menu for bookmark buttons needs to know which
+// BookmarkNode it is talking about. For example, "Open All" is
+// disabled if the bookmark node is a folder and has no children.
+@interface BookmarkMenu : NSMenu {
+ @private
+ const BookmarkNode* node_;
+}
+- (void)setRepresentedObject:(id)object;
+@property const BookmarkNode* node;
+@end
+
diff --git a/chrome/browser/cocoa/bookmark_menu.mm b/chrome/browser/cocoa/bookmark_menu.mm
new file mode 100644
index 0000000..cbfdc38
--- /dev/null
+++ b/chrome/browser/cocoa/bookmark_menu.mm
@@ -0,0 +1,22 @@
+// 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/bookmark_menu.h"
+
+
+@implementation BookmarkMenu
+
+@synthesize node = node_;
+
+// Convention in the bookmark bar controller: the bookmark button
+// cells have a BookmarkNode as their represented object. This object
+// is placed in a BookmarkMenu at the time a cell is asked for its
+// menu.
+- (void)setRepresentedObject:(id)object {
+ if ([object isKindOfClass:[NSValue class]]) {
+ node_ = static_cast<const BookmarkNode*>([object pointerValue]);
+ }
+}
+
+@end
diff --git a/chrome/browser/cocoa/bookmark_menu_unittest.mm b/chrome/browser/cocoa/bookmark_menu_unittest.mm
new file mode 100644
index 0000000..2afb16c
--- /dev/null
+++ b/chrome/browser/cocoa/bookmark_menu_unittest.mm
@@ -0,0 +1,28 @@
+// 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.
+
+#include "base/scoped_nsobject.h"
+#import "chrome/browser/cocoa/bookmark_menu.h"
+#import "chrome/browser/cocoa/cocoa_test_helper.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/platform_test.h"
+
+namespace {
+
+class BookmarkMenuTest : public CocoaTest {
+ public:
+};
+
+TEST_F(BookmarkMenuTest, Basics) {
+ scoped_nsobject<BookmarkMenu> menu;
+ menu.reset([[BookmarkMenu alloc] initWithTitle:@"title"]);
+ [menu addItem:[[NSMenuItem alloc] initWithTitle:@"item"
+ action:NULL
+ keyEquivalent:@""]];
+ NSValue* value = [NSValue valueWithPointer:menu.get()];
+ [menu setRepresentedObject:value];
+ EXPECT_EQ((void*)menu.get(), (void*)[menu node]);
+}
+
+} // namespace
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index e35bf5e..a074b7a 100755
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -1085,6 +1085,8 @@
'browser/cocoa/bookmark_editor_base_controller.mm',
'browser/cocoa/bookmark_editor_controller.h',
'browser/cocoa/bookmark_editor_controller.mm',
+ 'browser/cocoa/bookmark_menu.h',
+ 'browser/cocoa/bookmark_menu.mm',
'browser/cocoa/bookmark_menu_bridge.h',
'browser/cocoa/bookmark_menu_bridge.mm',
'browser/cocoa/bookmark_menu_cocoa_controller.h',
@@ -1398,7 +1400,7 @@
'browser/extensions/extension_host.cc',
'browser/extensions/extension_host.h',
'browser/extensions/extension_i18n_api.cc',
- 'browser/extensions/extension_i18n_api.h',
+ 'browser/extensions/extension_i18n_api.h',
'browser/extensions/extension_install_ui.cc',
'browser/extensions/extension_install_ui.h',
'browser/extensions/extension_message_service.cc',
@@ -2653,7 +2655,7 @@
'../third_party/mozilla/include/NSURL+Utils.m',
'../third_party/mozilla/include/NSWorkspace+Utils.h',
'../third_party/mozilla/include/NSWorkspace+Utils.m',
- # Headers so that IB can find classes it needs to resolve classes
+ # Headers so that IB can find classes it needs to resolve classes
# in XIB files.
'../base/chrome_application_mac.h',
],
@@ -2844,7 +2846,7 @@
['include', '^browser/views/event_utils.h'],
['include', '^browser/views/extensions/extension_install_prompt.cc'],
['include', '^browser/views/extensions/extension_installed_bubble.cc'],
- ['include', '^browser/views/extensions/extension_installed_bubble.h'],
+ ['include', '^browser/views/extensions/extension_installed_bubble.h'],
['include', '^browser/views/extensions/extension_popup.cc'],
['include', '^browser/views/extensions/extension_popup.h'],
['include', '^browser/views/extensions/extension_shelf.cc'],
@@ -4560,6 +4562,7 @@
'browser/cocoa/bookmark_button_cell_unittest.mm',
'browser/cocoa/bookmark_editor_base_controller_unittest.mm',
'browser/cocoa/bookmark_editor_controller_unittest.mm',
+ 'browser/cocoa/bookmark_menu_unittest.mm',
'browser/cocoa/bookmark_menu_bridge_unittest.mm',
'browser/cocoa/bookmark_menu_cocoa_controller_unittest.mm',
'browser/cocoa/bookmark_name_folder_controller_unittest.mm',