Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Unified Diff: chrome/browser/background/background_contents.cc

Issue 933423003: Make BackgroundContentsService start up BackgroundContents with a delay, as for ExtensionHosts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: edulcni# Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..bf94280656bfba469b1214b986e149f9f62a0682 100644
--- a/chrome/browser/background/background_contents.cc
+++ b/chrome/browser/background/background_contents.cc
@@ -16,6 +16,9 @@
#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/view_type_utils.h"
#include "ui/gfx/geometry/rect.h"
@@ -29,7 +32,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 +87,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 +172,9 @@ void BackgroundContents::Observe(int type,
break;
}
}
+
+void BackgroundContents::CreateRenderViewNow() {
+ web_contents()->GetController().LoadURL(initial_url_, content::Referrer(),
+ ui::PAGE_TRANSITION_LINK,
+ std::string());
+}
« no previous file with comments | « chrome/browser/background/background_contents.h ('k') | chrome/browser/background/background_contents_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698