| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/browser_list.h" | 13 #include "chrome/browser/ui/browser_list.h" |
| 14 #include "chrome/browser/ui/browser_dialogs.h" |
| 14 #include "chrome/common/logging_chrome.h" | 15 #include "chrome/common/logging_chrome.h" |
| 15 #include "chrome/common/url_constants.h" | 16 #include "chrome/common/url_constants.h" |
| 16 #include "content/browser/renderer_host/render_view_host.h" | 17 #include "content/browser/renderer_host/render_view_host.h" |
| 17 #include "content/browser/tab_contents/tab_contents.h" | 18 #include "content/browser/tab_contents/tab_contents.h" |
| 18 #include "content/common/result_codes.h" | 19 #include "content/common/result_codes.h" |
| 19 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
| 20 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| 23 HungRendererDialog* g_instance = NULL; | 24 HungRendererDialog* g_instance = NULL; |
| 24 const int kHungRendererDialogWidth = 425; | 25 const int kHungRendererDialogWidth = 425; |
| 25 const int kHungRendererDialogHeight = 200; | 26 const int kHungRendererDialogHeight = 200; |
| 26 } | 27 } |
| 27 | 28 |
| 28 | 29 |
| 29 namespace browser { | 30 namespace browser { |
| 30 | 31 |
| 31 void ShowHungRendererDialog(TabContents* contents) { | 32 void ShowHungRendererDialog(TabContents* contents) { |
| 32 if (!logging::DialogsAreSuppressed()) { | 33 if (ChromeWebUI::IsMoreWebUI()) { |
| 33 if (!g_instance) { | 34 if (!logging::DialogsAreSuppressed()) { |
| 34 g_instance = new HungRendererDialog(); | 35 if (!g_instance) { |
| 35 } else { | 36 g_instance = new HungRendererDialog(); |
| 36 NOTIMPLEMENTED() << " ShowHungRendererDialog called twice."; | 37 } else { |
| 37 return; | 38 NOTIMPLEMENTED() << " ShowHungRendererDialog called twice."; |
| 39 return; |
| 40 } |
| 41 g_instance->ShowDialog(NULL, contents); |
| 38 } | 42 } |
| 39 g_instance->ShowDialog(NULL, contents); | 43 return; |
| 40 } | 44 } |
| 45 |
| 46 ShowNativeHungRendererDialog(contents); |
| 41 } | 47 } |
| 42 | 48 |
| 43 void HideHungRendererDialog(TabContents* contents) { | 49 void HideHungRendererDialog(TabContents* contents) { |
| 44 if (!logging::DialogsAreSuppressed() && g_instance) { | 50 if (ChromeWebUI::IsMoreWebUI()) { |
| 45 // TODO(wyck): Hide the webui hung renderer dialog. | 51 if (!logging::DialogsAreSuppressed() && g_instance) { |
| 46 NOTIMPLEMENTED() << " TODO: Hide the webui hung renderer dialog."; | 52 // TODO(wyck): Hide the webui hung renderer dialog. |
| 53 NOTIMPLEMENTED() << " TODO: Hide the webui hung renderer dialog."; |
| 54 } |
| 55 return; |
| 47 } | 56 } |
| 57 |
| 58 HideNativeHungRendererDialog(contents); |
| 48 } | 59 } |
| 49 | 60 |
| 50 } // namespace browser | 61 } // namespace browser |
| 51 | 62 |
| 52 HungRendererDialog::HungRendererDialog() | 63 HungRendererDialog::HungRendererDialog() |
| 53 : contents_(NULL) { | 64 : contents_(NULL) { |
| 54 } | 65 } |
| 55 | 66 |
| 56 void HungRendererDialog::ShowDialog(gfx::NativeWindow owning_window, | 67 void HungRendererDialog::ShowDialog(gfx::NativeWindow owning_window, |
| 57 TabContents* contents) { | 68 TabContents* contents) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 } | 126 } |
| 116 | 127 |
| 117 void HungRendererDialog::OnCloseContents(TabContents* source, | 128 void HungRendererDialog::OnCloseContents(TabContents* source, |
| 118 bool* out_close_dialog) { | 129 bool* out_close_dialog) { |
| 119 NOTIMPLEMENTED(); | 130 NOTIMPLEMENTED(); |
| 120 } | 131 } |
| 121 | 132 |
| 122 bool HungRendererDialog::ShouldShowDialogTitle() const { | 133 bool HungRendererDialog::ShouldShowDialogTitle() const { |
| 123 return true; | 134 return true; |
| 124 } | 135 } |
| OLD | NEW |