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

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

Issue 10703061: chrome/browser/ui: Put browser_dialogs.h into chrome namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/ui/cocoa/hung_renderer_controller.h" 5 #import "chrome/browser/ui/cocoa/hung_renderer_controller.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/mac/bundle_locations.h" 9 #include "base/mac/bundle_locations.h"
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
11 #include "base/process_util.h" 11 #include "base/process_util.h"
12 #include "base/sys_string_conversions.h" 12 #include "base/sys_string_conversions.h"
13 #include "chrome/browser/favicon/favicon_tab_helper.h" 13 #include "chrome/browser/favicon/favicon_tab_helper.h"
14 #include "chrome/browser/ui/browser_dialogs.h" 14 #include "chrome/browser/ui/browser_dialogs.h"
15 #import "chrome/browser/ui/cocoa/multi_key_equivalent_button.h" 15 #import "chrome/browser/ui/cocoa/multi_key_equivalent_button.h"
16 #import "chrome/browser/ui/cocoa/tab_contents/favicon_util.h" 16 #import "chrome/browser/ui/cocoa/tab_contents/favicon_util.h"
17 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" 17 #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
18 #include "chrome/browser/ui/tab_contents/tab_contents.h"
18 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" 19 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h"
19 #include "chrome/browser/ui/tab_contents/tab_contents.h"
20 #include "chrome/common/logging_chrome.h" 20 #include "chrome/common/logging_chrome.h"
21 #include "content/public/browser/render_process_host.h" 21 #include "content/public/browser/render_process_host.h"
22 #include "content/public/browser/render_view_host.h" 22 #include "content/public/browser/render_view_host.h"
23 #include "content/public/browser/web_contents.h" 23 #include "content/public/browser/web_contents.h"
24 #include "content/public/common/result_codes.h" 24 #include "content/public/common/result_codes.h"
25 #include "grit/chromium_strings.h" 25 #include "grit/chromium_strings.h"
26 #include "grit/generated_resources.h" 26 #include "grit/generated_resources.h"
27 #include "grit/theme_resources_standard.h" 27 #include "grit/theme_resources_standard.h"
28 #include "grit/ui_resources.h" 28 #include "grit/ui_resources.h"
29 #include "skia/ext/skia_utils_mac.h" 29 #include "skia/ext/skia_utils_mac.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 [buttonCell setImage:[hungFavicons_ objectAtIndex:rowIndex]]; 147 [buttonCell setImage:[hungFavicons_ objectAtIndex:rowIndex]];
148 [buttonCell setRefusesFirstResponder:YES]; // Don't push in like a button. 148 [buttonCell setRefusesFirstResponder:YES]; // Don't push in like a button.
149 [buttonCell setHighlightsBy:NSNoCellMask]; 149 [buttonCell setHighlightsBy:NSNoCellMask];
150 } 150 }
151 return cell; 151 return cell;
152 } 152 }
153 153
154 - (void)windowWillClose:(NSNotification*)notification { 154 - (void)windowWillClose:(NSNotification*)notification {
155 // We have to reset g_instance before autoreleasing the window, 155 // We have to reset g_instance before autoreleasing the window,
156 // because we want to avoid reusing the same dialog if someone calls 156 // because we want to avoid reusing the same dialog if someone calls
157 // browser::ShowHungRendererDialog() between the autorelease 157 // chrome::ShowHungRendererDialog() between the autorelease call and the
158 // call and the actual dealloc. 158 // actual dealloc.
159 g_instance = nil; 159 g_instance = nil;
160 160
161 [self autorelease]; 161 [self autorelease];
162 } 162 }
163 163
164 // TODO(shess): This could observe all of the tabs referenced in the 164 // TODO(shess): This could observe all of the tabs referenced in the
165 // loop, updating the dialog and keeping it up so long as any remain. 165 // loop, updating the dialog and keeping it up so long as any remain.
166 // Tabs closed by their renderer will close the dialog (that's 166 // Tabs closed by their renderer will close the dialog (that's
167 // activity!), so it would not add much value. Also, the views 167 // activity!), so it would not add much value. Also, the views
168 // implementation only monitors the initiating tab. 168 // implementation only monitors the initiating tab.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 @implementation HungRendererController (JustForTesting) 210 @implementation HungRendererController (JustForTesting)
211 - (NSButton*)killButton { 211 - (NSButton*)killButton {
212 return killButton_; 212 return killButton_;
213 } 213 }
214 214
215 - (MultiKeyEquivalentButton*)waitButton { 215 - (MultiKeyEquivalentButton*)waitButton {
216 return waitButton_; 216 return waitButton_;
217 } 217 }
218 @end 218 @end
219 219
220 namespace browser { 220 namespace chrome {
221 221
222 void ShowHungRendererDialog(WebContents* contents) { 222 void ShowHungRendererDialog(WebContents* contents) {
223 if (!logging::DialogsAreSuppressed()) { 223 if (!logging::DialogsAreSuppressed()) {
224 if (!g_instance) 224 if (!g_instance)
225 g_instance = [[HungRendererController alloc] 225 g_instance = [[HungRendererController alloc]
226 initWithWindowNibName:@"HungRendererDialog"]; 226 initWithWindowNibName:@"HungRendererDialog"];
227 [g_instance showForWebContents:contents]; 227 [g_instance showForWebContents:contents];
228 } 228 }
229 } 229 }
230 230
231 void HideHungRendererDialog(WebContents* contents) { 231 void HideHungRendererDialog(WebContents* contents) {
232 if (!logging::DialogsAreSuppressed() && g_instance) 232 if (!logging::DialogsAreSuppressed() && g_instance)
233 [g_instance endForWebContents:contents]; 233 [g_instance endForWebContents:contents];
234 } 234 }
235 235
236 } // namespace browser 236 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698