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

Unified Diff: chrome/browser/extensions/lazy_background_task_queue.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/extensions/lazy_background_task_queue.cc
diff --git a/chrome/browser/extensions/lazy_background_task_queue.cc b/chrome/browser/extensions/lazy_background_task_queue.cc
index b5ae6b0b5db3119d6d3ed8ec6846d8a47283a514..da9054ab9db78170b8ce93e7a6bf10b59c0f6967 100644
--- a/chrome/browser/extensions/lazy_background_task_queue.cc
+++ b/chrome/browser/extensions/lazy_background_task_queue.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/tab_contents/tab_util.h"
#include "chrome/common/chrome_notification_types.h"
+#include "chrome/common/extensions/background_info.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_messages.h"
#include "chrome/common/view_type.h"
@@ -41,7 +42,7 @@ LazyBackgroundTaskQueue::~LazyBackgroundTaskQueue() {
bool LazyBackgroundTaskQueue::ShouldEnqueueTask(
Profile* profile, const Extension* extension) {
DCHECK(extension);
- if (extension->has_background_page()) {
+ if (BackgroundInfo::HasBackgroundPage(extension)) {
ExtensionProcessManager* pm = extensions::ExtensionSystem::Get(profile)->
process_manager();
ExtensionHost* background_host =
@@ -69,13 +70,14 @@ void LazyBackgroundTaskQueue::AddPendingTask(
const Extension* extension =
ExtensionSystem::Get(profile)->extension_service()->
extensions()->GetByID(extension_id);
- if (extension && extension->has_lazy_background_page()) {
+ if (extension && BackgroundInfo::HasLazyBackgroundPage(extension)) {
// If this is the first enqueued task, and we're not waiting for the
// background page to unload, ensure the background page is loaded.
ExtensionProcessManager* pm =
ExtensionSystem::Get(profile)->process_manager();
pm->IncrementLazyKeepaliveCount(extension);
- pm->CreateBackgroundHost(extension, extension->GetBackgroundURL());
+ pm->CreateBackgroundHost(extension,
+ BackgroundInfo::GetBackgroundURL(extension));
}
} else {
tasks_list = it->second.get();
@@ -94,7 +96,7 @@ void LazyBackgroundTaskQueue::ProcessPendingTasks(
PendingTasksKey key(profile, extension->id());
PendingTasksMap::iterator map_it = pending_tasks_.find(key);
if (map_it == pending_tasks_.end()) {
- if (extension->has_lazy_background_page())
+ if (BackgroundInfo::HasLazyBackgroundPage(extension))
CHECK(!host); // lazy page should not load without any pending tasks
return;
}
@@ -112,7 +114,7 @@ void LazyBackgroundTaskQueue::ProcessPendingTasks(
// Balance the keepalive in AddPendingTask. Note we don't do this on a
// failure to load, because the keepalive count is reset in that case.
- if (host && extension->has_lazy_background_page()) {
+ if (host && BackgroundInfo::HasLazyBackgroundPage(extension)) {
ExtensionSystem::Get(profile)->process_manager()->
DecrementLazyKeepaliveCount(extension);
}
« no previous file with comments | « chrome/browser/extensions/image_loader_unittest.cc ('k') | chrome/browser/extensions/manifest_url_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698