Chromium Code Reviews| Index: chrome/browser/ui/webui/hung_renderer_dialog.cc |
| diff --git a/chrome/browser/ui/webui/hung_renderer_dialog.cc b/chrome/browser/ui/webui/hung_renderer_dialog.cc |
| index cf5050e0998c0030e59455faad35b81f145386eb..6bdb51190747778114fc94d3c6ae2fc4c2e72d03 100644 |
| --- a/chrome/browser/ui/webui/hung_renderer_dialog.cc |
| +++ b/chrome/browser/ui/webui/hung_renderer_dialog.cc |
| @@ -19,6 +19,7 @@ |
| #include "content/common/result_codes.h" |
| #include "grit/generated_resources.h" |
| #include "ui/base/l10n/l10n_util.h" |
| +#include "views/widget/widget.h" |
| namespace { |
| HungRendererDialog* g_instance = NULL; |
| @@ -41,10 +42,8 @@ void ShowHungRendererDialog(TabContents* contents) { |
| } |
| void HideHungRendererDialog(TabContents* contents) { |
| - if (!logging::DialogsAreSuppressed() && g_instance) { |
| - // TODO(wyck): Hide the webui hung renderer dialog. |
| - NOTIMPLEMENTED() << " TODO: Hide the webui hung renderer dialog."; |
| - } |
| + if (!logging::DialogsAreSuppressed() && g_instance) |
| + g_instance->HideDialog(contents); |
| } |
| } // namespace browser |
| @@ -53,7 +52,8 @@ void HideHungRendererDialog(TabContents* contents) { |
| // HungRendererDialog methods |
| HungRendererDialog::HungRendererDialog() |
| - : contents_(NULL) { |
| + : contents_(NULL), |
| + window_(NULL) { |
| } |
| void HungRendererDialog::ShowDialog(gfx::NativeWindow owning_window, |
| @@ -62,7 +62,13 @@ void HungRendererDialog::ShowDialog(gfx::NativeWindow owning_window, |
| contents_ = contents; |
| Browser* browser = BrowserList::GetLastActive(); |
| DCHECK(browser); |
| - browser->BrowserShowHtmlDialog(this, owning_window); |
| + window_ = browser->BrowserShowHtmlDialog(this, owning_window); |
| +} |
| + |
| +void HungRendererDialog::HideDialog(TabContents* contents) { |
| + views::Widget* widget = views::Widget::GetWidgetForNativeWindow(window_); |
| + DCHECK(widget); |
| + widget->Close(); |
| } |
| bool HungRendererDialog::IsDialogModal() const { |
| @@ -97,7 +103,7 @@ void HungRendererDialog::OnDialogClosed(const std::string& json_retval) { |
| ListValue* list; |
| if (!root.get() || !root->GetAsList(&list) || !list || |
| !list->GetBoolean(0, &response)) { |
| - NOTREACHED() << "json does not describe a valid result"; |
| + DLOG(INFO) << "json does not describe a valid result"; |
|
wyck
2011/09/02 15:57:48
This is now reached when the dialog is closed with
flackr
2011/09/02 16:39:55
Since this is an expected case you should remove t
wyck
2011/09/02 19:18:43
Done.
|
| } |
| if (response) { |
| @@ -160,4 +166,3 @@ void HungRendererDialogHandler::RequestTabContentsList( |
| web_ui_->CallJavascriptFunction("hungRendererDialog.setTabContentsList", |
| tab_contents_list); |
| } |
|
flackr
2011/09/02 16:39:55
Was lint okay with not having a newline here even
wyck
2011/09/02 19:18:43
Ya, lint didn't mind me removing the newline here.
|
| - |