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

Unified Diff: chrome/browser/extensions/extension_host.cc

Issue 136453005: app_shell: Make renderer run background page JavaScript (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup (load_background_page) Created 6 years, 11 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/extensions/extension_host.cc
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc
index bafcf2189806a32675289ed960685e9edddc17ee..8b5c6fe081e98bc35d4b4a64af4b81634f881b40 100644
--- a/chrome/browser/extensions/extension_host.cc
+++ b/chrome/browser/extensions/extension_host.cc
@@ -30,6 +30,8 @@
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "content/public/browser/notification_service.h"
+#include "content/public/browser/notification_source.h"
+#include "content/public/browser/notification_types.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host_view.h"
@@ -191,13 +193,19 @@ void ExtensionHost::CreateRenderViewSoon() {
void ExtensionHost::CreateRenderViewNow() {
LoadInitialURL();
- if (IsBackgroundPage()) {
+ if (!IsBackgroundPage()) {
kirr 2014/03/07 12:23:40 Is it a misprint in condition? Seems like DidCreat
James Cook 2014/03/07 17:14:47 Yeah, that looks wrong. I'm taking a closer look a
DCHECK(IsRenderViewLive());
- ExtensionSystem::GetForBrowserContext(browser_context_)->
- extension_service()->DidCreateRenderViewForBackgroundPage(this);
+ ExtensionService* service = GetExtensionService();
+ if (service)
+ service->DidCreateRenderViewForBackgroundPage(this);
}
}
+ExtensionService* ExtensionHost::GetExtensionService() {
+ return ExtensionSystem::GetForBrowserContext(browser_context_)
+ ->extension_service();
+}
+
const GURL& ExtensionHost::GetURL() const {
return host_contents()->GetURL();
}
@@ -315,8 +323,13 @@ void ExtensionHost::DocumentAvailableInMainFrame() {
void ExtensionHost::OnDocumentAvailable() {
DCHECK(extension_host_type_ == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE);
- ExtensionSystem::GetForBrowserContext(browser_context_)->
- extension_service()->SetBackgroundPageReady(extension_);
+ ExtensionService* service = GetExtensionService();
+ if (service)
+ service->SetBackgroundPageReady(extension_);
+ content::NotificationService::current()->Notify(
+ chrome::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY,
+ content::Source<const Extension>(extension_),
+ content::NotificationService::NoDetails());
}
void ExtensionHost::CloseContents(WebContents* contents) {

Powered by Google App Engine
This is Rietveld 408576698