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

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

Issue 12253022: Manifest handler for all keys background-related. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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_service.cc
diff --git a/chrome/browser/background/background_contents_service.cc b/chrome/browser/background/background_contents_service.cc
index 38b24f51b8cdcb13a8b9b2f24f25307a518b30e9..f93cc4fb2689e09afcb4e46ca72906f9a1a703e0 100644
--- a/chrome/browser/background/background_contents_service.cc
+++ b/chrome/browser/background/background_contents_service.cc
@@ -28,6 +28,7 @@
#include "chrome/browser/ui/host_desktop.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/extensions/background_info.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/extension_icon_set.h"
@@ -41,6 +42,7 @@
using content::SiteInstance;
using content::WebContents;
+using extensions::BackgroundInfo;
using extensions::Extension;
using extensions::UnloadedExtensionInfo;
@@ -264,7 +266,7 @@ void BackgroundContentsService::Observe(
if (extension_service) {
const Extension* extension =
extension_service->GetExtensionById(UTF16ToUTF8(appid), false);
- if (extension && extension->has_background_page())
+ if (extension && BackgroundInfo::HasBackgroundPage(extension))
break;
}
RegisterBackgroundContents(bgcontents);
@@ -275,7 +277,7 @@ void BackgroundContentsService::Observe(
content::Details<const Extension>(details).ptr();
Profile* profile = content::Source<Profile>(source).ptr();
if (extension->is_hosted_app() &&
- extension->has_background_page()) {
+ BackgroundInfo::HasBackgroundPage(extension)) {
// If there is a background page specified in the manifest for a hosted
// app, then blow away registered urls in the pref.
ShutdownAssociatedBackgroundContents(ASCIIToUTF16(extension->id()));
@@ -286,8 +288,10 @@ void BackgroundContentsService::Observe(
// Now load the manifest-specified background page. If service isn't
// ready, then the background page will be loaded from the
// EXTENSIONS_READY callback.
- LoadBackgroundContents(profile, extension->GetBackgroundURL(),
- ASCIIToUTF16("background"), UTF8ToUTF16(extension->id()));
+ LoadBackgroundContents(profile,
+ BackgroundInfo::GetBackgroundURL(extension),
+ ASCIIToUTF16("background"),
+ UTF8ToUTF16(extension->id()));
}
}
@@ -346,7 +350,7 @@ void BackgroundContentsService::Observe(
// from the LOADED callback.
const Extension* extension =
content::Details<UnloadedExtensionInfo>(details)->extension;
- if (extension->has_background_page())
+ if (BackgroundInfo::HasBackgroundPage(extension))
ShutdownAssociatedBackgroundContents(ASCIIToUTF16(extension->id()));
break;
}
@@ -420,9 +424,9 @@ void BackgroundContentsService::LoadBackgroundContentsForExtension(
extensions::ExtensionSystem::Get(profile)->extension_service()->
GetExtensionById(extension_id, false);
DCHECK(!extension || extension->is_hosted_app());
- if (extension && extension->has_background_page()) {
+ if (extension && BackgroundInfo::HasBackgroundPage(extension)) {
LoadBackgroundContents(profile,
- extension->GetBackgroundURL(),
+ BackgroundInfo::GetBackgroundURL(extension),
ASCIIToUTF16("background"),
UTF8ToUTF16(extension->id()));
return;
@@ -468,9 +472,10 @@ void BackgroundContentsService::LoadBackgroundContentsFromManifests(
ExtensionSet::const_iterator iter = extensions->begin();
for (; iter != extensions->end(); ++iter) {
const Extension* extension = *iter;
- if (extension->is_hosted_app() && extension->has_background_page()) {
+ if (extension->is_hosted_app() &&
+ BackgroundInfo::HasBackgroundPage(extension)) {
LoadBackgroundContents(profile,
- extension->GetBackgroundURL(),
+ BackgroundInfo::GetBackgroundURL(extension),
ASCIIToUTF16("background"),
UTF8ToUTF16(extension->id()));
}

Powered by Google App Engine
This is Rietveld 408576698