summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-13 18:30:03 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-13 18:30:03 +0000
commit0c912bd69b82fe09debef06a58c5234037a61cb7 (patch)
tree7be596b93d2bd0b5e1fcad8b7591a8475187f731 /chrome/browser
parentfb861bab6ca6b80c7d06f7a8fa33584c7c1cb56b (diff)
downloadchromium_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
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/cocoa/hung_renderer_controller.h4
-rw-r--r--chrome/browser/cocoa/hung_renderer_controller.mm24
-rw-r--r--chrome/browser/cocoa/task_manager_mac.mm2
3 files changed, 27 insertions, 3 deletions
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);