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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 169 |
170 // TODO(shess): This could observe all of the tabs referenced in the | 170 // TODO(shess): This could observe all of the tabs referenced in the |
171 // loop, updating the dialog and keeping it up so long as any remain. | 171 // loop, updating the dialog and keeping it up so long as any remain. |
172 // Tabs closed by their renderer will close the dialog (that's | 172 // Tabs closed by their renderer will close the dialog (that's |
173 // activity!), so it would not add much value. Also, the views | 173 // activity!), so it would not add much value. Also, the views |
174 // implementation only monitors the initiating tab. | 174 // implementation only monitors the initiating tab. |
175 - (void)showForWebContents:(WebContents*)contents { | 175 - (void)showForWebContents:(WebContents*)contents { |
176 DCHECK(contents); | 176 DCHECK(contents); |
177 hungContents_ = contents; | 177 hungContents_ = contents; |
178 hungContentsObserver_.reset(new WebContentsObserverBridge(contents, self)); | 178 hungContentsObserver_.reset(new WebContentsObserverBridge(contents, self)); |
179 scoped_nsobject<NSMutableArray> titles([[NSMutableArray alloc] init]); | 179 base::scoped_nsobject<NSMutableArray> titles([[NSMutableArray alloc] init]); |
180 scoped_nsobject<NSMutableArray> favicons([[NSMutableArray alloc] init]); | 180 base::scoped_nsobject<NSMutableArray> favicons([[NSMutableArray alloc] init]); |
181 for (TabContentsIterator it; !it.done(); it.Next()) { | 181 for (TabContentsIterator it; !it.done(); it.Next()) { |
182 if (it->GetRenderProcessHost() == hungContents_->GetRenderProcessHost()) { | 182 if (it->GetRenderProcessHost() == hungContents_->GetRenderProcessHost()) { |
183 string16 title = it->GetTitle(); | 183 string16 title = it->GetTitle(); |
184 if (title.empty()) | 184 if (title.empty()) |
185 title = CoreTabHelper::GetDefaultTitle(); | 185 title = CoreTabHelper::GetDefaultTitle(); |
186 [titles addObject:base::SysUTF16ToNSString(title)]; | 186 [titles addObject:base::SysUTF16ToNSString(title)]; |
187 [favicons addObject:mac::FaviconForWebContents(*it)]; | 187 [favicons addObject:mac::FaviconForWebContents(*it)]; |
188 } | 188 } |
189 } | 189 } |
190 hungTitles_.reset([titles copy]); | 190 hungTitles_.reset([titles copy]); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 [g_instance showForWebContents:contents]; | 232 [g_instance showForWebContents:contents]; |
233 } | 233 } |
234 } | 234 } |
235 | 235 |
236 void HideHungRendererDialog(WebContents* contents) { | 236 void HideHungRendererDialog(WebContents* contents) { |
237 if (!logging::DialogsAreSuppressed() && g_instance) | 237 if (!logging::DialogsAreSuppressed() && g_instance) |
238 [g_instance endForWebContents:contents]; | 238 [g_instance endForWebContents:contents]; |
239 } | 239 } |
240 | 240 |
241 } // namespace chrome | 241 } // namespace chrome |
OLD | NEW |