diff options
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/app/nibs/en.lproj/About.xib | 592 | ||||
-rw-r--r-- | chrome/app/nibs/en.lproj/MainMenu.xib | 63 | ||||
-rw-r--r-- | chrome/browser/app_controller_mac.h | 6 | ||||
-rw-r--r-- | chrome/browser/app_controller_mac.mm | 54 | ||||
-rw-r--r-- | chrome/browser/cocoa/about_window_controller.h | 45 | ||||
-rw-r--r-- | chrome/browser/cocoa/about_window_controller.mm | 133 | ||||
-rw-r--r-- | chrome/browser/cocoa/about_window_controller_unittest.mm | 63 | ||||
-rw-r--r-- | chrome/chrome.gyp | 9 |
8 files changed, 950 insertions, 15 deletions
diff --git a/chrome/app/nibs/en.lproj/About.xib b/chrome/app/nibs/en.lproj/About.xib new file mode 100644 index 0000000..d76e6b9 --- /dev/null +++ b/chrome/app/nibs/en.lproj/About.xib @@ -0,0 +1,592 @@ +<?xml version="1.0" encoding="UTF-8"?> +<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03"> + <data> + <int key="IBDocument.SystemTarget">1050</int> + <string key="IBDocument.SystemVersion">9G55</string> + <string key="IBDocument.InterfaceBuilderVersion">677</string> + <string key="IBDocument.AppKitVersion">949.43</string> + <string key="IBDocument.HIToolboxVersion">353.00</string> + <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> + <bool key="EncodedWithXMLCoder">YES</bool> + <integer value="4"/> + </object> + <object class="NSArray" key="IBDocument.PluginDependencies"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + </object> + <object class="NSMutableDictionary" key="IBDocument.Metadata"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + </object> + <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSCustomObject" id="1001"> + <string key="NSClassName">AboutWindowController</string> + </object> + <object class="NSCustomObject" id="1003"> + <string key="NSClassName">FirstResponder</string> + </object> + <object class="NSCustomObject" id="1004"> + <string key="NSClassName">NSApplication</string> + </object> + <object class="NSWindowTemplate" id="820943852"> + <int key="NSWindowStyleMask">23</int> + <int key="NSWindowBacking">2</int> + <string key="NSWindowRect">{{196, 149}, {308, 361}}</string> + <int key="NSWTFlags">-469762048</int> + <string key="NSWindowTitle">About Chrome</string> + <string key="NSWindowClass">NSPanel</string> + <nil key="NSViewClass"/> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> + <object class="NSView" key="NSWindowView" id="498033215"> + <reference key="NSNextResponder"/> + <int key="NSvFlags">256</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSImageView" id="623665386"> + <reference key="NSNextResponder" ref="498033215"/> + <int key="NSvFlags">268</int> + <object class="NSMutableSet" key="NSDragTypes"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="set.sortedObjects"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>Apple PDF pasteboard type</string> + <string>Apple PICT pasteboard type</string> + <string>Apple PNG pasteboard type</string> + <string>NSFilenamesPboardType</string> + <string>NeXT Encapsulated PostScript v1.2 pasteboard type</string> + <string>NeXT TIFF v4.0 pasteboard type</string> + </object> + </object> + <string key="NSFrame">{{90, 213}, {128, 128}}</string> + <reference key="NSSuperview" ref="498033215"/> + <bool key="NSEnabled">YES</bool> + <object class="NSImageCell" key="NSCell" id="357051704"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">33685504</int> + <object class="NSCustomResource" key="NSContents"> + <string key="NSClassName">NSImage</string> + <string key="NSResourceName">app</string> + </object> + <object class="NSFont" key="NSSupport" id="26"> + <string key="NSName">LucidaGrande</string> + <double key="NSSize">1.100000e+01</double> + <int key="NSfFlags">3100</int> + </object> + <int key="NSAlign">0</int> + <int key="NSScale">0</int> + <int key="NSStyle">0</int> + <bool key="NSAnimates">NO</bool> + </object> + <bool key="NSEditable">YES</bool> + </object> + <object class="NSTextField" id="308038257"> + <reference key="NSNextResponder" ref="498033215"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{17, 177}, {274, 17}}</string> + <reference key="NSSuperview" ref="498033215"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="625581420"> + <int key="NSCellFlags">68288064</int> + <int key="NSCellFlags2">1212154880</int> + <string key="NSContents">Google Chrome</string> + <object class="NSFont" key="NSSupport" id="373008810"> + <string key="NSName">LucidaGrande</string> + <double key="NSSize">1.300000e+01</double> + <int key="NSfFlags">1044</int> + </object> + <reference key="NSControlView" ref="308038257"/> + <object class="NSColor" key="NSBackgroundColor" id="782671173"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">controlColor</string> + <object class="NSColor" key="NSColor"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MC42NjY2NjY2OQA</bytes> + </object> + </object> + <object class="NSColor" key="NSTextColor" id="253483895"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">controlTextColor</string> + <object class="NSColor" key="NSColor" id="568235873"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MAA</bytes> + </object> + </object> + </object> + </object> + <object class="NSTextField" id="243051668"> + <reference key="NSNextResponder" ref="498033215"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{17, 100}, {274, 17}}</string> + <reference key="NSSuperview" ref="498033215"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="605929825"> + <int key="NSCellFlags">68288064</int> + <int key="NSCellFlags2">1212154880</int> + <string key="NSContents"/> + <reference key="NSSupport" ref="373008810"/> + <reference key="NSControlView" ref="243051668"/> + <reference key="NSBackgroundColor" ref="782671173"/> + <reference key="NSTextColor" ref="253483895"/> + </object> + </object> + <object class="NSTextField" id="171870711"> + <reference key="NSNextResponder" ref="498033215"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{17, 155}, {274, 14}}</string> + <reference key="NSSuperview" ref="498033215"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="881628032"> + <int key="NSCellFlags">68288064</int> + <int key="NSCellFlags2">138544128</int> + <string key="NSContents"/> + <reference key="NSSupport" ref="26"/> + <reference key="NSControlView" ref="171870711"/> + <reference key="NSBackgroundColor" ref="782671173"/> + <reference key="NSTextColor" ref="253483895"/> + </object> + </object> + <object class="NSTextField" id="562997276"> + <reference key="NSNextResponder" ref="498033215"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{17, 133}, {274, 14}}</string> + <reference key="NSSuperview" ref="498033215"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="1062740497"> + <int key="NSCellFlags">68288064</int> + <int key="NSCellFlags2">138544128</int> + <string key="NSContents"/> + <reference key="NSSupport" ref="26"/> + <reference key="NSControlView" ref="562997276"/> + <reference key="NSBackgroundColor" ref="782671173"/> + <reference key="NSTextColor" ref="253483895"/> + </object> + </object> + <object class="NSTextField" id="564072719"> + <reference key="NSNextResponder" ref="498033215"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{17, 20}, {274, 28}}</string> + <reference key="NSSuperview" ref="498033215"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="965526644"> + <int key="NSCellFlags">-1543373312</int> + <int key="NSCellFlags2">138543104</int> + <string type="base64-UTF8" key="NSContents">Q29weXJpZ2h0IMKpIDIwMDkgVGhlIENocm9taXVtIEF1dGhvcnMuICAgICAgICAgICAgICAgICAgIEFs +bCBSaWdodHMgUmVzZXJ2ZWQuA</string> + <reference key="NSSupport" ref="26"/> + <reference key="NSControlView" ref="564072719"/> + <object class="NSColor" key="NSBackgroundColor"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">textBackgroundColor</string> + <object class="NSColor" key="NSColor"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MQA</bytes> + </object> + </object> + <object class="NSColor" key="NSTextColor"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">textColor</string> + <reference key="NSColor" ref="568235873"/> + </object> + </object> + </object> + <object class="NSButton" id="1015655775"> + <reference key="NSNextResponder" ref="498033215"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{106, 61}, {96, 28}}</string> + <reference key="NSSuperview" ref="498033215"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="515715235"> + <int key="NSCellFlags">604110336</int> + <int key="NSCellFlags2">134348800</int> + <string key="NSContents">Update Now</string> + <reference key="NSSupport" ref="26"/> + <reference key="NSControlView" ref="1015655775"/> + <int key="NSButtonFlags">-2038284033</int> + <int key="NSButtonFlags2">129</int> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + <object class="NSProgressIndicator" id="342353587"> + <reference key="NSNextResponder" ref="498033215"/> + <int key="NSvFlags">1292</int> + <object class="NSPSMatrix" key="NSDrawMatrix"/> + <string key="NSFrame">{{138, 93}, {32, 32}}</string> + <reference key="NSSuperview" ref="498033215"/> + <int key="NSpiFlags">28682</int> + <double key="NSMinValue">1.600000e+01</double> + <double key="NSMaxValue">1.000000e+02</double> + </object> + </object> + <string key="NSFrameSize">{308, 361}</string> + <reference key="NSSuperview"/> + </object> + <string key="NSScreenRect">{{0, 0}, {2560, 1578}}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> + </object> + </object> + <object class="IBObjectContainer" key="IBDocument.Objects"> + <object class="NSMutableArray" key="connectionRecords"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">upToDate_</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="562997276"/> + </object> + <int key="connectionID">20</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">spinner_</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="342353587"/> + </object> + <int key="connectionID">21</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">updateNow:</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="1015655775"/> + </object> + <int key="connectionID">22</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">updateCompleted_</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="243051668"/> + </object> + <int key="connectionID">27</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">window</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="820943852"/> + </object> + <int key="connectionID">28</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">delegate</string> + <reference key="source" ref="820943852"/> + <reference key="destination" ref="1001"/> + </object> + <int key="connectionID">29</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">version_</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="171870711"/> + </object> + <int key="connectionID">30</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">updateNowButton_</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="1015655775"/> + </object> + <int key="connectionID">31</int> + </object> + </object> + <object class="IBMutableOrderedSet" key="objectRecords"> + <object class="NSArray" key="orderedObjects"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBObjectRecord"> + <int key="objectID">0</int> + <object class="NSArray" key="object" id="1002"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + <reference key="children" ref="1000"/> + <nil key="parent"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-2</int> + <reference key="object" ref="1001"/> + <reference key="parent" ref="1002"/> + <string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-1</int> + <reference key="object" ref="1003"/> + <reference key="parent" ref="1002"/> + <string key="objectName">First Responder</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-3</int> + <reference key="object" ref="1004"/> + <reference key="parent" ref="1002"/> + <string key="objectName">Application</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">3</int> + <reference key="object" ref="820943852"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="498033215"/> + </object> + <reference key="parent" ref="1002"/> + <string key="objectName">About Panel</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">4</int> + <reference key="object" ref="498033215"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="308038257"/> + <reference ref="342353587"/> + <reference ref="1015655775"/> + <reference ref="562997276"/> + <reference ref="623665386"/> + <reference ref="564072719"/> + <reference ref="171870711"/> + <reference ref="243051668"/> + </object> + <reference key="parent" ref="820943852"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">5</int> + <reference key="object" ref="308038257"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="625581420"/> + </object> + <reference key="parent" ref="498033215"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">6</int> + <reference key="object" ref="342353587"/> + <reference key="parent" ref="498033215"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">7</int> + <reference key="object" ref="1015655775"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="515715235"/> + </object> + <reference key="parent" ref="498033215"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">8</int> + <reference key="object" ref="564072719"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="965526644"/> + </object> + <reference key="parent" ref="498033215"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">9</int> + <reference key="object" ref="562997276"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="1062740497"/> + </object> + <reference key="parent" ref="498033215"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">10</int> + <reference key="object" ref="171870711"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="881628032"/> + </object> + <reference key="parent" ref="498033215"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">11</int> + <reference key="object" ref="623665386"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="357051704"/> + </object> + <reference key="parent" ref="498033215"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">12</int> + <reference key="object" ref="357051704"/> + <reference key="parent" ref="623665386"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">13</int> + <reference key="object" ref="881628032"/> + <reference key="parent" ref="171870711"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">14</int> + <reference key="object" ref="1062740497"/> + <reference key="parent" ref="562997276"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">15</int> + <reference key="object" ref="965526644"/> + <reference key="parent" ref="564072719"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">16</int> + <reference key="object" ref="515715235"/> + <reference key="parent" ref="1015655775"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">17</int> + <reference key="object" ref="625581420"/> + <reference key="parent" ref="308038257"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">25</int> + <reference key="object" ref="243051668"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="605929825"/> + </object> + <reference key="parent" ref="498033215"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">26</int> + <reference key="object" ref="605929825"/> + <reference key="parent" ref="243051668"/> + </object> + </object> + </object> + <object class="NSMutableDictionary" key="flattenedProperties"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>-1.IBPluginDependency</string> + <string>-2.IBPluginDependency</string> + <string>-3.IBPluginDependency</string> + <string>10.IBPluginDependency</string> + <string>11.IBPluginDependency</string> + <string>12.IBPluginDependency</string> + <string>13.IBPluginDependency</string> + <string>14.IBPluginDependency</string> + <string>15.IBPluginDependency</string> + <string>16.IBPluginDependency</string> + <string>17.IBPluginDependency</string> + <string>25.IBPluginDependency</string> + <string>26.IBPluginDependency</string> + <string>3.IBEditorWindowLastContentRect</string> + <string>3.IBPluginDependency</string> + <string>3.IBWindowTemplateEditedContentRect</string> + <string>3.NSWindowTemplate.visibleAtLaunch</string> + <string>4.IBPluginDependency</string> + <string>5.IBPluginDependency</string> + <string>6.IBPluginDependency</string> + <string>7.IBPluginDependency</string> + <string>8.IBPluginDependency</string> + <string>9.IBPluginDependency</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>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>{{652, 412}, {308, 361}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>{{652, 412}, {308, 361}}</string> + <boolean value="NO"/> + <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> + </object> + </object> + <object class="NSMutableDictionary" key="unlocalizedProperties"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + </object> + <nil key="activeLocalization"/> + <object class="NSMutableDictionary" key="localizations"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + </object> + <nil key="sourceID"/> + <int key="maxID">31</int> + </object> + <object class="IBClassDescriber" key="IBDocument.Classes"> + <object class="NSMutableArray" key="referencedPartialClassDescriptions"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBPartialClassDescription"> + <string key="className">AboutWindowController</string> + <string key="superclassName">NSWindowController</string> + <object class="NSMutableDictionary" key="actions"> + <string key="NS.key.0">updateNow:</string> + <string key="NS.object.0">id</string> + </object> + <object class="NSMutableDictionary" key="outlets"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>spinner_</string> + <string>upToDate_</string> + <string>updateCompleted_</string> + <string>updateNowButton_</string> + <string>version_</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>NSProgressIndicator</string> + <string>NSTextField</string> + <string>NSTextField</string> + <string>NSButton</string> + <string>NSTextField</string> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">browser/cocoa/about_window_controller.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">browser/cocoa/tab_strip_model_observer_bridge.h</string> + </object> + </object> + </object> + </object> + <int key="IBDocument.localizationMode">0</int> + <string key="IBDocument.LastKnownRelativeProjectPath">../../../chrome.xcodeproj</string> + <int key="IBDocument.defaultPropertyAccessControl">3</int> + </data> +</archive> diff --git a/chrome/app/nibs/en.lproj/MainMenu.xib b/chrome/app/nibs/en.lproj/MainMenu.xib index 46ab741..1e452d8 100644 --- a/chrome/app/nibs/en.lproj/MainMenu.xib +++ b/chrome/app/nibs/en.lproj/MainMenu.xib @@ -1150,14 +1150,6 @@ </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> - <string key="label">orderFrontStandardAboutPanel:</string> - <reference key="source" ref="1021"/> - <reference key="destination" ref="238522557"/> - </object> - <int key="connectionID">142</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> <string key="label">performClose:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="776162233"/> @@ -1580,6 +1572,14 @@ </object> <int key="connectionID">615</int> </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">orderFrontStandardAboutPanel:</string> + <reference key="source" ref="168151378"/> + <reference key="destination" ref="238522557"/> + </object> + <int key="connectionID">644</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -2779,13 +2779,13 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>{{525, 802}, {197, 73}}</string> - <string>{{455, 721}, {535, 20}}</string> + <string>{{398, 662}, {535, 20}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>{74, 862}</string> <string>{{11, 977}, {478, 20}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{647, 508}, {273, 213}}</string> + <string>{{570, 508}, {273, 213}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{475, 832}, {234, 43}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -2917,12 +2917,50 @@ <object class="NSMutableArray" key="referencedPartialClassDescriptions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBPartialClassDescription"> + <string key="className">AboutController</string> + <string key="superclassName">NSWindowController</string> + <object class="NSMutableDictionary" key="actions"> + <string key="NS.key.0">updateNow:</string> + <string key="NS.object.0">id</string> + </object> + <object class="NSMutableDictionary" key="outlets"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>spinner_</string> + <string>upToDate_</string> + <string>updateCompleted_</string> + <string>version_</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>NSProgressIndicator</string> + <string>NSTextField</string> + <string>NSTextField</string> + <string>NSTextField</string> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">browser/cocoa/about_controller.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">AboutController</string> + <string key="superclassName">NSWindowController</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBUserSource</string> + <string key="minorKey"/> + </object> + </object> + <object class="IBPartialClassDescription"> <string key="className">AppController</string> <string key="superclassName">NSObject</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMutableArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> + <string>orderFrontStandardAboutPanel:</string> <string>quit:</string> <string>showPreferences:</string> </object> @@ -2930,8 +2968,13 @@ <bool key="EncodedWithXMLCoder">YES</bool> <string>id</string> <string>id</string> + <string>id</string> </object> </object> + <object class="NSMutableDictionary" key="outlets"> + <string key="NS.key.0">aboutController_</string> + <string key="NS.object.0">AboutController</string> + </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBProjectSource</string> <string key="minorKey">browser/app_controller_mac.h</string> diff --git a/chrome/browser/app_controller_mac.h b/chrome/browser/app_controller_mac.h index d916abf..bf2aebc 100644 --- a/chrome/browser/app_controller_mac.h +++ b/chrome/browser/app_controller_mac.h @@ -11,6 +11,7 @@ #include "base/scoped_nsobject.h" #include "base/scoped_ptr.h" +@class AboutWindowController; class BookmarkMenuBridge; class CommandUpdater; class GURL; @@ -27,6 +28,7 @@ class Profile; // (and Browser*s). scoped_ptr<BookmarkMenuBridge> bookmarkMenuBridge_; scoped_nsobject<PreferencesWindowController> prefsController_; + scoped_nsobject<AboutWindowController> aboutController_; // URLs that need to be opened when the app is fully initialized. Because it's // only needed during early startup, it points to a valid vector during early @@ -41,6 +43,10 @@ class Profile; // visible. - (IBAction)showPreferences:(id)sender; +// Redirect in the menu item from the expected target of "File's +// Owner" (NSAppliation) for a Branded About Box +- (IBAction)orderFrontStandardAboutPanel:(id)sender; + @end #endif diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm index 0b88c36..74667c7 100644 --- a/chrome/browser/app_controller_mac.mm +++ b/chrome/browser/app_controller_mac.mm @@ -12,6 +12,7 @@ #include "chrome/browser/browser_init.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/browser_shutdown.h" +#import "chrome/browser/cocoa/about_window_controller.h" #import "chrome/browser/cocoa/bookmark_menu_bridge.h" #import "chrome/browser/cocoa/encoding_menu_controller_delegate_mac.h" #import "chrome/browser/cocoa/menu_localizer.h" @@ -93,10 +94,6 @@ [self openPendingURLs]; } -- (void)dealloc { - [super dealloc]; -} - // We can't use the standard terminate: method because it will abruptly exit // the app and leave things on the stack in an unfinalized state. We need to // post a quit message to our run loop so the stack can gracefully unwind. @@ -148,6 +145,8 @@ enable = YES; } else if (action == @selector(showPreferences:)) { enable = YES; + } else if (action == @selector(orderFrontStandardAboutPanel:)) { + enable = YES; } return enable; } @@ -285,7 +284,10 @@ // Called when the preferences window is closed. We use this to release the // window controller. - (void)prefsWindowClosed:(NSNotification*)notify { - [[NSNotificationCenter defaultCenter] removeObserver:self]; + [[NSNotificationCenter defaultCenter] + removeObserver:self + name:kUserDoneEditingPrefsNotification + object:prefsController_.get()]; prefsController_.reset(NULL); } @@ -306,4 +308,46 @@ [prefsController_ showPreferences:sender]; } +// Called when the about window is closed. We use this to release the +// window controller. +- (void)aboutWindowClosed:(NSNotification*)notify { + [[NSNotificationCenter defaultCenter] + removeObserver:self + name:kUserClosedAboutNotification + object:aboutController_.get()]; + aboutController_.reset(NULL); +} + +- (IBAction)orderFrontStandardAboutPanel:(id)sender { +#if !defined(GOOGLE_CHROME_BUILD) + // If not branded behave like a generic Cocoa app. + [NSApp orderFrontStandardAboutPanel:sender]; +#else + // Otherwise bring up our special dialog (e.g. with an auto-update button). + if (!aboutController_) { + aboutController_.reset([[AboutWindowController alloc] + initWithWindowNibName:@"About"]); + if (!aboutController_) { + // If we get here something is wacky. I managed to do it when + // testing by explicitly forcing an auto-update to an older + // version then trying to open the about box again (missing + // nib). This shouldn't be possible in general but let's try + // hard to not do nothing. + [NSApp orderFrontStandardAboutPanel:sender]; + return; + } + // Watch for a notification of when it goes away so that we can destroy + // the controller. + [[NSNotificationCenter defaultCenter] + addObserver:self + selector:@selector(aboutWindowClosed:) + name:kUserClosedAboutNotification + object:aboutController_.get()]; + } + if (![[aboutController_ window] isVisible]) + [[aboutController_ window] center]; + [aboutController_ showWindow:self]; +#endif +} + @end diff --git a/chrome/browser/cocoa/about_window_controller.h b/chrome/browser/cocoa/about_window_controller.h new file mode 100644 index 0000000..2117365 --- /dev/null +++ b/chrome/browser/cocoa/about_window_controller.h @@ -0,0 +1,45 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_COCOA_ABOUT_WINDOW_CONTROLLER_MAC_H_ +#define CHROME_BROWSER_COCOA_ABOUT_WINDOW_CONTROLLER_MAC_H_ + +#import <Cocoa/Cocoa.h> +#import "chrome/app/keystone_glue.h" + +@class AppController; + +// A window controller that handles the branded (Chrome.app) about +// window. The branded about window has a few features beyond the +// standard Cocoa about panel. For example, opening the about window +// will check to see if this version is current and tell the user. +// There is also an "update me now" button with a progress spinner. +@interface AboutWindowController : NSWindowController<KeystoneGlueCallbacks> { + @private + IBOutlet NSTextField* version_; + IBOutlet NSTextField* upToDate_; + IBOutlet NSTextField* updateCompleted_; + IBOutlet NSProgressIndicator* spinner_; + IBOutlet NSButton* updateNowButton_; + + BOOL updateTriggered_; // Has an update ever been triggered? +} + +// Trigger an update right now, as initiated by a button. +- (IBAction)updateNow:(id)sender; + +@end + + +@interface AboutWindowController (JustForTesting) +- (NSButton*)updateButton; +- (NSTextField*)upToDateTextField; +- (NSTextField*)updateCompletedTextField; +@end + + +// NSNotification sent when the about window is closed. +extern NSString* const kUserClosedAboutNotification; + +#endif diff --git a/chrome/browser/cocoa/about_window_controller.mm b/chrome/browser/cocoa/about_window_controller.mm new file mode 100644 index 0000000..c145a14 --- /dev/null +++ b/chrome/browser/cocoa/about_window_controller.mm @@ -0,0 +1,133 @@ +// 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 "app/l10n_util.h" +#include "base/file_version_info.h" +#include "base/logging.h" +#include "base/mac_util.h" +#include "base/string_util.h" +#include "base/sys_string_conversions.h" +#import "chrome/app/keystone_glue.h" +#import "chrome/browser/cocoa/about_window_controller.h" +#include "grit/generated_resources.h" + +NSString* const kUserClosedAboutNotification = + @"kUserClosedAboutNotification"; + +@interface AboutWindowController (Private) +- (KeystoneGlue*)defaultKeystoneGlue; +@end + + +@implementation AboutWindowController + +- (id)initWithWindowNibName:(NSString*)nibName { + NSString* nibpath = [mac_util::MainAppBundle() pathForResource:nibName + ofType:@"nib"]; + self = [super initWithWindowNibPath:nibpath owner:self]; + return self; +} + +- (void)awakeFromNib { + // Set our current version. + scoped_ptr<FileVersionInfo> version_info( + FileVersionInfo::CreateFileVersionInfoForCurrentModule()); + NSString* version = base::SysWideToNSString(version_info->file_version()); + [version_ setStringValue:version]; + + // Localize the update now button. + NSString* updateNow = base::SysWideToNSString( + l10n_util::GetString(IDS_ABOUT_CHROME_UPDATE_CHECK)); + [updateNowButton_ setStringValue:updateNow]; + + // TODO(jrg): localize the rest of the elements: + // - "Google Chrome" string at top + // - copyright string at bottom + + // Initiate an update check. + if ([[self defaultKeystoneGlue] checkForUpdate:self]) + [spinner_ startAnimation:self]; +} + +- (KeystoneGlue*)defaultKeystoneGlue { + return [KeystoneGlue defaultKeystoneGlue]; +} + +// Callback from KeystoneGlue; implementation of KeystoneGlueCallbacks protocol. +// Warning: latest version may be nil if not set in server config. +- (void)upToDateCheckCompleted:(BOOL)updatesAvailable + latestVersion:(NSString*)latestVersion { + [spinner_ stopAnimation:self]; + + // If an update is available, be sure to enable the "update now" button. + NSString* display = @"No updates are available."; + if (updatesAvailable) { + [updateNowButton_ setEnabled:YES]; + // TODO(jrg): IDS_UPGRADE_AVAILABLE seems close but there is no facility + // for specifying a verision in the update string. Do we care? + display = latestVersion ? + [NSString stringWithFormat:@"Version %@ is available for update.", + latestVersion] : + @"A new version is available."; + } + [upToDate_ setStringValue:display]; +} + +- (void)windowWillClose:(NSNotification*)notification { + // If an update has ever been triggered, we force reuse of the same About Box. + // This gives us 2 things: + // 1. If an update is ongoing and the window was closed we would have + // no way of getting status. + // 2. If we have a "Please restart" message we want it to stay there. + if (updateTriggered_) + return; + + [[NSNotificationCenter defaultCenter] + postNotificationName:kUserClosedAboutNotification + object:self]; +} + +// Callback from KeystoneGlue; implementation of KeystoneGlueCallbacks protocol. +- (void)updateCompleted:(BOOL)successful installs:(int)installs { + [spinner_ stopAnimation:self]; + // TODO(jrg): localize. No current string really says this. + NSString* display = ((successful && installs) ? + @"Update completed! Please restart Chrome." : + @"Self update failed."); + [updateCompleted_ setStringValue:display]; + + // Allow a second chance. + if (!(successful && installs)) + [updateNowButton_ setEnabled:YES]; +} + +- (IBAction)updateNow:(id)sender { + updateTriggered_ = YES; + // Don't let someone click "Update Now" twice! + [updateNowButton_ setEnabled:NO]; + [spinner_ startAnimation:self]; + if ([[self defaultKeystoneGlue] startUpdate:self]) + [spinner_ startAnimation:self]; + else { + // TODO(jrg): localize. + // IDS_UPGRADE_ERROR doesn't work here; we don't have an error number, and + // "server not available" is too specific. + [updateCompleted_ setStringValue:@"Failed to start updates."]; + } +} + +- (NSButton*)updateButton { + return updateNowButton_; +} + +- (NSTextField*)upToDateTextField { + return upToDate_; +} + +- (NSTextField*)updateCompletedTextField { + return updateCompleted_; +} + +@end + diff --git a/chrome/browser/cocoa/about_window_controller_unittest.mm b/chrome/browser/cocoa/about_window_controller_unittest.mm new file mode 100644 index 0000000..1f1ad54 --- /dev/null +++ b/chrome/browser/cocoa/about_window_controller_unittest.mm @@ -0,0 +1,63 @@ +// 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> + +#import "base/scoped_nsobject.h" +#import "chrome/browser/cocoa/about_window_controller.h" +#include "chrome/browser/cocoa/browser_test_helper.h" +#include "chrome/browser/cocoa/cocoa_test_helper.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" + +namespace { + +class AboutWindowControllerTest : public PlatformTest { + public: + virtual void SetUp() { + PlatformTest::SetUp(); + about_window_controller_.reset([[AboutWindowController alloc] + initWithWindowNibName:@"About"]); + // make sure the nib is loaded + [about_window_controller_ window]; + } + + scoped_nsobject<AboutWindowController> about_window_controller_; +}; + +TEST_F(AboutWindowControllerTest, TestButton) { + NSButton* button = [about_window_controller_ updateButton]; + ASSERT_TRUE(button); + + // Not enabled until we know if updates are available. + ASSERT_FALSE([button isEnabled]); + [about_window_controller_ upToDateCheckCompleted:YES latestVersion:nil]; + ASSERT_TRUE([button isEnabled]); + + // Make sure the button is hooked up + ASSERT_EQ([button target], about_window_controller_.get()); + ASSERT_EQ([button action], @selector(updateNow:)); + + // Make sure the button is disabled once clicked + [about_window_controller_ updateNow:about_window_controller_.get()]; + ASSERT_FALSE([button isEnabled]); +} + +// Doesn't confirm correctness, but does confirm something happens. +TEST_F(AboutWindowControllerTest, TestCallbacks) { + NSString *upToDate = [[about_window_controller_ upToDateTextField] + stringValue]; + [about_window_controller_ upToDateCheckCompleted:NO latestVersion:@"foo"]; + ASSERT_FALSE([upToDate isEqual:[[about_window_controller_ upToDateTextField] + stringValue]]); + + NSString *completed = [[about_window_controller_ updateCompletedTextField] + stringValue]; + [about_window_controller_ updateCompleted:NO installs:0]; + ASSERT_FALSE([completed isEqual:[[about_window_controller_ + updateCompletedTextField] stringValue]]); +} + +} // namespace + diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 9e73883..c48e95f 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -619,6 +619,8 @@ 'browser/chrome_plugin_host.h', 'browser/chrome_thread.cc', 'browser/chrome_thread.h', + 'browser/cocoa/about_window_controller.h', + 'browser/cocoa/about_window_controller.mm', 'browser/cocoa/base_view.h', 'browser/cocoa/base_view.mm', 'browser/cocoa/bookmark_bar_controller.h', @@ -1907,6 +1909,7 @@ 'app/scoped_ole_initializer.h', ], 'mac_bundle_resources': [ + 'app/nibs/en.lproj/About.xib', 'app/nibs/en.lproj/BrowserWindow.xib', 'app/nibs/en.lproj/FindBar.xib', 'app/nibs/en.lproj/MainMenu.xib', @@ -2671,6 +2674,11 @@ ], 'sources': [ 'app/breakpad_mac_stubs.mm', + # *NO* files in chrome/app have unit tests (except keystone_glue)!!! + # It seems a waste to have an app_unittests target, so for now + # I add keystone_glue.m explicitly to this target. + 'app/keystone_glue.m', + 'app/keystone_glue_unittest.mm', # All unittests in browser, common, and renderer. 'browser/autocomplete/autocomplete_unittest.cc', 'browser/autocomplete/autocomplete_popup_view_mac_unittest.mm', @@ -2700,6 +2708,7 @@ # It is safe to list */cocoa/* files in the "common" file list # without an explicit exclusion since gyp is smart enough to # exclude them from non-Mac builds. + 'browser/cocoa/about_window_controller_unittest.mm', 'browser/cocoa/base_view_unittest.mm', 'browser/cocoa/bookmark_bar_controller_unittest.mm', 'browser/cocoa/bookmark_menu_bridge_unittest.mm', |