| 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 de0233451310e5c191aab408e2d75da609af653e..c4770a9470ce819ab7cf7a4cbcbdddf5f8c3bb97 100644
|
| --- a/chrome/browser/ui/webui/hung_renderer_dialog.cc
|
| +++ b/chrome/browser/ui/webui/hung_renderer_dialog.cc
|
| @@ -35,12 +35,12 @@ namespace browser {
|
|
|
| void ShowHungRendererDialog(TabContents* contents) {
|
| #if defined(OS_CHROMEOS) || defined(USE_AURA)
|
| - HungRendererDialog::ShowHungRendererDialog(contents);
|
| + HungRendererDialog::ShowHungRendererDialog(contents, true);
|
| #else
|
| // TODO(rbyers): Remove IsMoreWebUI check once we decide for sure which
|
| // platforms will use the WebUI version of this dialog.
|
| if (ChromeWebUI::IsMoreWebUI())
|
| - HungRendererDialog::ShowHungRendererDialog(contents);
|
| + HungRendererDialog::ShowHungRendererDialog(contents, true);
|
| else
|
| ShowNativeHungRendererDialog(contents);
|
| #endif
|
| @@ -62,11 +62,12 @@ void HideHungRendererDialog(TabContents* contents) {
|
| ////////////////////////////////////////////////////////////////////////////////
|
| // HungRendererDialog public static methods
|
|
|
| -void HungRendererDialog::ShowHungRendererDialog(TabContents* contents) {
|
| +void HungRendererDialog::ShowHungRendererDialog(TabContents* contents,
|
| + bool isEnabled) {
|
| if (!logging::DialogsAreSuppressed()) {
|
| if (g_instance)
|
| return;
|
| - g_instance = new HungRendererDialog();
|
| + g_instance = new HungRendererDialog(isEnabled);
|
| g_instance->ShowDialog(contents);
|
| }
|
| }
|
| @@ -80,9 +81,10 @@ void HungRendererDialog::HideHungRendererDialog(TabContents* contents) {
|
| ////////////////////////////////////////////////////////////////////////////////
|
| // HungRendererDialog private methods
|
|
|
| -HungRendererDialog::HungRendererDialog()
|
| +HungRendererDialog::HungRendererDialog(bool is_enabled)
|
| : contents_(NULL),
|
| handler_(NULL),
|
| + is_enabled_(is_enabled),
|
| window_(NULL) {
|
| }
|
|
|
| @@ -135,25 +137,27 @@ std::string HungRendererDialog::GetDialogArgs() const {
|
| }
|
|
|
| void HungRendererDialog::OnDialogClosed(const std::string& json_retval) {
|
| - // Figure out what the response was.
|
| - scoped_ptr<Value> root(base::JSONReader::Read(json_retval, false));
|
| - bool response = false;
|
| - ListValue* list = NULL;
|
| - // If the dialog closes because of a button click then the json is a list
|
| - // containing a single bool. If the dialog closes some other way, then we
|
| - // assume it means no permission was given to kill tabs.
|
| - if (root.get() && root->GetAsList(&list) && list &&
|
| - list->GetBoolean(0, &response) && response) {
|
| - // The user indicated that it is OK to kill the renderer process.
|
| - if (contents_ && contents_->GetRenderProcessHost()) {
|
| - base::KillProcess(contents_->GetRenderProcessHost()->GetHandle(),
|
| - content::RESULT_CODE_HUNG, false);
|
| + if (is_enabled_) {
|
| + // Figure out what the response was.
|
| + scoped_ptr<Value> root(base::JSONReader::Read(json_retval, false));
|
| + bool response = false;
|
| + ListValue* list = NULL;
|
| + // If the dialog closes because of a button click then the json is a list
|
| + // containing a single bool. If the dialog closes some other way, then we
|
| + // assume it means no permission was given to kill tabs.
|
| + if (root.get() && root->GetAsList(&list) && list &&
|
| + list->GetBoolean(0, &response) && response) {
|
| + // The user indicated that it is OK to kill the renderer process.
|
| + if (contents_ && contents_->GetRenderProcessHost()) {
|
| + base::KillProcess(contents_->GetRenderProcessHost()->GetHandle(),
|
| + content::RESULT_CODE_HUNG, false);
|
| + }
|
| + } else {
|
| + // No indication from the user that it is ok to kill anything. Just wait.
|
| + // Start waiting again for responsiveness.
|
| + if (contents_ && contents_->render_view_host())
|
| + contents_->render_view_host()->RestartHangMonitorTimeout();
|
| }
|
| - } else {
|
| - // No indication from the user that it is ok to kill anything. Just wait.
|
| - // Start waiting again for responsiveness.
|
| - if (contents_ && contents_->render_view_host())
|
| - contents_->render_view_host()->RestartHangMonitorTimeout();
|
| }
|
| g_instance = NULL;
|
| delete this;
|
|
|