Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4426)

Unified Diff: chrome/browser/ui/webui/hung_renderer_dialog.cc

Issue 7670041: Add --use-more-webui runtime flag to toggle WebUI replacements for native dialogs. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Merge with trunk. Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/hung_renderer_dialog.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 590c79a844fc81d035c7dc83bedfd1d630bd7b08..13379cd24a46f02cd630710cbe68fefeb69be542 100644
--- a/chrome/browser/ui/webui/hung_renderer_dialog.cc
+++ b/chrome/browser/ui/webui/hung_renderer_dialog.cc
@@ -8,10 +8,13 @@
#include <vector>
#include "base/json/json_reader.h"
+#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
+#include "chrome/browser/ui/webui/html_dialog_ui.h"
#include "chrome/common/logging_chrome.h"
#include "chrome/common/url_constants.h"
#include "content/browser/renderer_host/render_view_host.h"
@@ -19,7 +22,6 @@
#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;
@@ -30,11 +32,21 @@ const int kHungRendererDialogHeight = 200;
namespace browser {
void ShowHungRendererDialog(TabContents* contents) {
- HungRendererDialog::ShowHungRendererDialog(contents);
+ if (ChromeWebUI::IsMoreWebUI()) {
+ HungRendererDialog::ShowHungRendererDialog(contents);
+ return;
+ }
+
+ ShowNativeHungRendererDialog(contents);
}
void HideHungRendererDialog(TabContents* contents) {
- HungRendererDialog::HideHungRendererDialog(contents);
+ if (ChromeWebUI::IsMoreWebUI()) {
+ HungRendererDialog::HideHungRendererDialog(contents);
+ return;
+ }
+
+ HideNativeHungRendererDialog(contents);
}
} // namespace browser
@@ -62,6 +74,7 @@ void HungRendererDialog::HideHungRendererDialog(TabContents* contents) {
HungRendererDialog::HungRendererDialog()
: contents_(NULL),
+ handler_(NULL),
window_(NULL) {
}
@@ -70,6 +83,7 @@ void HungRendererDialog::ShowDialog(TabContents* contents) {
contents_ = contents;
Browser* browser = BrowserList::GetLastActive();
DCHECK(browser);
+ handler_ = new HungRendererDialogHandler(contents_);
window_ = browser->BrowserShowHtmlDialog(this, NULL);
}
@@ -83,9 +97,8 @@ void HungRendererDialog::HideDialog(TabContents* contents) {
// We do this because the close dialog handler runs whether it is trigged by
// the user closing the box, or by being closed externally with widget->Close.
contents_ = NULL;
- views::Widget* widget = views::Widget::GetWidgetForNativeWindow(window_);
- DCHECK(widget);
- widget->Close();
+ DCHECK(handler_);
+ handler_->CloseDialog();
}
bool HungRendererDialog::IsDialogModal() const {
@@ -102,7 +115,7 @@ GURL HungRendererDialog::GetDialogContentURL() const {
void HungRendererDialog::GetWebUIMessageHandlers(
std::vector<WebUIMessageHandler*>* handlers) const {
- handlers->push_back(new HungRendererDialogHandler(contents_));
+ handlers->push_back(handler_);
}
void HungRendererDialog::GetDialogSize(gfx::Size* size) const {
@@ -155,6 +168,11 @@ HungRendererDialogHandler::HungRendererDialogHandler(
: contents_(contents) {
}
+void HungRendererDialogHandler::CloseDialog() {
+ DCHECK(web_ui_);
+ static_cast<HtmlDialogUI*>(web_ui_)->CloseDialog(NULL);
+}
+
void HungRendererDialogHandler::RegisterMessages() {
web_ui_->RegisterMessageCallback("requestTabContentsList",
NewCallback(this,
« no previous file with comments | « chrome/browser/ui/webui/hung_renderer_dialog.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698