summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/views/notifications/balloon_view_host.cc10
-rw-r--r--chrome/browser/views/notifications/balloon_view_host.h3
2 files changed, 12 insertions, 1 deletions
diff --git a/chrome/browser/views/notifications/balloon_view_host.cc b/chrome/browser/views/notifications/balloon_view_host.cc
index cccb5f2..fa8e842 100644
--- a/chrome/browser/views/notifications/balloon_view_host.cc
+++ b/chrome/browser/views/notifications/balloon_view_host.cc
@@ -37,6 +37,12 @@ void BalloonViewHost::Shutdown() {
}
}
+WebPreferences BalloonViewHost::GetWebkitPrefs() {
+ WebPreferences prefs;
+ prefs.allow_scripts_to_close_windows = true;
+ return prefs;
+}
+
RendererPreferences BalloonViewHost::GetRendererPrefs() const {
// We want links (a.k.a. top_level_requests) to be forwarded to the browser so
// that we can open them in a new tab rather than in the balloon.
@@ -53,6 +59,10 @@ void BalloonViewHost::RequestOpenURL(const GURL& url,
PageTransition::LINK, true, 0, 0, GetSiteInstance());
}
+void BalloonViewHost::Close(RenderViewHost* render_view_host) {
+ balloon_->CloseByScript();
+}
+
void BalloonViewHost::RendererReady(RenderViewHost* /* render_view_host */) {
should_notify_on_disconnect_ = true;
NotificationService::current()->Notify(
diff --git a/chrome/browser/views/notifications/balloon_view_host.h b/chrome/browser/views/notifications/balloon_view_host.h
index 5ef8294..491ba2b 100644
--- a/chrome/browser/views/notifications/balloon_view_host.h
+++ b/chrome/browser/views/notifications/balloon_view_host.h
@@ -31,7 +31,7 @@ class BalloonViewHost : public views::NativeViewHost,
void Shutdown();
// RenderViewHostDelegate overrides.
- virtual WebPreferences GetWebkitPrefs() { return WebPreferences(); }
+ virtual WebPreferences GetWebkitPrefs();
virtual RendererPreferences GetRendererPrefs() const;
virtual SiteInstance* GetSiteInstance() const {
return site_instance_.get();
@@ -42,6 +42,7 @@ class BalloonViewHost : public views::NativeViewHost,
}
virtual void RequestOpenURL(const GURL& url, const GURL& referrer,
WindowOpenDisposition disposition);
+ virtual void Close(RenderViewHost* render_view_host);
virtual void RendererReady(RenderViewHost* render_view_host);
virtual void RendererGone(RenderViewHost* render_view_host);
virtual void UpdateTitle(RenderViewHost* /* render_view_host */,