summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views
diff options
context:
space:
mode:
authormpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-09 19:33:20 +0000
committermpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-09 19:33:20 +0000
commit45904e20797f8cd28a776ed0e40ba94dc4eef97e (patch)
tree00b15cd6207f993e9553313202801702b3f7b250 /chrome/browser/views
parent1cb5fbed08b85c459288c98d63cf7c3158f519a2 (diff)
downloadchromium_src-45904e20797f8cd28a776ed0e40ba94dc4eef97e.zip
chromium_src-45904e20797f8cd28a776ed0e40ba94dc4eef97e.tar.gz
chromium_src-45904e20797f8cd28a776ed0e40ba94dc4eef97e.tar.bz2
Introducing ExtensionProcessManager. This manages the ExtensionViews to
ensure there is only 1 process per extension. I also changed ExtensionMessageService from singleton to one instance per Profile. This means messages can only be passed to extensions and scripts within the same profile. Review URL: http://codereview.chromium.org/62132 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13447 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r--chrome/browser/views/bookmark_bar_view.cc4
-rw-r--r--chrome/browser/views/hwnd_html_view.cc16
-rw-r--r--chrome/browser/views/hwnd_html_view.h12
3 files changed, 22 insertions, 10 deletions
diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc
index 36eaa3d..2c41482 100644
--- a/chrome/browser/views/bookmark_bar_view.cc
+++ b/chrome/browser/views/bookmark_bar_view.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/browser.h"
#include "chrome/browser/drag_utils.h"
#include "chrome/browser/extensions/extension.h"
+#include "chrome/browser/extensions/extension_process_manager.h"
#include "chrome/browser/extensions/extension_view.h"
#include "chrome/browser/extensions/extensions_service.h"
#include "chrome/browser/metrics/user_metrics.h"
@@ -300,7 +301,8 @@ class ExtensionToolstrip : public views::View {
static const int kPadding = 2;
ExtensionToolstrip(Extension* extension, const GURL& url, Profile* profile)
- : view_(new ExtensionView(extension, url, profile)) {
+ : view_(ExtensionProcessManager::GetInstance()->CreateView(
+ extension, url, profile)) {
AddChildView(view_);
set_border(views::Border::CreateEmptyBorder(
kPadding, kPadding, kPadding, kPadding));
diff --git a/chrome/browser/views/hwnd_html_view.cc b/chrome/browser/views/hwnd_html_view.cc
index 95c98f9..9eb8cc4 100644
--- a/chrome/browser/views/hwnd_html_view.cc
+++ b/chrome/browser/views/hwnd_html_view.cc
@@ -11,6 +11,19 @@
#include "chrome/views/widget/widget.h"
#include "chrome/views/widget/widget_win.h"
+HWNDHtmlView::HWNDHtmlView(const GURL& content_url,
+ RenderViewHostDelegate* delegate,
+ bool allow_dom_ui_bindings, SiteInstance* instance)
+ : render_view_host_(NULL),
+ content_url_(content_url),
+ allow_dom_ui_bindings_(allow_dom_ui_bindings),
+ delegate_(delegate),
+ initialized_(false),
+ site_instance_(instance) {
+ if (!site_instance_)
+ site_instance_ = SiteInstance::CreateSiteInstance(delegate_->GetProfile());
+}
+
HWNDHtmlView::~HWNDHtmlView() {
if (render_view_host_) {
Detach();
@@ -29,8 +42,7 @@ void HWNDHtmlView::InitHidden() {
void HWNDHtmlView::Init(HWND parent_hwnd) {
DCHECK(!render_view_host_) << "Already initialized.";
RenderViewHost* rvh = new RenderViewHost(
- SiteInstance::CreateSiteInstance(delegate_->GetProfile()),
- delegate_, MSG_ROUTING_NONE, NULL);
+ site_instance_, delegate_, MSG_ROUTING_NONE, NULL);
render_view_host_ = rvh;
RenderWidgetHostViewWin* view = new RenderWidgetHostViewWin(rvh);
diff --git a/chrome/browser/views/hwnd_html_view.h b/chrome/browser/views/hwnd_html_view.h
index b4a0d6a..9a55496 100644
--- a/chrome/browser/views/hwnd_html_view.h
+++ b/chrome/browser/views/hwnd_html_view.h
@@ -10,6 +10,7 @@
class RenderViewHost;
class RenderViewHostDelegate;
+class SiteInstance;
// A simple view that wraps a RenderViewHost in an HWNDView to facilitate
// rendering HTML as arbitrary browser views.
@@ -17,13 +18,7 @@ class RenderViewHostDelegate;
class HWNDHtmlView : public views::HWNDView {
public:
HWNDHtmlView(const GURL& content_url, RenderViewHostDelegate* delegate,
- bool allow_dom_ui_bindings)
- : render_view_host_(NULL),
- content_url_(content_url),
- allow_dom_ui_bindings_(allow_dom_ui_bindings),
- delegate_(delegate),
- initialized_(false) {
- }
+ bool allow_dom_ui_bindings, SiteInstance* instance);
virtual ~HWNDHtmlView();
RenderViewHost* render_view_host() { return render_view_host_; }
@@ -50,6 +45,9 @@ class HWNDHtmlView : public views::HWNDView {
// Our HTML rendering component.
RenderViewHost* render_view_host_;
+ // The site instance that the renderer belongs to.
+ SiteInstance* site_instance_;
+
// Whether or not the rendered content is permitted to send messages back to
// the view, through |delegate_| via ProcessDOMUIMessage.
bool allow_dom_ui_bindings_;