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 #include "chrome/browser/ui/webui/hung_renderer_dialog.h" | 5 #include "chrome/browser/ui/webui/hung_renderer_dialog.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 214 |
215 //////////////////////////////////////////////////////////////////////////////// | 215 //////////////////////////////////////////////////////////////////////////////// |
216 // HungRendererDialogHandler methods | 216 // HungRendererDialogHandler methods |
217 | 217 |
218 HungRendererDialogHandler::HungRendererDialogHandler( | 218 HungRendererDialogHandler::HungRendererDialogHandler( |
219 WebContents* contents) | 219 WebContents* contents) |
220 : contents_(contents) { | 220 : contents_(contents) { |
221 } | 221 } |
222 | 222 |
223 void HungRendererDialogHandler::CloseDialog() { | 223 void HungRendererDialogHandler::CloseDialog() { |
224 static_cast<HtmlDialogUI*>(web_ui())->CloseDialog(NULL); | 224 static_cast<HtmlDialogUI*>(web_ui()->GetController())->CloseDialog(NULL); |
225 } | 225 } |
226 | 226 |
227 void HungRendererDialogHandler::RegisterMessages() { | 227 void HungRendererDialogHandler::RegisterMessages() { |
228 web_ui()->RegisterMessageCallback("requestTabContentsList", | 228 web_ui()->RegisterMessageCallback("requestTabContentsList", |
229 base::Bind(&HungRendererDialogHandler::RequestTabContentsList, | 229 base::Bind(&HungRendererDialogHandler::RequestTabContentsList, |
230 base::Unretained(this))); | 230 base::Unretained(this))); |
231 } | 231 } |
232 | 232 |
233 void HungRendererDialogHandler::RequestTabContentsList( | 233 void HungRendererDialogHandler::RequestTabContentsList( |
234 const base::ListValue* args) { | 234 const base::ListValue* args) { |
235 ListValue tab_contents_list; | 235 ListValue tab_contents_list; |
236 for (TabContentsIterator it; !it.done(); ++it) { | 236 for (TabContentsIterator it; !it.done(); ++it) { |
237 if (it->web_contents()->GetRenderProcessHost() == | 237 if (it->web_contents()->GetRenderProcessHost() == |
238 contents_->GetRenderProcessHost()) { | 238 contents_->GetRenderProcessHost()) { |
239 string16 title = it->web_contents()->GetTitle(); | 239 string16 title = it->web_contents()->GetTitle(); |
240 if (title.empty()) | 240 if (title.empty()) |
241 title = CoreTabHelper::GetDefaultTitle(); | 241 title = CoreTabHelper::GetDefaultTitle(); |
242 // Add details for |url| and |title|. | 242 // Add details for |url| and |title|. |
243 DictionaryValue* dict = new DictionaryValue(); | 243 DictionaryValue* dict = new DictionaryValue(); |
244 dict->SetString("url", it->web_contents()->GetURL().spec()); | 244 dict->SetString("url", it->web_contents()->GetURL().spec()); |
245 dict->SetString("title", title); | 245 dict->SetString("title", title); |
246 tab_contents_list.Append(dict); | 246 tab_contents_list.Append(dict); |
247 } | 247 } |
248 } | 248 } |
249 // Send list of tab contents details to javascript. | 249 // Send list of tab contents details to javascript. |
250 web_ui()->CallJavascriptFunction("hungRendererDialog.setTabContentsList", | 250 web_ui()->CallJavascriptFunction("hungRendererDialog.setTabContentsList", |
251 tab_contents_list); | 251 tab_contents_list); |
252 } | 252 } |
OLD | NEW |