summaryrefslogtreecommitdiffstats
path: root/chrome/browser/tab_contents
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/tab_contents')
-rw-r--r--chrome/browser/tab_contents/background_contents.cc18
-rw-r--r--chrome/browser/tab_contents/background_contents.h20
-rw-r--r--chrome/browser/tab_contents/tab_contents_ssl_helper.cc2
3 files changed, 22 insertions, 18 deletions
diff --git a/chrome/browser/tab_contents/background_contents.cc b/chrome/browser/tab_contents/background_contents.cc
index cae94e8..6bad66f 100644
--- a/chrome/browser/tab_contents/background_contents.cc
+++ b/chrome/browser/tab_contents/background_contents.cc
@@ -109,8 +109,12 @@ void BackgroundContents::RunJavaScriptMessage(
const int flags,
IPC::Message* reply_msg,
bool* did_suppress_message) {
- // TODO(rafaelw): Implement, The JavaScriptModalDialog needs to learn about
- // BackgroundContents.
+ // TODO(rafaelw): Implement.
+
+ // Since we are suppressing messages, just reply as if the user immediately
+ // pressed "Cancel".
+ OnDialogClosed(reply_msg, false, string16());
+
*did_suppress_message = true;
}
@@ -137,15 +141,15 @@ void BackgroundContents::Observe(NotificationType type,
}
}
-void BackgroundContents::OnMessageBoxClosed(IPC::Message* reply_msg,
- bool success,
- const std::wstring& user_input) {
+void BackgroundContents::OnDialogClosed(IPC::Message* reply_msg,
+ bool success,
+ const string16& user_input) {
render_view_host()->JavaScriptDialogClosed(reply_msg,
success,
- WideToUTF16Hack(user_input));
+ user_input);
}
-gfx::NativeWindow BackgroundContents::GetMessageBoxRootWindow() {
+gfx::NativeWindow BackgroundContents::GetDialogRootWindow() {
NOTIMPLEMENTED();
return NULL;
}
diff --git a/chrome/browser/tab_contents/background_contents.h b/chrome/browser/tab_contents/background_contents.h
index b368766..93e1b43 100644
--- a/chrome/browser/tab_contents/background_contents.h
+++ b/chrome/browser/tab_contents/background_contents.h
@@ -11,8 +11,9 @@
#include "base/scoped_ptr.h"
#include "chrome/browser/tab_contents/render_view_host_delegate_helper.h"
-#include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h"
+#include "content/browser/javascript_dialogs.h"
#include "content/browser/renderer_host/render_view_host_delegate.h"
+#include "content/common/notification_observer.h"
#include "content/common/notification_registrar.h"
#include "content/common/window_container_type.h"
#include "webkit/glue/window_open_disposition.h"
@@ -32,7 +33,7 @@ class Rect;
class BackgroundContents : public RenderViewHostDelegate,
public RenderViewHostDelegate::View,
public NotificationObserver,
- public JavaScriptAppModalDialogDelegate {
+ public content::JavaScriptDialogDelegate {
public:
class Delegate {
public:
@@ -124,14 +125,13 @@ class BackgroundContents : public RenderViewHostDelegate,
const NotificationSource& source,
const NotificationDetails& details);
- // Overridden from JavaScriptAppModalDialogDelegate:
- virtual void OnMessageBoxClosed(IPC::Message* reply_msg,
- bool success,
- const std::wstring& user_input);
- virtual void SetSuppressMessageBoxes(bool suppress_message_boxes) {}
- virtual gfx::NativeWindow GetMessageBoxRootWindow();
- virtual TabContents* AsTabContents();
- virtual ExtensionHost* AsExtensionHost();
+ // Overridden from JavaScriptDialogDelegate:
+ virtual void OnDialogClosed(IPC::Message* reply_msg,
+ bool success,
+ const string16& user_input) OVERRIDE;
+ virtual gfx::NativeWindow GetDialogRootWindow() OVERRIDE;
+ virtual TabContents* AsTabContents() OVERRIDE;
+ virtual ExtensionHost* AsExtensionHost() OVERRIDE;
virtual void UpdateInspectorSetting(const std::string& key,
const std::string& value);
diff --git a/chrome/browser/tab_contents/tab_contents_ssl_helper.cc b/chrome/browser/tab_contents/tab_contents_ssl_helper.cc
index f7a25c8..a1811f1 100644
--- a/chrome/browser/tab_contents/tab_contents_ssl_helper.cc
+++ b/chrome/browser/tab_contents/tab_contents_ssl_helper.cc
@@ -89,7 +89,7 @@ string16 SSLCertAddedInfoBarDelegate::GetButtonLabel(
}
bool SSLCertAddedInfoBarDelegate::Accept() {
- ShowCertificateViewer(tab_contents_->GetMessageBoxRootWindow(), cert_);
+ ShowCertificateViewer(tab_contents_->GetDialogRootWindow(), cert_);
return false; // Hiding the infobar just as the dialog opens looks weird.
}