diff options
-rw-r--r-- | chrome/app/generated_resources.grd | 7 | ||||
-rw-r--r-- | chrome/app/nibs/About.xib | 705 | ||||
-rw-r--r-- | chrome/browser/app_controller_mac.mm | 5 | ||||
-rw-r--r-- | chrome/browser/cocoa/about_window_controller.h | 23 | ||||
-rw-r--r-- | chrome/browser/cocoa/about_window_controller.mm | 351 | ||||
-rw-r--r-- | chrome/browser/cocoa/about_window_controller_unittest.mm | 11 | ||||
-rw-r--r-- | chrome/browser/cocoa/background_tile_view.h | 22 | ||||
-rw-r--r-- | chrome/browser/cocoa/background_tile_view.mm | 32 | ||||
-rw-r--r-- | chrome/browser/cocoa/background_tile_view_unittest.mm | 44 | ||||
-rw-r--r-- | chrome/browser/cocoa/restart_browser.h | 21 | ||||
-rw-r--r-- | chrome/browser/cocoa/restart_browser.mm | 67 | ||||
-rw-r--r-- | chrome/chrome.gyp | 8 |
12 files changed, 1000 insertions, 296 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 3956679..b4cc79e 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -4867,6 +4867,13 @@ each locale. --> </message> </if> + <!-- Extra Mac UI Strings --> + <if expr="os == 'darwin'"> + <message name="IDS_PLEASE_RESTART_BROWSER" desc="Title of the alert when Chrome needs to be restart for a change/update to take effect."> + Please Restart <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> + </message> + </if> + </messages> </release> </grit> diff --git a/chrome/app/nibs/About.xib b/chrome/app/nibs/About.xib index bf15e81..9249b0d 100644 --- a/chrome/app/nibs/About.xib +++ b/chrome/app/nibs/About.xib @@ -2,13 +2,13 @@ <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03"> <data> <int key="IBDocument.SystemTarget">1050</int> - <string key="IBDocument.SystemVersion">9J61</string> + <string key="IBDocument.SystemVersion">9L30</string> <string key="IBDocument.InterfaceBuilderVersion">677</string> - <string key="IBDocument.AppKitVersion">949.46</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="4"/> + <integer value="3"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -37,9 +37,9 @@ <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="NSWindowRect">{{196, 257}, {450, 246}}</string> + <int key="NSWTFlags">-469761024</int> + <string key="NSWindowTitle">^IDS_ABOUT_CHROME_TITLE</string> <string key="NSWindowClass">NSPanel</string> <nil key="NSViewClass"/> <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> @@ -48,72 +48,35 @@ <int key="NSvFlags">256</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSImageView" id="623665386"> + <object class="NSTextField" id="564072719"> <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> + <int key="NSvFlags">266</int> + <string key="NSFrame">{{17, 52}, {416, 41}}</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="NSTextFieldCell" key="NSCell" id="965526644"> + <int key="NSCellFlags">-2080244224</int> + <int key="NSCellFlags2">1346502656</int> + <string key="NSContents">textblock</string> <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"> + <reference key="NSControlView" ref="564072719"/> + <object class="NSColor" key="NSBackgroundColor"> <int key="NSColorSpace">6</int> <string key="NSCatalogName">System</string> - <string key="NSColorName">controlColor</string> + <string key="NSColorName">textBackgroundColor</string> <object class="NSColor" key="NSColor"> <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MC42NjY2NjY2OQA</bytes> + <bytes key="NSWhite">MQA</bytes> </object> </object> - <object class="NSColor" key="NSTextColor" id="253483895"> + <object class="NSColor" key="NSTextColor"> <int key="NSColorSpace">6</int> <string key="NSCatalogName">System</string> - <string key="NSColorName">controlTextColor</string> + <string key="NSColorName">textColor</string> <object class="NSColor" key="NSColor" id="568235873"> <int key="NSColorSpace">3</int> <bytes key="NSWhite">MAA</bytes> @@ -121,135 +84,207 @@ </object> </object> </object> - <object class="NSTextField" id="243051668"> + <object class="NSCustomView" id="4268204"> <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"/> + <int key="NSvFlags">266</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSTextField" id="171870711"> + <reference key="NSNextResponder" ref="4268204"/> + <int key="NSvFlags">266</int> + <string key="NSFrame">{{17, 81}, {230, 14}}</string> + <reference key="NSSuperview" ref="4268204"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="881628032"> + <int key="NSCellFlags">70385217</int> + <int key="NSCellFlags2">4326400</int> + <string key="NSContents">version</string> + <reference key="NSSupport" ref="26"/> + <reference key="NSControlView" ref="171870711"/> + <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> + <reference key="NSColor" ref="568235873"/> + </object> + </object> + </object> + <object class="NSTextField" id="308038257"> + <reference key="NSNextResponder" ref="4268204"/> + <int key="NSvFlags">266</int> + <string key="NSFrame">{{17, 96}, {230, 29}}</string> + <reference key="NSSuperview" ref="4268204"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="625581420"> + <int key="NSCellFlags">68288064</int> + <int key="NSCellFlags2">1077937152</int> + <string key="NSContents">^IDS_PRODUCT_NAME</string> + <object class="NSFont" key="NSSupport"> + <string key="NSName">LucidaGrande</string> + <double key="NSSize">2.400000e+01</double> + <int key="NSfFlags">16</int> + </object> + <reference key="NSControlView" ref="308038257"/> + <reference key="NSBackgroundColor" ref="782671173"/> + <reference key="NSTextColor" ref="253483895"/> + </object> + </object> + <object class="NSImageView" id="623665386"> + <reference key="NSNextResponder" ref="4268204"/> + <int key="NSvFlags">265</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">{{260, 0}, {190, 145}}</string> + <reference key="NSSuperview" ref="4268204"/> + <bool key="NSEnabled">YES</bool> + <object class="NSImageCell" key="NSCell" id="357051704"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">33685504</int> + <reference key="NSSupport" ref="26"/> + <int key="NSAlign">0</int> + <int key="NSScale">2</int> + <int key="NSStyle">0</int> + <bool key="NSAnimates">NO</bool> + </object> + <bool key="NSEditable">YES</bool> + </object> </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> + <string key="NSFrame">{{0, 101}, {470, 145}}</string> <reference key="NSSuperview" ref="498033215"/> - <bool key="NSEnabled">YES</bool> - <object class="NSTextFieldCell" key="NSCell" id="881628032"> - <int key="NSCellFlags">70385217</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> + <string key="NSClassName">BackgroundTileView</string> </object> - <object class="NSTextField" id="562997276"> + <object class="NSCustomView" id="979682390"> <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> + <int key="NSvFlags">266</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSImageView" id="655400225"> + <reference key="NSNextResponder" ref="979682390"/> + <int key="NSvFlags">-2147483380</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">{{20, 7}, {17, 17}}</string> + <reference key="NSSuperview" ref="979682390"/> + <bool key="NSEnabled">YES</bool> + <object class="NSImageCell" key="NSCell" id="481283764"> + <int key="NSCellFlags">130560</int> + <int key="NSCellFlags2">33554432</int> + <int key="NSAlign">0</int> + <int key="NSScale">2</int> + <int key="NSStyle">0</int> + <bool key="NSAnimates">YES</bool> </object> + <bool key="NSEditable">YES</bool> </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 class="NSProgressIndicator" id="342353587"> + <reference key="NSNextResponder" ref="979682390"/> + <int key="NSvFlags">1292</int> + <object class="NSPSMatrix" key="NSDrawMatrix"/> + <string key="NSFrame">{{20, 7}, {16, 16}}</string> + <reference key="NSSuperview" ref="979682390"/> + <int key="NSpiFlags">28938</int> + <double key="NSMinValue">1.600000e+01</double> + <double key="NSMaxValue">1.000000e+02</double> + </object> + <object class="NSCustomView" id="214245090"> + <reference key="NSNextResponder" ref="979682390"/> + <int key="NSvFlags">289</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSButton" id="1015655775"> + <reference key="NSNextResponder" ref="214245090"/> + <int key="NSvFlags">289</int> + <string key="NSFrame">{{10, 0}, {81, 28}}</string> + <reference key="NSSuperview" ref="214245090"/> + <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">^IDS_ABOUT_CHROME_UPDATE_CHECK</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> + <string key="NSFrame">{{344, 0}, {106, 31}}</string> + <reference key="NSSuperview" ref="979682390"/> + <string key="NSClassName">GTMWidthBasedTweaker</string> + </object> + <object class="NSTextField" id="309109286"> + <reference key="NSNextResponder" ref="979682390"/> + <int key="NSvFlags">266</int> + <string key="NSFrame">{{42, 8}, {297, 14}}</string> + <reference key="NSSuperview" ref="979682390"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="870089784"> + <int key="NSCellFlags">68288064</int> + <int key="NSCellFlags2">272761856</int> + <string key="NSContents">messages</string> + <reference key="NSSupport" ref="26"/> + <reference key="NSControlView" ref="309109286"/> + <reference key="NSBackgroundColor" ref="782671173"/> + <reference key="NSTextColor" ref="253483895"/> + </object> </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> + <string key="NSFrame">{{0, 13}, {450, 31}}</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> + <string key="NSClassName">NSView</string> </object> </object> - <string key="NSFrameSize">{308, 361}</string> + <string key="NSFrameSize">{450, 246}</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 class="NSCustomObject" id="122782331"> + <string key="NSClassName">ChromeUILocalizer</string> + </object> + <object class="NSCustomObject" id="658354940"> + <string key="NSClassName">GTMUILocalizerAndLayoutTweaker</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"/> @@ -266,14 +301,6 @@ bCBSaWdodHMgUmVzZXJ2ZWQuA</string> </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"/> @@ -304,6 +331,78 @@ bCBSaWdodHMgUmVzZXJ2ZWQuA</string> </object> <int key="connectionID">31</int> </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">backgroundView_</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="4268204"/> + </object> + <int key="connectionID">39</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">logoView_</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="623665386"/> + </object> + <int key="connectionID">42</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">legalBlock_</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="564072719"/> + </object> + <int key="connectionID">46</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">updateBlock_</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="979682390"/> + </object> + <int key="connectionID">48</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">localizer_</string> + <reference key="source" ref="658354940"/> + <reference key="destination" ref="122782331"/> + </object> + <int key="connectionID">52</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">uiObject_</string> + <reference key="source" ref="658354940"/> + <reference key="destination" ref="820943852"/> + </object> + <int key="connectionID">53</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">updateStatusIndicator_</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="655400225"/> + </object> + <int key="connectionID">57</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">viewToSlideAndResize_</string> + <reference key="source" ref="214245090"/> + <reference key="destination" ref="309109286"/> + </object> + <int key="connectionID">60</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">updateText_</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="309109286"/> + </object> + <int key="connectionID">61</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -349,66 +448,64 @@ bCBSaWdodHMgUmVzZXJ2ZWQuA</string> <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="4268204"/> <reference ref="564072719"/> - <reference ref="171870711"/> - <reference ref="243051668"/> + <reference ref="979682390"/> </object> <reference key="parent" ref="820943852"/> </object> <object class="IBObjectRecord"> - <int key="objectID">5</int> - <reference key="object" ref="308038257"/> + <int key="objectID">8</int> + <reference key="object" ref="564072719"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="625581420"/> + <reference ref="965526644"/> </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"/> + <int key="objectID">15</int> + <reference key="object" ref="965526644"/> + <reference key="parent" ref="564072719"/> </object> <object class="IBObjectRecord"> - <int key="objectID">7</int> - <reference key="object" ref="1015655775"/> + <int key="objectID">34</int> + <reference key="object" ref="4268204"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="515715235"/> + <reference ref="308038257"/> + <reference ref="623665386"/> + <reference ref="171870711"/> </object> <reference key="parent" ref="498033215"/> </object> <object class="IBObjectRecord"> - <int key="objectID">8</int> - <reference key="object" ref="564072719"/> + <int key="objectID">10</int> + <reference key="object" ref="171870711"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="965526644"/> + <reference ref="881628032"/> </object> - <reference key="parent" ref="498033215"/> + <reference key="parent" ref="4268204"/> </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"/> + <int key="objectID">13</int> + <reference key="object" ref="881628032"/> + <reference key="parent" ref="171870711"/> </object> <object class="IBObjectRecord"> - <int key="objectID">10</int> - <reference key="object" ref="171870711"/> + <int key="objectID">5</int> + <reference key="object" ref="308038257"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="881628032"/> + <reference ref="625581420"/> </object> - <reference key="parent" ref="498033215"/> + <reference key="parent" ref="4268204"/> + </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">11</int> @@ -417,7 +514,7 @@ bCBSaWdodHMgUmVzZXJ2ZWQuA</string> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="357051704"/> </object> - <reference key="parent" ref="498033215"/> + <reference key="parent" ref="4268204"/> </object> <object class="IBObjectRecord"> <int key="objectID">12</int> @@ -425,19 +522,49 @@ bCBSaWdodHMgUmVzZXJ2ZWQuA</string> <reference key="parent" ref="623665386"/> </object> <object class="IBObjectRecord"> - <int key="objectID">13</int> - <reference key="object" ref="881628032"/> - <reference key="parent" ref="171870711"/> + <int key="objectID">40</int> + <reference key="object" ref="122782331"/> + <reference key="parent" ref="1002"/> </object> <object class="IBObjectRecord"> - <int key="objectID">14</int> - <reference key="object" ref="1062740497"/> - <reference key="parent" ref="562997276"/> + <int key="objectID">47</int> + <reference key="object" ref="979682390"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="342353587"/> + <reference ref="214245090"/> + <reference ref="655400225"/> + <reference ref="309109286"/> + </object> + <reference key="parent" ref="498033215"/> </object> <object class="IBObjectRecord"> - <int key="objectID">15</int> - <reference key="object" ref="965526644"/> - <reference key="parent" ref="564072719"/> + <int key="objectID">6</int> + <reference key="object" ref="342353587"/> + <reference key="parent" ref="979682390"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">51</int> + <reference key="object" ref="658354940"/> + <reference key="parent" ref="1002"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">54</int> + <reference key="object" ref="214245090"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="1015655775"/> + </object> + <reference key="parent" ref="979682390"/> + </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="214245090"/> </object> <object class="IBObjectRecord"> <int key="objectID">16</int> @@ -445,23 +572,32 @@ bCBSaWdodHMgUmVzZXJ2ZWQuA</string> <reference key="parent" ref="1015655775"/> </object> <object class="IBObjectRecord"> - <int key="objectID">17</int> - <reference key="object" ref="625581420"/> - <reference key="parent" ref="308038257"/> + <int key="objectID">55</int> + <reference key="object" ref="655400225"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="481283764"/> + </object> + <reference key="parent" ref="979682390"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">56</int> + <reference key="object" ref="481283764"/> + <reference key="parent" ref="655400225"/> </object> <object class="IBObjectRecord"> - <int key="objectID">25</int> - <reference key="object" ref="243051668"/> + <int key="objectID">58</int> + <reference key="object" ref="309109286"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="605929825"/> + <reference ref="870089784"/> </object> - <reference key="parent" ref="498033215"/> + <reference key="parent" ref="979682390"/> </object> <object class="IBObjectRecord"> - <int key="objectID">26</int> - <reference key="object" ref="605929825"/> - <reference key="parent" ref="243051668"/> + <int key="objectID">59</int> + <reference key="object" ref="870089784"/> + <reference key="parent" ref="309109286"/> </object> </object> </object> @@ -476,22 +612,24 @@ bCBSaWdodHMgUmVzZXJ2ZWQuA</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>4.IBUserGuides</string> + <string>40.IBPluginDependency</string> + <string>47.IBUserGuides</string> <string>5.IBPluginDependency</string> + <string>51.IBPluginDependency</string> + <string>58.IBPluginDependency</string> + <string>59.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> @@ -505,13 +643,19 @@ bCBSaWdodHMgUmVzZXJ2ZWQuA</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>{{652, 526}, {450, 246}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>{{652, 526}, {450, 246}}</string> + <boolean value="NO"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <object class="NSMutableArray"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{652, 412}, {308, 361}}</string> + <object class="NSArray"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> <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> @@ -540,7 +684,7 @@ bCBSaWdodHMgUmVzZXJ2ZWQuA</string> </object> </object> <nil key="sourceID"/> - <int key="maxID">31</int> + <int key="maxID">61</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -556,18 +700,30 @@ bCBSaWdodHMgUmVzZXJ2ZWQuA</string> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMutableArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> + <string>backgroundView_</string> + <string>legalBlock_</string> + <string>logoView_</string> <string>spinner_</string> <string>upToDate_</string> + <string>updateBlock_</string> <string>updateCompleted_</string> <string>updateNowButton_</string> + <string>updateStatusIndicator_</string> + <string>updateText_</string> <string>version_</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> + <string>BackgroundTileView</string> + <string>NSTextField</string> + <string>NSImageView</string> <string>NSProgressIndicator</string> <string>NSTextField</string> + <string>NSView</string> <string>NSTextField</string> <string>NSButton</string> + <string>NSImageView</string> + <string>NSTextField</string> <string>NSTextField</string> </object> </object> @@ -577,6 +733,95 @@ bCBSaWdodHMgUmVzZXJ2ZWQuA</string> </object> </object> <object class="IBPartialClassDescription"> + <string key="className">BackgroundTileView</string> + <string key="superclassName">NSView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">browser/cocoa/background_tile_view.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">ChromeUILocalizer</string> + <string key="superclassName">GTMUILocalizer</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">browser/cocoa/ui_localizer.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">GTMUILocalizer</string> + <string key="superclassName">NSObject</string> + <object class="NSMutableDictionary" key="outlets"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>otherObjectToLocalize_</string> + <string>owner_</string> + <string>yetAnotherObjectToLocalize_</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>id</string> + <string>id</string> + <string>id</string> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">../third_party/GTM/AppKit/GTMUILocalizer.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">GTMUILocalizerAndLayoutTweaker</string> + <string key="superclassName">NSObject</string> + <object class="NSMutableDictionary" key="outlets"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>localizerOwner_</string> + <string>localizer_</string> + <string>uiObject_</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>id</string> + <string>GTMUILocalizer</string> + <string>id</string> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="105423212"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">../third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">GTMWidthBasedTweaker</string> + <string key="superclassName">NSView</string> + <object class="NSMutableDictionary" key="outlets"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>viewToResize_</string> + <string>viewToSlideAndResize_</string> + <string>viewToSlide_</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>id</string> + <string>NSView</string> + <string>NSView</string> + </object> + </object> + <reference key="sourceIdentifier" ref="105423212"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">browser/cocoa/status_bubble_mac.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBProjectSource</string> @@ -586,7 +831,7 @@ bCBSaWdodHMgUmVzZXJ2ZWQuA</string> </object> </object> <int key="IBDocument.localizationMode">0</int> - <string key="IBDocument.LastKnownRelativeProjectPath">../../../chrome.xcodeproj</string> + <string key="IBDocument.LastKnownRelativeProjectPath">../../chrome.xcodeproj</string> <int key="IBDocument.defaultPropertyAccessControl">3</int> </data> </archive> diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm index 3920fc6..be11db3 100644 --- a/chrome/browser/app_controller_mac.mm +++ b/chrome/browser/app_controller_mac.mm @@ -628,10 +628,6 @@ } - (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] @@ -656,7 +652,6 @@ 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 index 2117365..f9c7528 100644 --- a/chrome/browser/cocoa/about_window_controller.h +++ b/chrome/browser/cocoa/about_window_controller.h @@ -2,13 +2,14 @@ // 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_ +#ifndef CHROME_BROWSER_COCOA_ABOUT_WINDOW_CONTROLLER_H_ +#define CHROME_BROWSER_COCOA_ABOUT_WINDOW_CONTROLLER_H_ #import <Cocoa/Cocoa.h> +#include "base/scoped_nsobject.h" #import "chrome/app/keystone_glue.h" -@class AppController; +@class BackgroundTileView; // A window controller that handles the branded (Chrome.app) about // window. The branded about window has a few features beyond the @@ -18,12 +19,19 @@ @interface AboutWindowController : NSWindowController<KeystoneGlueCallbacks> { @private IBOutlet NSTextField* version_; - IBOutlet NSTextField* upToDate_; - IBOutlet NSTextField* updateCompleted_; + IBOutlet BackgroundTileView* backgroundView_; + IBOutlet NSImageView* logoView_; + IBOutlet NSTextField* legalBlock_; + IBOutlet NSView* updateBlock_; // Holds everything related to updates IBOutlet NSProgressIndicator* spinner_; + IBOutlet NSImageView* updateStatusIndicator_; + IBOutlet NSTextField* updateText_; IBOutlet NSButton* updateNowButton_; BOOL updateTriggered_; // Has an update ever been triggered? + + // The version we got told about by Keystone + scoped_nsobject<NSString> newVersionAvailable_; } // Trigger an update right now, as initiated by a button. @@ -34,12 +42,11 @@ @interface AboutWindowController (JustForTesting) - (NSButton*)updateButton; -- (NSTextField*)upToDateTextField; -- (NSTextField*)updateCompletedTextField; +- (NSTextField*)updateText; @end // NSNotification sent when the about window is closed. extern NSString* const kUserClosedAboutNotification; -#endif +#endif // CHROME_BROWSER_COCOA_ABOUT_WINDOW_CONTROLLER_H_ diff --git a/chrome/browser/cocoa/about_window_controller.mm b/chrome/browser/cocoa/about_window_controller.mm index d9ea076..5280c26 100644 --- a/chrome/browser/cocoa/about_window_controller.mm +++ b/chrome/browser/cocoa/about_window_controller.mm @@ -2,7 +2,8 @@ // 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 "app/l10n_util_mac.h" +#include "app/resource_bundle.h" #include "base/file_version_info.h" #include "base/logging.h" #include "base/mac_util.h" @@ -10,15 +11,170 @@ #include "base/sys_string_conversions.h" #import "chrome/app/keystone_glue.h" #import "chrome/browser/cocoa/about_window_controller.h" +#import "chrome/browser/cocoa/background_tile_view.h" +#include "chrome/browser/cocoa/restart_browser.h" +#include "grit/chromium_strings.h" #include "grit/generated_resources.h" +#include "grit/theme_resources.h" +#include "grit/locale_settings.h" +#include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" NSString* const kUserClosedAboutNotification = @"kUserClosedAboutNotification"; @interface AboutWindowController (Private) - (KeystoneGlue*)defaultKeystoneGlue; +- (void)startProgressMessageID:(uint32_t)messageID; +- (void)startProgressMessage:(NSString*)message; +- (void)stopProgressMessage:(NSString*)message imageID:(uint32_t)imageID; @end +namespace { + +// Keystone doesn't give us error numbers on some results, so we just make +// our own for reporting in the UI. +const int kUpdateInstallFailed = 128; +const int kUpdateInstallFailedToStart = 129; + +void AttributedStringAppendString(NSMutableAttributedString* attr_str, + NSString* str) { + // You might think doing [[attr_str mutableString] appendString:str] would + // work, but it causes any trailing style to get extened, meaning as we + // append links, they grow to include the new text, not what we want. + NSAttributedString* new_attr_str = + [[[NSAttributedString alloc] initWithString:str] autorelease]; + [attr_str appendAttributedString:new_attr_str]; +} + +void AttributedStringAppendHyperlink(NSMutableAttributedString* attr_str, + NSString* text, NSString* url_str) { + + // Figure out the range of the text we're adding and add the text. + NSRange range = NSMakeRange([attr_str length], [text length]); + AttributedStringAppendString(attr_str, text); + + // Add the link + [attr_str addAttribute:NSLinkAttributeName value:url_str range:range]; + + // Blue and underlined + [attr_str addAttribute:NSForegroundColorAttributeName + value:[NSColor blueColor] + range:range]; + [attr_str addAttribute:NSUnderlineStyleAttributeName + value:[NSNumber numberWithInt:NSSingleUnderlineStyle] + range:range]; +} + +NSAttributedString* BuildLegalTextBlock() { + // Windows builds this up in a very complex way, we're just trying to model + // it the best we can to get all the information in (they actually do it + // but created Labels and Links that they carefully place to make it appear + // to be a paragraph of text). + // src/chrome/browser/views/about_chrome_view.cc AboutChromeView::Init() + + NSMutableAttributedString* legal_block = + [[[NSMutableAttributedString alloc] init] autorelease]; + [legal_block beginEditing]; + + NSString* copyright = l10n_util::GetNSString(IDS_ABOUT_VERSION_COPYRIGHT); + AttributedStringAppendString(legal_block, copyright); + + // These are the markers directly in IDS_ABOUT_VERSION_LICENSE + NSString* kBeginLinkChr = @"BEGIN_LINK_CHR"; + NSString* kBeginLinkOss = @"BEGIN_LINK_OSS"; + NSString* kEndLinkChr = @"END_LINK_CHR"; + NSString* kEndLinkOss = @"END_LINK_OSS"; + // The CHR link should go to here + NSString* kChromiumProject = l10n_util::GetNSString(IDS_CHROMIUM_PROJECT_URL); + // The OSS link should go to here + NSString* kAcknowledgements = @"about:credits"; + + // Now fetch the license string and deal with the markers + + NSString* license = l10n_util::GetNSString(IDS_ABOUT_VERSION_LICENSE); + + NSRange begin_chr = [license rangeOfString:kBeginLinkChr]; + NSRange begin_oss = [license rangeOfString:kBeginLinkOss]; + NSRange end_chr = [license rangeOfString:kEndLinkChr]; + NSRange end_oss = [license rangeOfString:kEndLinkOss]; + DCHECK(begin_chr.location != NSNotFound); + DCHECK(begin_oss.location != NSNotFound); + DCHECK(end_chr.location != NSNotFound); + DCHECK(end_oss.location != NSNotFound); + + // We don't know which link will come first, so we have to deal with things + // like this: + // [text][begin][text][end][text][start][text][end][text] + + bool chromium_link_first = begin_chr.location < begin_oss.location; + + NSRange* begin1 = &begin_chr; + NSRange* begin2 = &begin_oss; + NSRange* end1 = &end_chr; + NSRange* end2 = &end_oss; + NSString* link1 = kChromiumProject; + NSString* link2 = kAcknowledgements; + if (!chromium_link_first) { + // OSS came first, switch! + begin2 = &begin_chr; + begin1 = &begin_oss; + end2 = &end_chr; + end1 = &end_oss; + link2 = kChromiumProject; + link1 = kAcknowledgements; + } + + NSString *sub_str; + + AttributedStringAppendString(legal_block, @"\n"); + sub_str = [license substringWithRange:NSMakeRange(0, begin1->location)]; + AttributedStringAppendString(legal_block, sub_str); + sub_str = [license substringWithRange:NSMakeRange(NSMaxRange(*begin1), + end1->location - + NSMaxRange(*begin1))]; + AttributedStringAppendHyperlink(legal_block, sub_str, link1); + sub_str = [license substringWithRange:NSMakeRange(NSMaxRange(*end1), + begin2->location - + NSMaxRange(*end1))]; + AttributedStringAppendString(legal_block, sub_str); + sub_str = [license substringWithRange:NSMakeRange(NSMaxRange(*begin2), + end2->location - + NSMaxRange(*begin2))]; + AttributedStringAppendHyperlink(legal_block, sub_str, link2); + sub_str = [license substringWithRange:NSMakeRange(NSMaxRange(*end2), + [license length] - + NSMaxRange(*end2))]; + AttributedStringAppendString(legal_block, sub_str); + +#if defined(GOOGLE_CHROME_BUILD) + // Terms of service is only valid for Google Chrome + + // The url within terms should point here: + NSString* kTOS = @"about:terms"; + // Following Window. There is one marker in the string for where the terms + // link goes, but the text of the link comes from a second string resources. + std::vector<size_t> url_offsets; + std::wstring w_about_terms = l10n_util::GetStringF(IDS_ABOUT_TERMS_OF_SERVICE, + std::wstring(), + std::wstring(), + &url_offsets); + DCHECK_EQ(url_offsets.size(), 1U); + NSString* about_terms = base::SysWideToNSString(w_about_terms); + NSString* terms_link_text = l10n_util::GetNSString(IDS_TERMS_OF_SERVICE); + + AttributedStringAppendString(legal_block, @"\n"); + sub_str = [about_terms substringToIndex:url_offsets[0]]; + AttributedStringAppendString(legal_block, sub_str); + AttributedStringAppendHyperlink(legal_block, terms_link_text, kTOS); + sub_str = [about_terms substringFromIndex:url_offsets[0]]; + AttributedStringAppendString(legal_block, sub_str); +#endif // defined(GOOGLE_CHROME_BUILD) + + [legal_block endEditing]; + return legal_block; +} + +} // namespace @implementation AboutWindowController @@ -33,45 +189,133 @@ NSString* const kUserClosedAboutNotification = // Set our current version. scoped_ptr<FileVersionInfo> version_info( FileVersionInfo::CreateFileVersionInfoForCurrentModule()); - NSString* version = base::SysWideToNSString(version_info->file_version()); - [version_ setStringValue:version]; + std::wstring version(version_info->product_version()); +#if !defined(GOOGLE_CHROME_BUILD) + // Yes, Windows does this raw since it is only in Chromium builds + // src/chrome/browser/views/about_chrome_view.cc AboutChromeView::Init() + version += L" ("; + version += version_info->last_change(); + version += L")"; +#endif + NSString* nsversion = base::SysWideToNSString(version); + [version_ setStringValue:nsversion]; + + // Put the two images into the ui + ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + NSImage* backgroundImage = rb.GetNSImageNamed(IDR_ABOUT_BACKGROUND_COLOR); + DCHECK(backgroundImage); + [backgroundView_ setTileImage:backgroundImage]; + NSImage* logoImage = rb.GetNSImageNamed(IDR_ABOUT_BACKGROUND); + DCHECK(logoImage); + [logoView_ setImage:logoImage]; + + // Put the legal text into + [legalBlock_ setAttributedStringValue:BuildLegalTextBlock()]; + + KeystoneGlue* keystone = [self defaultKeystoneGlue]; + CGFloat updateShift = 0.0; + if (keystone) { + // Initiate an update check. + if ([keystone checkForUpdate:self]) { + [self startProgressMessageID:IDS_UPGRADE_CHECK_STARTED]; + } + } else { + // Hide all the update UI + [updateBlock_ setHidden:YES]; + // Figure out the amount we're removing by taking about the update block + // (and it's spacing). + updateShift = NSMinY([legalBlock_ frame]) - NSMinY([updateBlock_ frame]); + } - // Localize the update now button. - NSString* updateNow = base::SysWideToNSString( - l10n_util::GetString(IDS_ABOUT_CHROME_UPDATE_CHECK)); - [updateNowButton_ setStringValue:updateNow]; + // Adjust the sizes/locations. - // TODO(jrg): localize the rest of the elements: - // - "Google Chrome" string at top - // - copyright string at bottom + CGFloat legalShift = + [GTMUILocalizerAndLayoutTweaker sizeToFitFixedWidthTextField:legalBlock_]; - // Initiate an update check. - if ([[self defaultKeystoneGlue] checkForUpdate:self]) - [spinner_ startAnimation:self]; + NSRect rect = [legalBlock_ frame]; + rect.origin.y -= updateShift; + [legalBlock_ setFrame:rect]; + + rect = [backgroundView_ frame]; + rect.origin.y = rect.origin.y - updateShift + legalShift; + [backgroundView_ setFrame:rect]; + + NSWindow* window = [self window]; + [[window contentView] setAutoresizesSubviews:NO]; + rect = [window frame]; + rect.size.height = rect.size.height - updateShift + legalShift; + [window setFrame:rect display:NO]; + [[window contentView] setAutoresizesSubviews:YES]; } - (KeystoneGlue*)defaultKeystoneGlue { return [KeystoneGlue defaultKeystoneGlue]; } +- (void)startProgressMessageID:(uint32_t)messageID { + NSString* message = l10n_util::GetNSStringWithFixup(messageID); + [self startProgressMessage:message]; +} + +- (void)startProgressMessage:(NSString*)message { + [updateStatusIndicator_ setHidden:YES]; + [spinner_ setHidden:NO]; + [spinner_ startAnimation:self]; + + [updateText_ setStringValue:message]; +} + +- (void)stopProgressMessage:(NSString*)message imageID:(uint32_t)imageID { + [spinner_ stopAnimation:self]; + [spinner_ setHidden:YES]; + if (imageID) { + [updateStatusIndicator_ setHidden:NO]; + ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + NSImage* statusImage = rb.GetNSImageNamed(imageID); + DCHECK(statusImage); + [updateStatusIndicator_ setImage:statusImage]; + } + + [updateText_ setStringValue:message]; +} + // 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."; + uint32_t imageID; + NSString* message; if (updatesAvailable) { + newVersionAvailable_.reset([latestVersion copy]); + + // Window UI doesn't put the version number in the string. + imageID = IDR_UPDATE_AVAILABLE; + message = + l10n_util::GetNSStringF(IDS_UPGRADE_AVAILABLE, + l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); [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."; + } else { + // NOTE: This is can be a lie, Keystone does not provide us with an error if + // it was not able to reach the server. So we can't completely map to the + // Windows UI. + + // Keystone does not provide the version number when we are up to date so to + // maintain the UI, we just go fetch our version and call it good. + scoped_ptr<FileVersionInfo> version_info( + FileVersionInfo::CreateFileVersionInfoForCurrentModule()); + std::wstring version(version_info->product_version()); + + // TODO: We really should check to see if what is on disk is newer then what + // is running and report it as such. (Windows has some messages that can + // help with this.) http://crbug.com/13165 + + imageID = IDR_UPDATE_UPTODATE; + message = + l10n_util::GetNSStringF(IDS_UPGRADE_ALREADY_UP_TO_DATE, + l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), + WideToUTF16(version)); } - [upToDate_ setStringValue:display]; + [self stopProgressMessage:message imageID:imageID]; } - (void)windowWillClose:(NSNotification*)notification { @@ -90,32 +334,51 @@ NSString* const kUserClosedAboutNotification = // 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)) + uint32_t imageID; + NSString* message; + if (successful && installs) { + imageID = IDR_UPDATE_UPTODATE; + if ([newVersionAvailable_.get() length]) { + message = + l10n_util::GetNSStringF(IDS_UPGRADE_SUCCESSFUL, + l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), + base::SysNSStringToUTF16( + newVersionAvailable_.get())); + } else { + message = + l10n_util::GetNSStringF(IDS_UPGRADE_SUCCESSFUL_NOVERSION, + l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); + } + + // Tell the user to restart their browser. + restart_browser::RequestRestart(nil); + + } else { + imageID = IDR_UPDATE_FAIL; + message = + l10n_util::GetNSStringF(IDS_UPGRADE_ERROR, + IntToString16(kUpdateInstallFailed)); + + // Allow a second chance. [updateNowButton_ setEnabled:YES]; + } + + [self stopProgressMessage:message imageID:imageID]; } - (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]) { // Clear any previous error message from the throbber area. - [updateCompleted_ setStringValue:@""]; - [spinner_ startAnimation:self]; + [self startProgressMessageID:IDS_UPGRADE_STARTED]; } 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."]; + NSString* message = + l10n_util::GetNSStringF(IDS_UPGRADE_ERROR, + IntToString16(kUpdateInstallFailedToStart)); + [self stopProgressMessage:message imageID:IDR_UPDATE_FAIL]; } } @@ -123,12 +386,8 @@ NSString* const kUserClosedAboutNotification = return updateNowButton_; } -- (NSTextField*)upToDateTextField { - return upToDate_; -} - -- (NSTextField*)updateCompletedTextField { - return updateCompleted_; +- (NSTextField*)updateText { + return updateText_; } @end diff --git a/chrome/browser/cocoa/about_window_controller_unittest.mm b/chrome/browser/cocoa/about_window_controller_unittest.mm index 1f1ad54..462824d 100644 --- a/chrome/browser/cocoa/about_window_controller_unittest.mm +++ b/chrome/browser/cocoa/about_window_controller_unittest.mm @@ -46,17 +46,16 @@ TEST_F(AboutWindowControllerTest, TestButton) { // Doesn't confirm correctness, but does confirm something happens. TEST_F(AboutWindowControllerTest, TestCallbacks) { - NSString *upToDate = [[about_window_controller_ upToDateTextField] + NSString *lastText = [[about_window_controller_ updateText] stringValue]; [about_window_controller_ upToDateCheckCompleted:NO latestVersion:@"foo"]; - ASSERT_FALSE([upToDate isEqual:[[about_window_controller_ upToDateTextField] + ASSERT_FALSE([lastText isEqual:[[about_window_controller_ updateText] stringValue]]); - NSString *completed = [[about_window_controller_ updateCompletedTextField] - stringValue]; + lastText = [[about_window_controller_ updateText] stringValue]; [about_window_controller_ updateCompleted:NO installs:0]; - ASSERT_FALSE([completed isEqual:[[about_window_controller_ - updateCompletedTextField] stringValue]]); + ASSERT_FALSE([lastText isEqual:[[about_window_controller_ + updateText] stringValue]]); } } // namespace diff --git a/chrome/browser/cocoa/background_tile_view.h b/chrome/browser/cocoa/background_tile_view.h new file mode 100644 index 0000000..3f4454e --- /dev/null +++ b/chrome/browser/cocoa/background_tile_view.h @@ -0,0 +1,22 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_COCOA_BACKGROUND_TILE_VIEW_H_ +#define CHROME_BROWSER_COCOA_BACKGROUND_TILE_VIEW_H_ + +#import <Cocoa/Cocoa.h> + +// A custom view that draws a image tiled as the background. This isn't meant +// to be used where themes might be need, and is for other windows (about box). + +@interface BackgroundTileView : NSView { + @private + BOOL showsDivider_; + NSImage* tileImage_; +} + +@property(retain) NSImage* tileImage; +@end + +#endif // CHROME_BROWSER_COCOA_BACKGROUND_TILE_VIEW_H_ diff --git a/chrome/browser/cocoa/background_tile_view.mm b/chrome/browser/cocoa/background_tile_view.mm new file mode 100644 index 0000000..cab5046 --- /dev/null +++ b/chrome/browser/cocoa/background_tile_view.mm @@ -0,0 +1,32 @@ +// 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/cocoa/background_tile_view.h" + +@implementation BackgroundTileView +@synthesize tileImage = tileImage_; + +- (void)setTileImage:(NSImage*)tileImage { + [tileImage_ autorelease]; + tileImage_ = [tileImage retain]; + [self setNeedsDisplay:YES]; +} + +- (void)drawRect:(NSRect)rect { + // Tile within the view, so set the phase to start at the view bottom. + NSPoint phase = NSMakePoint(0.0, NSMinY([self frame])); + [[NSGraphicsContext currentContext] setPatternPhase:phase]; + + if (tileImage_) { + NSColor *color = [NSColor colorWithPatternImage:tileImage_]; + [color set]; + } else { + // Something to catch the missing image + [[NSColor magentaColor] set]; + } + + NSRectFill([self bounds]); +} + +@end diff --git a/chrome/browser/cocoa/background_tile_view_unittest.mm b/chrome/browser/cocoa/background_tile_view_unittest.mm new file mode 100644 index 0000000..d225fca --- /dev/null +++ b/chrome/browser/cocoa/background_tile_view_unittest.mm @@ -0,0 +1,44 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import <Cocoa/Cocoa.h> + +#include "base/scoped_nsobject.h" +#import "chrome/browser/cocoa/background_tile_view.h" +#import "chrome/browser/cocoa/cocoa_test_helper.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace { + +class BackgroundTileViewTest : public testing::Test { + public: + BackgroundTileViewTest() { + NSRect frame = NSMakeRect(0, 0, 100, 30); + view_.reset([[BackgroundTileView alloc] initWithFrame:frame]); + [cocoa_helper_.contentView() addSubview:view_.get()]; + } + + CocoaTestHelper cocoa_helper_; // Inits Cocoa, creates window, etc... + scoped_nsobject<BackgroundTileView> view_; +}; + +// Test adding/removing from the view hierarchy, mostly to ensure nothing +// leaks or crashes. +TEST_F(BackgroundTileViewTest, AddRemove) { + EXPECT_EQ(cocoa_helper_.contentView(), [view_ superview]); + [view_.get() removeFromSuperview]; + EXPECT_FALSE([view_ superview]); +} + +// Test drawing, mostly to ensure nothing leaks or crashes. +TEST_F(BackgroundTileViewTest, Display) { + // Without image set. + [view_ display]; + // And now with an image. + NSImage* image = [NSImage imageNamed:@"NSApplicationIcon"]; + [view_ setTileImage:image]; + [view_ display]; +} + +} // namespace diff --git a/chrome/browser/cocoa/restart_browser.h b/chrome/browser/cocoa/restart_browser.h new file mode 100644 index 0000000..1d6ab41 --- /dev/null +++ b/chrome/browser/cocoa/restart_browser.h @@ -0,0 +1,21 @@ +// 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_RESTART_BROWSER_H_ +#define CHROME_BROWSER_COCOA_RESTART_BROWSER_H_ + +#import <Cocoa/Cocoa.h> + +// This is a functional match for chrome/browser/views/restart_message_box +// so any code that needs to ask for a browser restart has something like what +// the Windows code has. +namespace restart_browser { + +// Puts up an alert telling the user to restart their browser. The alert +// will be hung off |parent| or global otherise. +void RequestRestart(NSWindow* parent); + +} // namespace restart_browser + +#endif // CHROME_BROWSER_COCOA_RESTART_BROWSER_H_ diff --git a/chrome/browser/cocoa/restart_browser.mm b/chrome/browser/cocoa/restart_browser.mm new file mode 100644 index 0000000..9a17f04 --- /dev/null +++ b/chrome/browser/cocoa/restart_browser.mm @@ -0,0 +1,67 @@ +// 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_mac.h" +#import "chrome/browser/cocoa/restart_browser.h" +#include "grit/chromium_strings.h" +#include "grit/generated_resources.h" +#include "grit/app_strings.h" + +// Helper to clean up after the notification that the alert was dismissed. +@interface RestartHelper : NSObject { + @private + NSAlert* alert_; +} +- (NSAlert*)alert; +- (void)alertDidEnd:(NSAlert*)alert + returnCode:(int)returnCode + contextInfo:(void*)contextInfo; +@end + +@implementation RestartHelper + +- (NSAlert*)alert { + alert_ = [[NSAlert alloc] init]; + return alert_; +} + +- (void)dealloc { + [alert_ release]; + [super dealloc]; +} + +- (void)alertDidEnd:(NSAlert*)alert + returnCode:(int)returnCode + contextInfo:(void*)contextInfo { + // Nothing to do, just clean up + [self autorelease]; +} + +@end + +namespace restart_browser { + +void RequestRestart(NSWindow* parent) { + NSString* title = + l10n_util::GetNSStringFWithFixup(IDS_PLEASE_RESTART_BROWSER, + l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); + NSString* text = + l10n_util::GetNSStringWithFixup(IDS_OPTIONS_RESTART_REQUIRED); + NSString* okBtn = l10n_util::GetNSStringWithFixup(IDS_APP_OK); + + RestartHelper* helper = [[RestartHelper alloc] init]; + + NSAlert* alert = [helper alert]; + [alert setAlertStyle:NSCriticalAlertStyle]; + [alert setMessageText:title]; + [alert setInformativeText:text]; + [alert addButtonWithTitle:okBtn]; + + [alert beginSheetModalForWindow:parent + modalDelegate:helper + didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) + contextInfo:nil]; +} + +} // namespace restart_browser diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 0977155..d892be6 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -838,6 +838,8 @@ 'browser/cocoa/back_forward_menu_controller.mm', 'browser/cocoa/background_gradient_view.h', 'browser/cocoa/background_gradient_view.mm', + 'browser/cocoa/background_tile_view.h', + 'browser/cocoa/background_tile_view.mm', 'browser/cocoa/base_view.h', 'browser/cocoa/base_view.mm', 'browser/cocoa/browser_window_factory.mm', @@ -950,6 +952,8 @@ 'browser/cocoa/preferences_window_controller.mm', 'browser/cocoa/rwhvm_editcommand_helper.h', 'browser/cocoa/rwhvm_editcommand_helper.mm', + 'browser/cocoa/restart_browser.h', + 'browser/cocoa/restart_browser.mm', 'browser/cocoa/sad_tab_view.h', 'browser/cocoa/sad_tab_view.mm', 'browser/cocoa/search_engine_list_model.h', @@ -2227,7 +2231,8 @@ 'xib_localizer_tool_path': '<(DEPTH)/build/mac/generate_localizer', 'xib_files_to_scan': [ - # The xib that need localization + # The xibs that need localization + 'app/nibs/About.xib', 'app/nibs/BookmarkBar.xib', 'app/nibs/BookmarkBubble.xib', 'app/nibs/BookmarkEditor.xib', @@ -3922,6 +3927,7 @@ 'browser/cocoa/autocomplete_text_field_unittest.mm', 'browser/cocoa/base_view_unittest.mm', 'browser/cocoa/background_gradient_view_unittest.mm', + 'browser/cocoa/background_tile_view_unittest.mm', 'browser/cocoa/blocked_popup_container_controller_unittest.mm', 'browser/cocoa/bookmark_bar_bridge_unittest.mm', 'browser/cocoa/bookmark_bar_controller_unittest.mm', |