summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-12 01:31:08 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-12 01:31:08 +0000
commit02ea45b3c8ccbc23480f0306fd092726c5d30d42 (patch)
tree947e0612e29bd6f682ffb5dae2af1a3b1427b0df /chrome
parent0f6ff8e0b2c190c26c6598778165f4a5cbfb733b (diff)
downloadchromium_src-02ea45b3c8ccbc23480f0306fd092726c5d30d42.zip
chromium_src-02ea45b3c8ccbc23480f0306fd092726c5d30d42.tar.gz
chromium_src-02ea45b3c8ccbc23480f0306fd092726c5d30d42.tar.bz2
Make notifications from extension URLs use extension process.
Future changes will hook up extension APIs and add testing. BUG=27247 Review URL: http://codereview.chromium.org/868001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41378 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/views/notifications/balloon_view_host.cc24
-rw-r--r--chrome/browser/views/notifications/balloon_view_host.h3
2 files changed, 25 insertions, 2 deletions
diff --git a/chrome/browser/views/notifications/balloon_view_host.cc b/chrome/browser/views/notifications/balloon_view_host.cc
index 125ee4b..94f645a 100644
--- a/chrome/browser/views/notifications/balloon_view_host.cc
+++ b/chrome/browser/views/notifications/balloon_view_host.cc
@@ -6,6 +6,7 @@
#include "base/string_util.h"
#include "chrome/browser/browser_list.h"
+#include "chrome/browser/extensions/extension_process_manager.h"
#include "chrome/browser/in_process_webkit/dom_storage_context.h"
#include "chrome/browser/in_process_webkit/webkit_context.h"
#include "chrome/browser/notifications/balloon.h"
@@ -20,10 +21,12 @@
#include "chrome/browser/renderer_host/render_widget_host_view_gtk.h"
#endif
#include "chrome/browser/renderer_host/site_instance.h"
+#include "chrome/common/bindings_policy.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/notification_type.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/renderer_preferences.h"
+#include "chrome/common/url_constants.h"
#include "views/widget/widget.h"
#if defined(OS_WIN)
#include "views/widget/widget_win.h"
@@ -35,10 +38,23 @@
BalloonViewHost::BalloonViewHost(Balloon* balloon)
: initialized_(false),
balloon_(balloon),
- site_instance_(SiteInstance::CreateSiteInstance(balloon->profile())),
render_view_host_(NULL),
- should_notify_on_disconnect_(false) {
+ should_notify_on_disconnect_(false),
+ is_extension_page_(false) {
DCHECK(balloon_);
+
+ // If the notification is for an extension URL, make sure to use the extension
+ // process to render it, so that it can communicate with other views in the
+ // extension.
+ const GURL& balloon_url = balloon_->notification().content_url();
+ if (balloon_url.SchemeIs(chrome::kExtensionScheme)) {
+ is_extension_page_ = true;
+ site_instance_ =
+ balloon_->profile()->GetExtensionProcessManager()->GetSiteInstanceForURL(
+ balloon_url);
+ } else {
+ site_instance_ = SiteInstance::CreateSiteInstance(balloon_->profile());
+ }
}
void BalloonViewHost::Shutdown() {
@@ -116,6 +132,10 @@ void BalloonViewHost::Init(gfx::NativeView parent_hwnd) {
session_storage_namespace_id);
render_view_host_ = rvh;
+ if (is_extension_page_) {
+ rvh->AllowBindings(BindingsPolicy::EXTENSION);
+ }
+
// Pointer is owned by the RVH.
RenderWidgetHostView* view = RenderWidgetHostView::CreateViewForWidget(rvh);
rvh->set_view(view);
diff --git a/chrome/browser/views/notifications/balloon_view_host.h b/chrome/browser/views/notifications/balloon_view_host.h
index 4233122..8b16586 100644
--- a/chrome/browser/views/notifications/balloon_view_host.h
+++ b/chrome/browser/views/notifications/balloon_view_host.h
@@ -119,6 +119,9 @@ class BalloonViewHost : public views::NativeViewHost,
// The title of the balloon page.
std::wstring title_;
+ // Whether the page we are rendering is from an extension.
+ bool is_extension_page_;
+
// Common implementations of some RenderViewHostDelegate::View methods.
RenderViewHostDelegateViewHelper delegate_view_helper_;