| OLD | NEW |
| 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" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 // implementation only monitors the initiating tab. | 168 // implementation only monitors the initiating tab. |
| 169 - (void)showForWebContents:(WebContents*)contents { | 169 - (void)showForWebContents:(WebContents*)contents { |
| 170 DCHECK(contents); | 170 DCHECK(contents); |
| 171 hungContents_ = contents; | 171 hungContents_ = contents; |
| 172 hungContentsObserver_.reset(new WebContentsObserverBridge(contents, self)); | 172 hungContentsObserver_.reset(new WebContentsObserverBridge(contents, self)); |
| 173 scoped_nsobject<NSMutableArray> titles([[NSMutableArray alloc] init]); | 173 scoped_nsobject<NSMutableArray> titles([[NSMutableArray alloc] init]); |
| 174 scoped_nsobject<NSMutableArray> favicons([[NSMutableArray alloc] init]); | 174 scoped_nsobject<NSMutableArray> favicons([[NSMutableArray alloc] init]); |
| 175 for (TabContentsIterator it; !it.done(); ++it) { | 175 for (TabContentsIterator it; !it.done(); ++it) { |
| 176 if (it->web_contents()->GetRenderProcessHost() == | 176 if (it->web_contents()->GetRenderProcessHost() == |
| 177 hungContents_->GetRenderProcessHost()) { | 177 hungContents_->GetRenderProcessHost()) { |
| 178 string16 title = (*it)->web_contents()->GetTitle(); | 178 string16 title = it->web_contents()->GetTitle(); |
| 179 if (title.empty()) | 179 if (title.empty()) |
| 180 title = CoreTabHelper::GetDefaultTitle(); | 180 title = CoreTabHelper::GetDefaultTitle(); |
| 181 [titles addObject:base::SysUTF16ToNSString(title)]; | 181 [titles addObject:base::SysUTF16ToNSString(title)]; |
| 182 [favicons addObject:mac::FaviconForTabContents(*it)]; | 182 [favicons addObject:mac::FaviconForWebContents(it->web_contents())]; |
| 183 } | 183 } |
| 184 } | 184 } |
| 185 hungTitles_.reset([titles copy]); | 185 hungTitles_.reset([titles copy]); |
| 186 hungFavicons_.reset([favicons copy]); | 186 hungFavicons_.reset([favicons copy]); |
| 187 [tableView_ reloadData]; | 187 [tableView_ reloadData]; |
| 188 | 188 |
| 189 [[self window] center]; | 189 [[self window] center]; |
| 190 [self showWindow:self]; | 190 [self showWindow:self]; |
| 191 } | 191 } |
| 192 | 192 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 chrome | 236 } // namespace chrome |
| OLD | NEW |