summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/app/nibs/TabView.xib1120
-rw-r--r--chrome/browser/app_menu_model.h2
-rw-r--r--chrome/browser/app_menu_model_unittest.cc36
-rw-r--r--chrome/browser/cocoa/menu_controller.mm3
-rw-r--r--chrome/browser/cocoa/tab_controller.h12
-rw-r--r--chrome/browser/cocoa/tab_controller.mm89
-rw-r--r--chrome/browser/cocoa/tab_controller_unittest.mm13
-rw-r--r--chrome/browser/cocoa/tab_view.mm6
-rw-r--r--chrome/browser/cocoa/tab_view_unittest.mm5
-rw-r--r--chrome/browser/page_menu_model.h7
-rw-r--r--chrome/browser/tab_menu_model.cc43
-rw-r--r--chrome/browser/tab_menu_model.h25
-rw-r--r--chrome/browser/tab_menu_model_unittest.cc68
-rw-r--r--chrome/browser/views/tabs/tab.cc29
-rwxr-xr-xchrome/chrome_browser.gypi2
-rwxr-xr-xchrome/chrome_tests.gypi1
16 files changed, 300 insertions, 1161 deletions
diff --git a/chrome/app/nibs/TabView.xib b/chrome/app/nibs/TabView.xib
index 26b175e..1daed60 100644
--- a/chrome/app/nibs/TabView.xib
+++ b/chrome/app/nibs/TabView.xib
@@ -1,19 +1,14 @@
<?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">10C540</string>
- <string key="IBDocument.InterfaceBuilderVersion">740</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">740</string>
- </object>
+ <string key="IBDocument.SystemVersion">9L31a</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="1"/>
- <integer value="59"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -21,7 +16,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">
@@ -49,7 +44,7 @@
<int key="NSvFlags">256</int>
<object class="NSMutableSet" key="NSDragTypes">
<bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="set.sortedObjects">
+ <object class="NSMutableArray" key="set.sortedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>Apple PDF pasteboard type</string>
<string>Apple PICT pasteboard type</string>
@@ -81,7 +76,7 @@
<int key="NSvFlags">300</int>
<object class="NSMutableSet" key="NSDragTypes">
<bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="set.sortedObjects">
+ <object class="NSMutableArray" key="set.sortedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>Apple PDF pasteboard type</string>
<string>Apple PICT pasteboard type</string>
@@ -120,7 +115,7 @@
<string key="NSContents"/>
<object class="NSFont" key="NSSupport">
<string key="NSName">LucidaGrande</string>
- <double key="NSSize">13</double>
+ <double key="NSSize">1.300000e+01</double>
<int key="NSfFlags">1044</int>
</object>
<reference key="NSControlView" ref="1054640993"/>
@@ -152,7 +147,7 @@
<string key="NSContents">Label</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="22122319"/>
@@ -162,7 +157,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">
@@ -181,138 +176,6 @@
<reference key="NSSuperview"/>
<string key="NSClassName">TabView</string>
</object>
- <object class="NSMenu" id="398259350">
- <string key="NSTitle">Context Menu</string>
- <object class="NSMutableArray" key="NSMenuItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMenuItem" id="91607659">
- <reference key="NSMenu" ref="398259350"/>
- <string key="NSTitle">^IDS_TAB_CXMENU_NEWTAB</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <object class="NSCustomResource" key="NSOnImage" id="530899574">
- <string key="NSClassName">NSImage</string>
- <string key="NSResourceName">NSMenuCheckmark</string>
- </object>
- <object class="NSCustomResource" key="NSMixedImage" id="689949759">
- <string key="NSClassName">NSImage</string>
- <string key="NSResourceName">NSMenuMixedState</string>
- </object>
- <int key="NSTag">1</int>
- </object>
- <object class="NSMenuItem" id="676489270">
- <reference key="NSMenu" ref="398259350"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="530899574"/>
- <reference key="NSMixedImage" ref="689949759"/>
- </object>
- <object class="NSMenuItem" id="881095412">
- <reference key="NSMenu" ref="398259350"/>
- <string key="NSTitle">^IDS_TAB_CXMENU_RELOAD</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="530899574"/>
- <reference key="NSMixedImage" ref="689949759"/>
- <int key="NSTag">2</int>
- </object>
- <object class="NSMenuItem" id="851396572">
- <reference key="NSMenu" ref="398259350"/>
- <string key="NSTitle">^IDS_TAB_CXMENU_DUPLICATE</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="530899574"/>
- <reference key="NSMixedImage" ref="689949759"/>
- <int key="NSTag">3</int>
- </object>
- <object class="NSMenuItem" id="95603257">
- <reference key="NSMenu" ref="398259350"/>
- <string key="NSTitle">^IDS_TAB_CXMENU_PIN_TAB_MAC</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="530899574"/>
- <reference key="NSMixedImage" ref="689949759"/>
- <int key="NSTag">9</int>
- </object>
- <object class="NSMenuItem" id="336880767">
- <reference key="NSMenu" ref="398259350"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="530899574"/>
- <reference key="NSMixedImage" ref="689949759"/>
- </object>
- <object class="NSMenuItem" id="287599043">
- <reference key="NSMenu" ref="398259350"/>
- <string key="NSTitle">^IDS_TAB_CXMENU_CLOSETAB</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="530899574"/>
- <reference key="NSMixedImage" ref="689949759"/>
- <int key="NSTag">4</int>
- </object>
- <object class="NSMenuItem" id="590824484">
- <reference key="NSMenu" ref="398259350"/>
- <string key="NSTitle">^IDS_TAB_CXMENU_CLOSEOTHERTABS</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="530899574"/>
- <reference key="NSMixedImage" ref="689949759"/>
- <int key="NSTag">5</int>
- </object>
- <object class="NSMenuItem" id="393128310">
- <reference key="NSMenu" ref="398259350"/>
- <string key="NSTitle">^IDS_TAB_CXMENU_CLOSETABSTORIGHT</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="530899574"/>
- <reference key="NSMixedImage" ref="689949759"/>
- <int key="NSTag">6</int>
- </object>
- <object class="NSMenuItem" id="716790779">
- <reference key="NSMenu" ref="398259350"/>
- <string key="NSTitle">^IDS_TAB_CXMENU_CLOSETABSOPENEDBY</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="530899574"/>
- <reference key="NSMixedImage" ref="689949759"/>
- <int key="NSTag">7</int>
- </object>
- <object class="NSMenuItem" id="761670747">
- <reference key="NSMenu" ref="398259350"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="530899574"/>
- <reference key="NSMixedImage" ref="689949759"/>
- </object>
- <object class="NSMenuItem" id="1067896488">
- <reference key="NSMenu" ref="398259350"/>
- <string key="NSTitle">^IDS_RESTORE_TAB</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="530899574"/>
- <reference key="NSMixedImage" ref="689949759"/>
- <int key="NSTag">8</int>
- </object>
- <object class="NSMenuItem" id="553885136">
- <reference key="NSMenu" ref="398259350"/>
- <string key="NSTitle">^IDS_TAB_CXMENU_BOOKMARK_ALL_TABS</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="530899574"/>
- <reference key="NSMixedImage" ref="689949759"/>
- <int key="NSTag">10</int>
- </object>
- </object>
- </object>
<object class="NSCustomObject" id="208901833">
<string key="NSClassName">ChromeUILocalizer</string>
</object>
@@ -362,86 +225,6 @@
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
- <string key="label">contextMenu_</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="398259350"/>
- </object>
- <int key="connectionID">63</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">menu</string>
- <reference key="source" ref="1005"/>
- <reference key="destination" ref="398259350"/>
- </object>
- <int key="connectionID">65</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">commandDispatch:</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="91607659"/>
- </object>
- <int key="connectionID">81</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">commandDispatch:</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="881095412"/>
- </object>
- <int key="connectionID">82</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">commandDispatch:</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="851396572"/>
- </object>
- <int key="connectionID">83</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">commandDispatch:</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="287599043"/>
- </object>
- <int key="connectionID">84</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">commandDispatch:</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="590824484"/>
- </object>
- <int key="connectionID">85</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">commandDispatch:</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="393128310"/>
- </object>
- <int key="connectionID">86</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">commandDispatch:</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="716790779"/>
- </object>
- <int key="connectionID">87</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">commandDispatch:</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="1067896488"/>
- </object>
- <int key="connectionID">88</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
<string key="label">closeButton_</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="1054640993"/>
@@ -496,56 +279,34 @@
</object>
<int key="connectionID">98</int>
</object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">commandDispatch:</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="553885136"/>
- </object>
- <int key="connectionID">101</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">commandDispatch:</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="95603257"/>
- </object>
- <int key="connectionID">103</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">delegate</string>
- <reference key="source" ref="398259350"/>
- <reference key="destination" ref="1001"/>
- </object>
- <int key="connectionID">104</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="702409839">
+ <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="702409839"/>
+ <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="702409839"/>
<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="702409839"/>
<string key="objectName">Application</string>
</object>
<object class="IBObjectRecord">
@@ -558,7 +319,7 @@
<reference ref="987403091"/>
<reference ref="22122319"/>
</object>
- <reference key="parent" ref="0"/>
+ <reference key="parent" ref="702409839"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">8</int>
@@ -603,80 +364,9 @@
<reference key="parent" ref="987403091"/>
</object>
<object class="IBObjectRecord">
- <int key="objectID">59</int>
- <reference key="object" ref="398259350"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="91607659"/>
- <reference ref="881095412"/>
- <reference ref="851396572"/>
- <reference ref="676489270"/>
- <reference ref="336880767"/>
- <reference ref="590824484"/>
- <reference ref="287599043"/>
- <reference ref="1067896488"/>
- <reference ref="393128310"/>
- <reference ref="716790779"/>
- <reference ref="761670747"/>
- <reference ref="553885136"/>
- <reference ref="95603257"/>
- </object>
- <reference key="parent" ref="0"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">60</int>
- <reference key="object" ref="91607659"/>
- <reference key="parent" ref="398259350"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">61</int>
- <reference key="object" ref="881095412"/>
- <reference key="parent" ref="398259350"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">62</int>
- <reference key="object" ref="851396572"/>
- <reference key="parent" ref="398259350"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">66</int>
- <reference key="object" ref="676489270"/>
- <reference key="parent" ref="398259350"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">67</int>
- <reference key="object" ref="336880767"/>
- <reference key="parent" ref="398259350"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">68</int>
- <reference key="object" ref="590824484"/>
- <reference key="parent" ref="398259350"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">69</int>
- <reference key="object" ref="287599043"/>
- <reference key="parent" ref="398259350"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">70</int>
- <reference key="object" ref="1067896488"/>
- <reference key="parent" ref="398259350"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">71</int>
- <reference key="object" ref="393128310"/>
- <reference key="parent" ref="398259350"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">72</int>
- <reference key="object" ref="716790779"/>
- <reference key="parent" ref="398259350"/>
- </object>
- <object class="IBObjectRecord">
<int key="objectID">90</int>
<reference key="object" ref="208901833"/>
- <reference key="parent" ref="0"/>
+ <reference key="parent" ref="702409839"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">94</int>
@@ -692,26 +382,11 @@
<reference key="object" ref="745226941"/>
<reference key="parent" ref="22122319"/>
</object>
- <object class="IBObjectRecord">
- <int key="objectID">99</int>
- <reference key="object" ref="761670747"/>
- <reference key="parent" ref="398259350"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">100</int>
- <reference key="object" ref="553885136"/>
- <reference key="parent" ref="398259350"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">102</int>
- <reference key="object" ref="95603257"/>
- <reference key="parent" ref="398259350"/>
- </object>
</object>
</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>-3.IBPluginDependency</string>
<string>1.IBEditorWindowLastContentRect</string>
@@ -719,31 +394,16 @@
<string>1.IBViewEditorWindowController.showingLayoutRectangles</string>
<string>1.WindowOrigin</string>
<string>1.editorWindowContentRectSynchronizationRect</string>
- <string>100.IBPluginDependency</string>
- <string>102.IBPluginDependency</string>
<string>50.CustomClassName</string>
<string>50.IBPluginDependency</string>
<string>51.IBPluginDependency</string>
<string>55.IBPluginDependency</string>
<string>56.IBPluginDependency</string>
- <string>59.IBEditorWindowLastContentRect</string>
- <string>59.IBPluginDependency</string>
- <string>60.IBPluginDependency</string>
- <string>61.IBPluginDependency</string>
- <string>62.IBPluginDependency</string>
- <string>66.IBPluginDependency</string>
- <string>67.IBPluginDependency</string>
- <string>68.IBPluginDependency</string>
- <string>69.IBPluginDependency</string>
- <string>70.IBPluginDependency</string>
- <string>71.IBPluginDependency</string>
- <string>72.IBPluginDependency</string>
<string>8.IBPluginDependency</string>
<string>9.IBPluginDependency</string>
<string>94.IBPluginDependency</string>
<string>95.CustomClassName</string>
<string>95.IBPluginDependency</string>
- <string>99.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -753,36 +413,23 @@
<boolean value="YES"/>
<string>{628, 654}</string>
<string>{{217, 442}, {480, 272}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>HoverCloseButton</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>{{358, 508}, {340, 233}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>GTMFadeTruncatingTextFieldCell</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
</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>
@@ -790,7 +437,9 @@
<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>
@@ -838,7 +487,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>
@@ -865,13 +514,6 @@
</object>
</object>
<object class="IBPartialClassDescription">
- <string key="className">NSMenuItem</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">browser/cocoa/nsmenuitem_additions.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
@@ -889,24 +531,14 @@
<string key="className">TabController</string>
<string key="superclassName">NSViewController</string>
<object class="NSMutableDictionary" key="actions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>closeTab:</string>
- <string>commandDispatch:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>id</string>
- </object>
+ <string key="NS.key.0">closeTab:</string>
+ <string key="NS.object.0">id</string>
</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>
<string>iconView_</string>
<string>target_</string>
<string>titleView_</string>
@@ -914,7 +546,6 @@
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>HoverCloseButton</string>
- <string>NSMenu</string>
<string>NSView</string>
<string>id</string>
<string>NSTextField</string>
@@ -930,7 +561,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>closeButton_</string>
<string>controller_</string>
@@ -947,695 +578,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="727087945">
- <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="578407329">
- <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="1049139469">
- <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="719265157">
- <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">NSImageCell</string>
- <string key="superclassName">NSCell</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSImageCell.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSImageView</string>
- <string key="superclassName">NSControl</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSImageView.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSMenu</string>
- <string key="superclassName">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier" id="930210533">
- <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="444106208">
- <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="727087945"/>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <reference key="sourceIdentifier" ref="578407329"/>
- </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="1049139469"/>
- </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="719265157"/>
- </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="930210533"/>
- </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="625858730">
- <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="444106208"/>
- </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="625858730"/>
- </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/app_menu_model.h b/chrome/browser/app_menu_model.h
index 086d613..d298a86 100644
--- a/chrome/browser/app_menu_model.h
+++ b/chrome/browser/app_menu_model.h
@@ -28,8 +28,6 @@ class AppMenuModel : public menus::SimpleMenuModel,
private:
void Build();
- // The top-level model.
- scoped_ptr<menus::SimpleMenuModel> model_;
// Contents of the profiles menu to populate with profile names.
scoped_ptr<menus::SimpleMenuModel> profiles_menu_contents_;
diff --git a/chrome/browser/app_menu_model_unittest.cc b/chrome/browser/app_menu_model_unittest.cc
index b354292..1200c63 100644
--- a/chrome/browser/app_menu_model_unittest.cc
+++ b/chrome/browser/app_menu_model_unittest.cc
@@ -31,6 +31,27 @@ class Delegate : public menus::SimpleMenuModel::Delegate {
class AppMenuModelTest : public BrowserWithTestWindowTest {
};
+// Recursively checks the enabled state and executes a command on every item
+// that's not a separator or a submenu parent item. The returned count should
+// match the number of times the delegate is called to ensure every item works.
+static void CountEnabledExecutable(menus::MenuModel* model, int* count) {
+ for (int i = 0; i < model->GetItemCount(); ++i) {
+ menus::MenuModel::ItemType type = model->GetTypeAt(i);
+ switch (type) {
+ case menus::MenuModel::TYPE_SEPARATOR:
+ continue;
+ case menus::MenuModel::TYPE_SUBMENU:
+ CountEnabledExecutable(model->GetSubmenuModelAt(i), count);
+ break;
+ default:
+ model->IsEnabledAt(i); // Check if it's enabled (ignore answer).
+ model->ActivatedAt(i); // Execute it.
+ (*count)++; // Increment the count of executable items seen.
+ break;
+ }
+ }
+}
+
TEST_F(AppMenuModelTest, Basics) {
Delegate delegate;
AppMenuModel model(&delegate, browser());
@@ -39,14 +60,9 @@ TEST_F(AppMenuModelTest, Basics) {
// the exact number.
EXPECT_GT(model.GetItemCount(), 5);
- // Execute a couple of the items and make sure it gets back to our delegate.
- model.ActivatedAt(0);
- EXPECT_TRUE(model.IsEnabledAt(0));
- model.ActivatedAt(3);
- EXPECT_TRUE(model.IsEnabledAt(4));
- EXPECT_EQ(delegate.execute_count_, 2);
- EXPECT_EQ(delegate.enable_count_, 2);
-
- delegate.execute_count_ = 0;
- delegate.enable_count_ = 0;
+ int item_count = 0;
+ CountEnabledExecutable(&model, &item_count);
+ EXPECT_GT(item_count, 0);
+ EXPECT_EQ(item_count, delegate.execute_count_);
+ EXPECT_EQ(item_count, delegate.enable_count_);
}
diff --git a/chrome/browser/cocoa/menu_controller.mm b/chrome/browser/cocoa/menu_controller.mm
index b63b663..7706d38 100644
--- a/chrome/browser/cocoa/menu_controller.mm
+++ b/chrome/browser/cocoa/menu_controller.mm
@@ -96,7 +96,8 @@
// The MenuModel works on indexes so we can't just set the command id as the
// tag like we do in other menus. Also set the represented object to be
// the model so hierarchical menus check the correct index in the correct
- // model.
+ // model. Setting the target to |self| allows this class to participate
+ // in validation of the menu items.
[item setTag:modelIndex];
[item setTarget:self];
NSValue* modelObject = [NSValue valueWithPointer:model];
diff --git a/chrome/browser/cocoa/tab_controller.h b/chrome/browser/cocoa/tab_controller.h
index 5357544..75f51267 100644
--- a/chrome/browser/cocoa/tab_controller.h
+++ b/chrome/browser/cocoa/tab_controller.h
@@ -7,6 +7,7 @@
#import <Cocoa/Cocoa.h>
#import "chrome/browser/cocoa/hover_close_button.h"
+#include "chrome/browser/tab_menu_model.h"
// The loading/waiting state of the tab.
// TODO(pinkerton): this really doesn't belong here, but something needs to
@@ -20,6 +21,10 @@ enum TabLoadingState {
kTabCrashed,
};
+@class MenuController;
+namespace TabControllerInternal {
+class MenuDelegate;
+}
@class TabView;
@protocol TabControllerTarget;
@@ -38,7 +43,6 @@ enum TabLoadingState {
@private
IBOutlet NSView* iconView_;
IBOutlet NSTextField* titleView_;
- IBOutlet NSMenu* contextMenu_;
IBOutlet HoverCloseButton* closeButton_;
NSRect originalIconFrame_; // frame of iconView_ as loaded from nib
@@ -50,6 +54,9 @@ enum TabLoadingState {
CGFloat titleCloseWidthOffset_; // between right edges of icon and close btn.
id<TabControllerTarget> target_; // weak, where actions are sent
SEL action_; // selector sent when tab is selected by clicking
+ scoped_ptr<TabMenuModel> contextMenuModel_;
+ scoped_ptr<TabControllerInternal::MenuDelegate> contextMenuDelegate_;
+ scoped_nsobject<MenuController> contextMenuController_;
}
@property(assign, nonatomic) TabLoadingState loadingState;
@@ -74,9 +81,6 @@ enum TabLoadingState {
// perform the close.
- (IBAction)closeTab:(id)sender;
-// Dispatches the command in the tag to the registered target object.
-- (IBAction)commandDispatch:(id)sender;
-
// Replace the current icon view with the given view. |iconView| will be
// resized to the size of the current icon view.
- (void)setIconView:(NSView*)iconView;
diff --git a/chrome/browser/cocoa/tab_controller.mm b/chrome/browser/cocoa/tab_controller.mm
index 8488ea8..49ce170 100644
--- a/chrome/browser/cocoa/tab_controller.mm
+++ b/chrome/browser/cocoa/tab_controller.mm
@@ -4,6 +4,7 @@
#include "app/l10n_util_mac.h"
#include "base/mac_util.h"
+#import "chrome/browser/cocoa/menu_controller.h"
#import "chrome/browser/cocoa/tab_controller.h"
#import "chrome/browser/cocoa/tab_controller_target.h"
#import "chrome/browser/cocoa/tab_view.h"
@@ -17,6 +18,53 @@
@synthesize target = target_;
@synthesize action = action_;
+namespace TabControllerInternal {
+
+// A C++ delegate that handles enabling/disabling menu items and handling when
+// a menu command is chosen. Also fixes up the menu item label for "pin/unpin
+// tab".
+class MenuDelegate : public menus::SimpleMenuModel::Delegate {
+ public:
+ explicit MenuDelegate(id<TabControllerTarget> target, TabController* owner)
+ : target_(target), owner_(owner) { }
+
+ // Overridden from menus::SimpleMenuModel::Delegate
+ virtual bool IsCommandIdChecked(int command_id) const { return false; }
+ virtual bool IsCommandIdEnabled(int command_id) const {
+ TabStripModel::ContextMenuCommand command =
+ static_cast<TabStripModel::ContextMenuCommand>(command_id);
+ return [target_ isCommandEnabled:command forController:owner_];
+ }
+ virtual bool GetAcceleratorForCommandId(
+ int command_id,
+ menus::Accelerator* accelerator) { return false; }
+ virtual void ExecuteCommand(int command_id) {
+ TabStripModel::ContextMenuCommand command =
+ static_cast<TabStripModel::ContextMenuCommand>(command_id);
+ [target_ commandDispatch:command forController:owner_];
+ }
+
+ virtual bool IsLabelForCommandIdDynamic(int command_id) const {
+ return command_id == TabStripModel::CommandTogglePinned;
+ }
+ virtual string16 GetLabelForCommandId(int command_id) const {
+ // Display "Pin Tab" when the tab is not pinned and "Unpin Tab" when it is
+ // (this is not a checkmark menu item, per Apple's HIG).
+ if (command_id == TabStripModel::CommandTogglePinned) {
+ return l10n_util::GetStringUTF16(
+ [owner_ pinned] ? IDS_TAB_CXMENU_UNPIN_TAB_MAC
+ : IDS_TAB_CXMENU_PIN_TAB_MAC);
+ }
+ return string16();
+ }
+
+ private:
+ id<TabControllerTarget> target_; // weak
+ TabController* owner_; // weak, owns me
+};
+
+} // namespace
+
// The min widths match the windows values and are sums of left + right
// padding, of which we have no comparable constants (we draw using paths, not
// images). The selected tab width includes the close button width.
@@ -79,6 +127,19 @@
[self internalSetSelected:selected_];
}
+// Called when Cocoa wants to display the context menu. Lazily instantiate
+// the menu based off of the cross-platform model. Re-create the menu and
+// model every time to get the correct labels and enabling.
+- (NSMenu*)menu {
+ contextMenuDelegate_.reset(
+ new TabControllerInternal::MenuDelegate(target_, self));
+ contextMenuModel_.reset(new TabMenuModel(contextMenuDelegate_.get()));
+ contextMenuController_.reset(
+ [[MenuController alloc] initWithModel:contextMenuModel_.get()
+ useWithPopUpButtonCell:NO]);
+ return [contextMenuController_ menu];
+}
+
- (IBAction)closeTab:(id)sender {
if ([[self target] respondsToSelector:@selector(closeTab:)]) {
[[self target] performSelector:@selector(closeTab:)
@@ -86,22 +147,6 @@
}
}
-// Dispatches the command in the tag to the registered target object.
-- (IBAction)commandDispatch:(id)sender {
- TabStripModel::ContextMenuCommand command =
- static_cast<TabStripModel::ContextMenuCommand>([sender tag]);
- [[self target] commandDispatch:command forController:self];
-}
-
-// Called for each menu item on its target, which would be this controller.
-// Returns YES if the menu item should be enabled. We ask the tab's
-// target for the proper answer.
-- (BOOL)validateMenuItem:(NSMenuItem*)item {
- TabStripModel::ContextMenuCommand command =
- static_cast<TabStripModel::ContextMenuCommand>([item tag]);
- return [[self target] isCommandEnabled:command forController:self];
-}
-
- (void)setTitle:(NSString*)title {
[[self view] setToolTip:title];
[super setTitle:title];
@@ -259,16 +304,4 @@
return NO;
}
-// Delegate method for context menu. Called before the menu is displayed to
-// update the menu. We need to display "Pin Tab" when the tab is not pinned and
-// "Unpin Tab" when it is (this is not a checkmark menu item, per Apple's HIG).
-- (void)menuNeedsUpdate:(NSMenu*)menu {
- NSMenuItem* togglePinned =
- [menu itemWithTag:TabStripModel::CommandTogglePinned];
- NSString* menuItemText = l10n_util::GetNSStringWithFixup(
- [self pinned] ? IDS_TAB_CXMENU_UNPIN_TAB_MAC
- : IDS_TAB_CXMENU_PIN_TAB_MAC);
- [togglePinned setTitle:menuItemText];
-}
-
@end
diff --git a/chrome/browser/cocoa/tab_controller_unittest.mm b/chrome/browser/cocoa/tab_controller_unittest.mm
index 26484b5..bab2bef 100644
--- a/chrome/browser/cocoa/tab_controller_unittest.mm
+++ b/chrome/browser/cocoa/tab_controller_unittest.mm
@@ -257,4 +257,17 @@ TEST_F(TabControllerTest, ShouldShowIcon) {
EXPECT_GT(cap, 0);
}
+TEST_F(TabControllerTest, Menu) {
+ NSWindow* window = test_window();
+ scoped_nsobject<TabController> controller([[TabController alloc] init]);
+ [[window contentView] addSubview:[controller view]];
+ int cap = [controller iconCapacity];
+ EXPECT_GT(cap, 0);
+
+ // Asking the view for its menu should yield a valid menu.
+ NSMenu* menu = [[controller view] menu];
+ EXPECT_TRUE(menu);
+ EXPECT_GT([menu numberOfItems], 0);
+}
+
} // namespace
diff --git a/chrome/browser/cocoa/tab_view.mm b/chrome/browser/cocoa/tab_view.mm
index dbf9e78..28dca36 100644
--- a/chrome/browser/cocoa/tab_view.mm
+++ b/chrome/browser/cocoa/tab_view.mm
@@ -54,6 +54,12 @@ const CGFloat kRapidCloseDist = 2.5;
[super dealloc];
}
+// Use the TabController to provide the menu rather than obtaining it from the
+// nib file.
+- (NSMenu*)menu {
+ return [controller_ menu];
+}
+
// Overridden so that mouse clicks come to this view (the parent of the
// hierarchy) first. We want to handle clicks and drags in this class and
// leave the background button for display purposes only.
diff --git a/chrome/browser/cocoa/tab_view_unittest.mm b/chrome/browser/cocoa/tab_view_unittest.mm
index 18b3fe5..0c4d768 100644
--- a/chrome/browser/cocoa/tab_view_unittest.mm
+++ b/chrome/browser/cocoa/tab_view_unittest.mm
@@ -41,4 +41,9 @@ TEST_F(TabViewTest, MouseTracking) {
// TODO(pinkerton): Test dragging out of window
}
+// Test it doesn't crash when asked for its menu with no TabController set.
+TEST_F(TabViewTest, Menu) {
+ EXPECT_FALSE([view_ menu]);
+}
+
} // namespace
diff --git a/chrome/browser/page_menu_model.h b/chrome/browser/page_menu_model.h
index b3fc8ed..59994a9 100644
--- a/chrome/browser/page_menu_model.h
+++ b/chrome/browser/page_menu_model.h
@@ -67,10 +67,9 @@ class PageMenuModel : public menus::SimpleMenuModel {
private:
void Build();
- // The top-level model.
- scoped_ptr<menus::SimpleMenuModel> model_;
- // Models for submenus referenced by model_. SimpleMenuModel only uses weak
- // references so these must be kept for the lifetime of the top-level model.
+ // Models for submenus referenced by this model. SimpleMenuModel only uses
+ // weak references so these must be kept for the lifetime of the top-level
+ // model.
scoped_ptr<ZoomMenuModel> zoom_menu_model_;
scoped_ptr<EncodingMenuModel> encoding_menu_model_;
scoped_ptr<DevToolsMenuModel> devtools_menu_model_;
diff --git a/chrome/browser/tab_menu_model.cc b/chrome/browser/tab_menu_model.cc
new file mode 100644
index 0000000..f426250
--- /dev/null
+++ b/chrome/browser/tab_menu_model.cc
@@ -0,0 +1,43 @@
+// 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 "chrome/browser/tab_menu_model.h"
+
+#include "chrome/browser/tabs/tab_strip_model.h"
+#include "grit/generated_resources.h"
+
+TabMenuModel::TabMenuModel(menus::SimpleMenuModel::Delegate* delegate)
+ : menus::SimpleMenuModel(delegate) {
+ Build();
+}
+
+void TabMenuModel::Build() {
+ AddItemWithStringId(TabStripModel::CommandNewTab, IDS_TAB_CXMENU_NEWTAB);
+ AddSeparator();
+ AddItemWithStringId(TabStripModel::CommandReload, IDS_TAB_CXMENU_RELOAD);
+ AddItemWithStringId(TabStripModel::CommandDuplicate,
+ IDS_TAB_CXMENU_DUPLICATE);
+ // On Mac the HIG prefers "pin/unpin" to a checkmark. The Mac code will fix up
+ // the actual string based on the tab's state via the delegate.
+#if defined(OS_MACOSX)
+ AddItemWithStringId(TabStripModel::CommandTogglePinned,
+ IDS_TAB_CXMENU_PIN_TAB);
+#else
+ AddCheckItemWithStringId(TabStripModel::CommandTogglePinned,
+ IDS_TAB_CXMENU_PIN_TAB);
+#endif
+ AddSeparator();
+ AddItemWithStringId(TabStripModel::CommandCloseTab,
+ IDS_TAB_CXMENU_CLOSETAB);
+ AddItemWithStringId(TabStripModel::CommandCloseOtherTabs,
+ IDS_TAB_CXMENU_CLOSEOTHERTABS);
+ AddItemWithStringId(TabStripModel::CommandCloseTabsToRight,
+ IDS_TAB_CXMENU_CLOSETABSTORIGHT);
+ AddItemWithStringId(TabStripModel::CommandCloseTabsOpenedBy,
+ IDS_TAB_CXMENU_CLOSETABSOPENEDBY);
+ AddSeparator();
+ AddItemWithStringId(TabStripModel::CommandRestoreTab, IDS_RESTORE_TAB);
+ AddItemWithStringId(TabStripModel::CommandBookmarkAllTabs,
+ IDS_TAB_CXMENU_BOOKMARK_ALL_TABS);
+}
diff --git a/chrome/browser/tab_menu_model.h b/chrome/browser/tab_menu_model.h
new file mode 100644
index 0000000..d176fc9
--- /dev/null
+++ b/chrome/browser/tab_menu_model.h
@@ -0,0 +1,25 @@
+// 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_TAB_MENU_MODEL_H_
+#define CHROME_BROWSER_TAB_MENU_MODEL_H_
+
+#include "app/menus/simple_menu_model.h"
+
+class Browser;
+
+// A menu model that builds the contents of the tab context menu. This menu has
+// only one level (no submenus).
+class TabMenuModel : public menus::SimpleMenuModel {
+ public:
+ explicit TabMenuModel(menus::SimpleMenuModel::Delegate* delegate);
+ virtual ~TabMenuModel() { }
+
+ private:
+ void Build();
+
+ DISALLOW_COPY_AND_ASSIGN(TabMenuModel);
+};
+
+#endif // CHROME_BROWSER_TAB_MENU_MODEL_H_
diff --git a/chrome/browser/tab_menu_model_unittest.cc b/chrome/browser/tab_menu_model_unittest.cc
new file mode 100644
index 0000000..eb9aa65
--- /dev/null
+++ b/chrome/browser/tab_menu_model_unittest.cc
@@ -0,0 +1,68 @@
+// 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 "chrome/browser/tab_menu_model.h"
+
+#include "base/logging.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/platform_test.h"
+
+// A menu delegate that counts the number of times certain things are called
+// to make sure things are hooked up properly.
+class Delegate : public menus::SimpleMenuModel::Delegate {
+ public:
+ Delegate() : execute_count_(0), enable_count_(0) { }
+
+ virtual bool IsCommandIdChecked(int command_id) const { return false; }
+ virtual bool IsCommandIdEnabled(int command_id) const {
+ ++enable_count_;
+ return true;
+ }
+ virtual bool GetAcceleratorForCommandId(
+ int command_id,
+ menus::Accelerator* accelerator) { return false; }
+ virtual void ExecuteCommand(int command_id) { ++execute_count_; }
+
+ int execute_count_;
+ mutable int enable_count_;
+};
+
+class TabMenuModelTest : public PlatformTest {
+};
+
+// Recursively checks the enabled state and executes a command on every item
+// that's not a separator or a submenu parent item. The returned count should
+// match the number of times the delegate is called to ensure every item works.
+static void CountEnabledExecutable(menus::MenuModel* model, int* count) {
+ for (int i = 0; i < model->GetItemCount(); ++i) {
+ menus::MenuModel::ItemType type = model->GetTypeAt(i);
+ switch (type) {
+ case menus::MenuModel::TYPE_SEPARATOR:
+ continue;
+ case menus::MenuModel::TYPE_SUBMENU:
+ CountEnabledExecutable(model->GetSubmenuModelAt(i), count);
+ break;
+ default:
+ model->IsEnabledAt(i); // Check if it's enabled (ignore answer).
+ model->ActivatedAt(i); // Execute it.
+ (*count)++; // Increment the count of executable items seen.
+ break;
+ }
+ }
+}
+
+TEST_F(TabMenuModelTest, Basics) {
+ Delegate delegate;
+ TabMenuModel model(&delegate);
+
+ // Verify it has items. The number varies by platform, so we don't check
+ // the exact number.
+ EXPECT_GT(model.GetItemCount(), 5);
+
+ int item_count = 0;
+ CountEnabledExecutable(&model, &item_count);
+ EXPECT_GT(item_count, 0);
+ EXPECT_EQ(item_count, delegate.execute_count_);
+ EXPECT_EQ(item_count, delegate.enable_count_);
+}
diff --git a/chrome/browser/views/tabs/tab.cc b/chrome/browser/views/tabs/tab.cc
index 7140ff0..a775734 100644
--- a/chrome/browser/views/tabs/tab.cc
+++ b/chrome/browser/views/tabs/tab.cc
@@ -12,6 +12,7 @@
#include "app/resource_bundle.h"
#include "base/compiler_specific.h"
#include "base/gfx/size.h"
+#include "chrome/browser/tab_menu_model.h"
#include "chrome/browser/views/frame/browser_extender.h"
#include "chrome/browser/views/frame/browser_view.h"
#include "chrome/browser/views/tabs/tab_strip.h"
@@ -26,11 +27,10 @@ static const SkScalar kTabCapWidth = 15;
static const SkScalar kTabTopCurveWidth = 4;
static const SkScalar kTabBottomCurveWidth = 3;
-class Tab::TabContextMenuContents : public menus::SimpleMenuModel,
- public menus::SimpleMenuModel::Delegate {
+class Tab::TabContextMenuContents : public menus::SimpleMenuModel::Delegate {
public:
explicit TabContextMenuContents(Tab* tab)
- : ALLOW_THIS_IN_INITIALIZER_LIST(menus::SimpleMenuModel(this)),
+ : ALLOW_THIS_IN_INITIALIZER_LIST(model_(this)),
tab_(tab),
last_command_(TabStripModel::CommandFirst) {
Build();
@@ -84,29 +84,10 @@ class Tab::TabContextMenuContents : public menus::SimpleMenuModel,
private:
void Build() {
- AddItemWithStringId(TabStripModel::CommandNewTab, IDS_TAB_CXMENU_NEWTAB);
- AddSeparator();
- AddItemWithStringId(TabStripModel::CommandReload, IDS_TAB_CXMENU_RELOAD);
- AddItemWithStringId(TabStripModel::CommandDuplicate,
- IDS_TAB_CXMENU_DUPLICATE);
- AddCheckItemWithStringId(TabStripModel::CommandTogglePinned,
- IDS_TAB_CXMENU_PIN_TAB);
- AddSeparator();
- AddItemWithStringId(TabStripModel::CommandCloseTab,
- IDS_TAB_CXMENU_CLOSETAB);
- AddItemWithStringId(TabStripModel::CommandCloseOtherTabs,
- IDS_TAB_CXMENU_CLOSEOTHERTABS);
- AddItemWithStringId(TabStripModel::CommandCloseTabsToRight,
- IDS_TAB_CXMENU_CLOSETABSTORIGHT);
- AddItemWithStringId(TabStripModel::CommandCloseTabsOpenedBy,
- IDS_TAB_CXMENU_CLOSETABSOPENEDBY);
- AddSeparator();
- AddItemWithStringId(TabStripModel::CommandRestoreTab, IDS_RESTORE_TAB);
- AddItemWithStringId(TabStripModel::CommandBookmarkAllTabs,
- IDS_TAB_CXMENU_BOOKMARK_ALL_TABS);
- menu_.reset(new views::Menu2(this));
+ menu_.reset(new views::Menu2(&model_));
}
+ TabMenuModel model_;
scoped_ptr<views::Menu2> menu_;
// The Tab the context menu was brought up for. Set to NULL when the menu
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 8c98e0c..2791031 100755
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -1518,6 +1518,8 @@
'browser/tab_contents/web_drag_dest_gtk.h',
'browser/tab_contents/web_drop_target_win.cc',
'browser/tab_contents/web_drop_target_win.h',
+ 'browser/tab_menu_model.cc',
+ 'browser/tab_menu_model.h',
'browser/tabs/tab_strip_model.cc',
'browser/tabs/tab_strip_model.h',
'browser/tabs/tab_strip_model_order_controller.cc',
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 5883286..c25bf49 100755
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -778,6 +778,7 @@
'browser/tab_contents/render_view_host_manager_unittest.cc',
'browser/tab_contents/thumbnail_generator_unittest.cc',
'browser/tab_contents/web_contents_unittest.cc',
+ 'browser/tab_menu_model_unittest.cc',
'browser/tabs/tab_strip_model_unittest.cc',
'browser/task_manager_unittest.cc',
'browser/theme_resources_util_unittest.cc',