Chromium Code Reviews| Index: chrome/browser/background/background_contents.cc |
| diff --git a/chrome/browser/background/background_contents.cc b/chrome/browser/background/background_contents.cc |
| index 7a1150b347a983fc2a213b3d228a83dba6625537..6b56660137f61a9e20116b5c68a4004cc531103b 100644 |
| --- a/chrome/browser/background/background_contents.cc |
| +++ b/chrome/browser/background/background_contents.cc |
| @@ -4,6 +4,7 @@ |
| #include "chrome/browser/background/background_contents.h" |
| +#include "base/lazy_instance.h" |
| #include "chrome/browser/background/background_contents_service.h" |
| #include "chrome/browser/chrome_notification_types.h" |
| #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" |
| @@ -16,12 +17,25 @@ |
| #include "content/public/browser/session_storage_namespace.h" |
| #include "content/public/browser/site_instance.h" |
| #include "content/public/browser/web_contents.h" |
| +#include "extensions/browser/extension_host_queue.h" |
| +#include "extensions/browser/serial_extension_host_queue.h" |
| #include "extensions/browser/view_type_utils.h" |
| #include "ui/gfx/geometry/rect.h" |
| using content::SiteInstance; |
| using content::WebContents; |
| +namespace { |
| + |
| +// Singleton which wraps the chosen ExtensionHostQueue implementation. |
| +struct QueueWrapper { |
|
Devlin
2015/02/18 23:22:12
Should we have two separate queues for extension h
Yoyo Zhou
2015/02/19 02:55:37
I don't have a strong preference either way. I thi
Devlin
2015/02/19 16:41:43
I think Ben's trying to make it easy to switch bet
not at google - send to devlin
2015/02/19 18:07:41
Note that I will probably need to modify the way t
Yoyo Zhou
2015/02/19 23:57:58
Turns out we have an ExtensionHostDelegate which w
not at google - send to devlin
2015/02/20 00:28:33
Sweet, that's where I put it as well (in my unfini
|
| + QueueWrapper() : queue(new extensions::SerialExtensionHostQueue()) {} |
| + scoped_ptr<extensions::ExtensionHostQueue> queue; |
| +}; |
| +base::LazyInstance<QueueWrapper> g_queue_wrapper = LAZY_INSTANCE_INITIALIZER; |
| + |
| +} // namespace |
| + |
| BackgroundContents::BackgroundContents( |
| SiteInstance* site_instance, |
| int routing_id, |
| @@ -82,12 +96,25 @@ BackgroundContents::~BackgroundContents() { |
| chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED, |
| content::Source<Profile>(profile_), |
| content::Details<BackgroundContents>(this)); |
| + |
| + g_queue_wrapper.Get().queue->Remove(this); |
| } |
| const GURL& BackgroundContents::GetURL() const { |
| return web_contents_.get() ? web_contents_->GetURL() : GURL::EmptyGURL(); |
| } |
| +void BackgroundContents::CreateRenderViewSoon(const GURL& url) { |
| + initial_url_ = url; |
| + g_queue_wrapper.Get().queue->Add(this); |
| +} |
| + |
| +void BackgroundContents::CreateRenderViewNow() { |
| + web_contents()->GetController().LoadURL(initial_url_, content::Referrer(), |
| + ui::PAGE_TRANSITION_LINK, |
| + std::string()); |
| +} |
| + |
| void BackgroundContents::CloseContents(WebContents* source) { |
| content::NotificationService::current()->Notify( |
| chrome::NOTIFICATION_BACKGROUND_CONTENTS_CLOSED, |