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..09c511a7b5866b4e7f33b66d399530cd34df9d99 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" |
Devlin
2015/02/20 00:07:57
don't need
Yoyo Zhou
2015/02/20 20:00:01
Done - also removed from extension_host.cc.
|
#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,6 +17,10 @@ |
#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_delegate.h" |
+#include "extensions/browser/extension_host_queue.h" |
+#include "extensions/browser/extensions_browser_client.h" |
+#include "extensions/browser/serial_extension_host_queue.h" |
Devlin
2015/02/20 00:07:57
don't need
|
#include "extensions/browser/view_type_utils.h" |
#include "ui/gfx/geometry/rect.h" |
@@ -29,7 +34,9 @@ BackgroundContents::BackgroundContents( |
Delegate* delegate, |
const std::string& partition_id, |
content::SessionStorageNamespace* session_storage_namespace) |
- : delegate_(delegate) { |
+ : delegate_(delegate), |
+ extension_host_delegate_(extensions::ExtensionsBrowserClient::Get() |
+ ->CreateExtensionHostDelegate()) { |
profile_ = Profile::FromBrowserContext( |
site_instance->GetBrowserContext()); |
@@ -82,12 +89,19 @@ BackgroundContents::~BackgroundContents() { |
chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED, |
content::Source<Profile>(profile_), |
content::Details<BackgroundContents>(this)); |
+ |
+ extension_host_delegate_->GetExtensionHostQueue()->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; |
+ extension_host_delegate_->GetExtensionHostQueue()->Add(this); |
+} |
+ |
void BackgroundContents::CloseContents(WebContents* source) { |
content::NotificationService::current()->Notify( |
chrome::NOTIFICATION_BACKGROUND_CONTENTS_CLOSED, |
@@ -160,3 +174,9 @@ void BackgroundContents::Observe(int type, |
break; |
} |
} |
+ |
+void BackgroundContents::CreateRenderViewNow() { |
+ web_contents()->GetController().LoadURL(initial_url_, content::Referrer(), |
+ ui::PAGE_TRANSITION_LINK, |
+ std::string()); |
+} |