Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(739)

Side by Side Diff: chrome/browser/cocoa/hung_renderer_controller.mm

Issue 151009: Removes the ability to close or resize the hung renderer dialog on Mac.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/mac_util.h" 8 #include "base/mac_util.h"
9 #include "base/process_util.h" 9 #include "base/process_util.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // This is easier than creating a localizer, since we only have one 44 // This is easier than creating a localizer, since we only have one
45 // string to modify. 45 // string to modify.
46 std::wstring productString = l10n_util::GetString(IDS_PRODUCT_NAME); 46 std::wstring productString = l10n_util::GetString(IDS_PRODUCT_NAME);
47 [[self window] setTitle:base::SysWideToNSString(productString)]; 47 [[self window] setTitle:base::SysWideToNSString(productString)];
48 } 48 }
49 49
50 - (IBAction)kill:(id)sender { 50 - (IBAction)kill:(id)sender {
51 if (hungContents_) 51 if (hungContents_)
52 base::KillProcess(hungContents_->process()->process().handle(), 52 base::KillProcess(hungContents_->process()->process().handle(),
53 ResultCodes::HUNG, false); 53 ResultCodes::HUNG, false);
54 [[self window] performClose:nil]; 54 // Cannot call performClose:, because the close button is disabled.
55 [self close];
55 } 56 }
56 57
57 - (IBAction)wait:(id)sender { 58 - (IBAction)wait:(id)sender {
58 if (hungContents_ && hungContents_->render_view_host()) 59 if (hungContents_ && hungContents_->render_view_host())
59 hungContents_->render_view_host()->RestartHangMonitorTimeout(); 60 hungContents_->render_view_host()->RestartHangMonitorTimeout();
60 [[self window] performClose:nil]; 61 // Cannot call performClose:, because the close button is disabled.
62 [self close];
61 } 63 }
62 64
63 - (int)numberOfRowsInTableView:(NSTableView *)aTableView { 65 - (int)numberOfRowsInTableView:(NSTableView *)aTableView {
64 return hungRenderers_.size(); 66 return hungRenderers_.size();
65 } 67 }
66 68
67 - (id)tableView:(NSTableView*)aTableView 69 - (id)tableView:(NSTableView*)aTableView
68 objectValueForTableColumn:(NSTableColumn*)column 70 objectValueForTableColumn:(NSTableColumn*)column
69 row:(int)rowIndex { 71 row:(int)rowIndex {
70 // TODO(rohitrao): Add favicons. 72 // TODO(rohitrao): Add favicons.
(...skipping 25 matching lines...) Expand all
96 [tableView_ reloadData]; 98 [tableView_ reloadData];
97 99
98 [[self window] center]; 100 [[self window] center];
99 [self showWindow:self]; 101 [self showWindow:self];
100 } 102 }
101 103
102 - (void)endForTabContents:(TabContents*)contents { 104 - (void)endForTabContents:(TabContents*)contents {
103 DCHECK(contents); 105 DCHECK(contents);
104 DCHECK(hungContents_); 106 DCHECK(hungContents_);
105 if (hungContents_ && hungContents_->process() == contents->process()) { 107 if (hungContents_ && hungContents_->process() == contents->process()) {
106 // If you switch tabs with the dialog open, 108 // Cannot call performClose:, because the close button is disabled.
107 // HungRendererDialog::EndForTabContents() is called after the
108 // RWHV is hidden. performClose: runs a nested message loop,
109 // during which the RWHV is drawn at least once, failing a DCHECK
110 // that ensures it is never drawn while hidden. The workaround
111 // here is to call close, which closes the window immediately with
112 // no nested message loop.
113 [self close]; 109 [self close];
114 } 110 }
115 } 111 }
116 112
117 @end 113 @end
118 114
119 @implementation HungRendererController (JustForTesting) 115 @implementation HungRendererController (JustForTesting)
120 - (NSButton*)killButton { 116 - (NSButton*)killButton {
121 return killButton_; 117 return killButton_;
122 } 118 }
(...skipping 11 matching lines...) Expand all
134 initWithWindowNibName:@"HungRendererDialog"]; 130 initWithWindowNibName:@"HungRendererDialog"];
135 [g_instance showForTabContents:contents]; 131 [g_instance showForTabContents:contents];
136 } 132 }
137 } 133 }
138 134
139 // static 135 // static
140 void HungRendererDialog::HideForTabContents(TabContents* contents) { 136 void HungRendererDialog::HideForTabContents(TabContents* contents) {
141 if (!logging::DialogsAreSuppressed() && g_instance) 137 if (!logging::DialogsAreSuppressed() && g_instance)
142 [g_instance endForTabContents:contents]; 138 [g_instance endForTabContents:contents];
143 } 139 }
OLDNEW
« no previous file with comments | « chrome/app/nibs/en.lproj/HungRendererDialog.xib ('k') | chrome/browser/cocoa/hung_renderer_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698