diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-13 18:30:03 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-13 18:30:03 +0000 |
commit | 0c912bd69b82fe09debef06a58c5234037a61cb7 (patch) | |
tree | 7be596b93d2bd0b5e1fcad8b7591a8475187f731 | |
parent | fb861bab6ca6b80c7d06f7a8fa33584c7c1cb56b (diff) | |
download | chromium_src-0c912bd69b82fe09debef06a58c5234037a61cb7.zip chromium_src-0c912bd69b82fe09debef06a58c5234037a61cb7.tar.gz chromium_src-0c912bd69b82fe09debef06a58c5234037a61cb7.tar.bz2 |
Mac: Add favicons to hung renderer dialog.
Nib change: Changed data cell from NSFieldTextCell to NSButtonCell with checkbox style.
BUG=none
TEST=Go to wikipedia, cmd-click a couple links, enter "about:hang" in omnibox. After a while, the hung renderer dialog should show up and have a favicon for all the tabs you opened by cmd-clicking.
Review URL: http://codereview.chromium.org/545040
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36137 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/nibs/HungRendererDialog.xib | 61 | ||||
-rw-r--r-- | chrome/browser/cocoa/hung_renderer_controller.h | 4 | ||||
-rw-r--r-- | chrome/browser/cocoa/hung_renderer_controller.mm | 24 | ||||
-rw-r--r-- | chrome/browser/cocoa/task_manager_mac.mm | 2 |
4 files changed, 58 insertions, 33 deletions
diff --git a/chrome/app/nibs/HungRendererDialog.xib b/chrome/app/nibs/HungRendererDialog.xib index ccfbc6d..a655a05 100644 --- a/chrome/app/nibs/HungRendererDialog.xib +++ b/chrome/app/nibs/HungRendererDialog.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">9L30</string> + <string key="IBDocument.SystemVersion">9L31a</string> <string key="IBDocument.InterfaceBuilderVersion">677</string> <string key="IBDocument.AppKitVersion">949.54</string> <string key="IBDocument.HIToolboxVersion">353.00</string> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="36"/> + <integer value="2"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -99,27 +99,25 @@ </object> </object> </object> - <object class="NSTextFieldCell" key="NSDataCell" id="354720928"> - <int key="NSCellFlags">67239488</int> - <int key="NSCellFlags2">272761856</int> - <string key="NSContents">Text</string> + <object class="NSButtonCell" key="NSDataCell" id="132285907"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">131072</int> + <string key="NSContents">Check</string> <reference key="NSSupport" ref="26"/> <reference key="NSControlView" ref="216923421"/> - <object class="NSColor" key="NSBackgroundColor"> - <int key="NSColorSpace">6</int> - <string key="NSCatalogName">System</string> - <string key="NSColorName">controlColor</string> - <object class="NSColor" key="NSColor" id="97073632"> - <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MC42NjY2NjY2OQA</bytes> - </object> + <int key="NSButtonFlags">1211912703</int> + <int key="NSButtonFlags2">130</int> + <object class="NSCustomResource" key="NSNormalImage"> + <string key="NSClassName">NSImage</string> + <string key="NSResourceName">NSSwitch</string> </object> - <object class="NSColor" key="NSTextColor"> - <int key="NSColorSpace">6</int> - <string key="NSCatalogName">System</string> - <string key="NSColorName">controlTextColor</string> - <reference key="NSColor" ref="332806078"/> + <object class="NSButtonImageSource" key="NSAlternateImage"> + <string key="NSImageName">NSSwitch</string> </object> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> </object> <int key="NSResizingMask">3</int> <bool key="NSIsResizeable">YES</bool> @@ -158,7 +156,10 @@ <int key="NSColorSpace">6</int> <string key="NSCatalogName">System</string> <string key="NSColorName">controlBackgroundColor</string> - <reference key="NSColor" ref="97073632"/> + <object class="NSColor" key="NSColor"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MC42NjY2NjY2OQA</bytes> + </object> </object> <int key="NScvFlags">4</int> </object> @@ -506,16 +507,11 @@ <reference key="object" ref="171324652"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="354720928"/> + <reference ref="132285907"/> </object> <reference key="parent" ref="216923421"/> </object> <object class="IBObjectRecord"> - <int key="objectID">23</int> - <reference key="object" ref="354720928"/> - <reference key="parent" ref="171324652"/> - </object> - <object class="IBObjectRecord"> <int key="objectID">31</int> <reference key="object" ref="777888236"/> <object class="NSMutableArray" key="children"> @@ -591,6 +587,11 @@ <reference key="object" ref="654098324"/> <reference key="parent" ref="469621768"/> </object> + <object class="IBObjectRecord"> + <int key="objectID">42</int> + <reference key="object" ref="132285907"/> + <reference key="parent" ref="171324652"/> + </object> </object> </object> <object class="NSMutableDictionary" key="flattenedProperties"> @@ -612,7 +613,6 @@ <string>14.IBPluginDependency</string> <string>15.IBPluginDependency</string> <string>2.IBPluginDependency</string> - <string>23.IBPluginDependency</string> <string>3.IBPluginDependency</string> <string>31.IBPluginDependency</string> <string>32.IBPluginDependency</string> @@ -621,6 +621,7 @@ <string>37.IBPluginDependency</string> <string>38.IBPluginDependency</string> <string>4.IBPluginDependency</string> + <string>42.IBPluginDependency</string> <string>5.IBPluginDependency</string> <string>6.IBPluginDependency</string> <string>8.IBPluginDependency</string> @@ -630,9 +631,9 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{441, 167}, {500, 217}}</string> + <string>{{263, 167}, {500, 217}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{441, 167}, {500, 217}}</string> + <string>{{263, 167}, {500, 217}}</string> <boolean value="NO"/> <string>{196, 240}</string> <string>{{357, 418}, {480, 270}}</string> @@ -676,7 +677,7 @@ </object> </object> <nil key="sourceID"/> - <int key="maxID">41</int> + <int key="maxID">42</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> diff --git a/chrome/browser/cocoa/hung_renderer_controller.h b/chrome/browser/cocoa/hung_renderer_controller.h index 4a4ceaf..1b012ea 100644 --- a/chrome/browser/cocoa/hung_renderer_controller.h +++ b/chrome/browser/cocoa/hung_renderer_controller.h @@ -42,6 +42,10 @@ class TabContents; // Backing data for |tableView_|. Titles of each TabContents that // shares a renderer process with |hungContents_|. scoped_nsobject<NSArray> hungTitles_; + + // Favicons of each TabContents that shares a renderer process with + // |hungContents_|. + scoped_nsobject<NSArray> hungFavicons_; } // Kills the hung renderers. diff --git a/chrome/browser/cocoa/hung_renderer_controller.mm b/chrome/browser/cocoa/hung_renderer_controller.mm index 853c96b..7bc9105 100644 --- a/chrome/browser/cocoa/hung_renderer_controller.mm +++ b/chrome/browser/cocoa/hung_renderer_controller.mm @@ -21,6 +21,7 @@ #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "skia/ext/skia_utils_mac.h" #include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" namespace { @@ -98,7 +99,23 @@ HungRendererController* g_instance = NULL; - (id)tableView:(NSTableView*)aTableView objectValueForTableColumn:(NSTableColumn*)column row:(NSInteger)rowIndex { - return [hungTitles_ objectAtIndex:rowIndex]; + return [NSNumber numberWithInt:NSOffState]; +} + +- (NSCell*)tableView:(NSTableView*)tableView + dataCellForTableColumn:(NSTableColumn*)tableColumn + row:(NSInteger)rowIndex { + NSCell* cell = [tableColumn dataCellForRow:rowIndex]; + + if ([[tableColumn identifier] isEqualToString:@"title"]) { + DCHECK([cell isKindOfClass:[NSButtonCell class]]); + NSButtonCell* buttonCell = static_cast<NSButtonCell*>(cell); + [buttonCell setTitle:[hungTitles_ objectAtIndex:rowIndex]]; + [buttonCell setImage:[hungFavicons_ objectAtIndex:rowIndex]]; + [buttonCell setRefusesFirstResponder:YES]; // Don't push in like a button. + [buttonCell setHighlightsBy:NSNoCellMask]; + } + return cell; } - (void)windowWillClose:(NSNotification*)notification { @@ -115,9 +132,9 @@ HungRendererController* g_instance = NULL; DCHECK(contents); hungContents_ = contents; scoped_nsobject<NSMutableArray> titles([[NSMutableArray alloc] init]); + scoped_nsobject<NSMutableArray> favicons([[NSMutableArray alloc] init]); for (TabContentsIterator it; !it.done(); ++it) { if (it->process() == hungContents_->process()) { - // TODO(rohitrao): Add favicons. const string16 title = (*it)->GetTitle(); if (title.empty()) { [titles addObject: @@ -125,9 +142,12 @@ HungRendererController* g_instance = NULL; } else { [titles addObject:base::SysUTF16ToNSString(title)]; } + [favicons addObject:gfx::SkBitmapToNSImage(it->GetFavIcon())]; + } } hungTitles_.reset([titles copy]); + hungFavicons_.reset([favicons copy]); [tableView_ reloadData]; [[self window] center]; diff --git a/chrome/browser/cocoa/task_manager_mac.mm b/chrome/browser/cocoa/task_manager_mac.mm index 4d0741b0..8ff5e87 100644 --- a/chrome/browser/cocoa/task_manager_mac.mm +++ b/chrome/browser/cocoa/task_manager_mac.mm @@ -287,7 +287,7 @@ row:(NSInteger)rowIndex { NSCell* cell = [tableColumn dataCellForRow:rowIndex]; - // Set the favicon and title for the search engine in the name column. + // Set the favicon and title for the task in the name column. if ([[tableColumn identifier] intValue] == IDS_TASK_MANAGER_PAGE_COLUMN) { DCHECK([cell isKindOfClass:[NSButtonCell class]]); NSButtonCell* buttonCell = static_cast<NSButtonCell*>(cell); |