summaryrefslogtreecommitdiffstats
path: root/chrome/browser/background_page_tracker.h
diff options
context:
space:
mode:
authoratwilson@chromium.org <atwilson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-04 23:23:23 +0000
committeratwilson@chromium.org <atwilson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-04 23:23:23 +0000
commitabcc5a1c6f935d34793cf4e2afb3e61a4af4b1b3 (patch)
tree57e8d98365555b96980710de3f631e9d2cc6de30 /chrome/browser/background_page_tracker.h
parentc5f9e6620100db945269985fb48668700a9374bc (diff)
downloadchromium_src-abcc5a1c6f935d34793cf4e2afb3e61a4af4b1b3.zip
chromium_src-abcc5a1c6f935d34793cf4e2afb3e61a4af4b1b3.tar.gz
chromium_src-abcc5a1c6f935d34793cf4e2afb3e61a4af4b1b3.tar.bz2
Removed BackgroundPageTracker - less code = more happiness
BUG=80755 TEST=Install extensions with background pages, make sure View Background Pages wrench menu item has the correct count. Review URL: http://codereview.chromium.org/6929001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84152 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/background_page_tracker.h')
-rw-r--r--chrome/browser/background_page_tracker.h95
1 files changed, 0 insertions, 95 deletions
diff --git a/chrome/browser/background_page_tracker.h b/chrome/browser/background_page_tracker.h
deleted file mode 100644
index e00f5eb..0000000
--- a/chrome/browser/background_page_tracker.h
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_BACKGROUND_PAGE_TRACKER_H_
-#define CHROME_BROWSER_BACKGROUND_PAGE_TRACKER_H_
-#pragma once
-
-#include <map>
-#include <string>
-
-#include "base/gtest_prod_util.h"
-#include "base/memory/singleton.h"
-#include "content/common/notification_observer.h"
-#include "content/common/notification_registrar.h"
-
-class PrefService;
-
-///////////////////////////////////////////////////////////////////////////////
-// BackgroundPageTracker
-//
-// This class is a singleton class that monitors when new background pages are
-// loaded, and sends out a notification.
-//
-class BackgroundPageTracker : public NotificationObserver {
- public:
- static void RegisterPrefs(PrefService* prefs);
-
- // Convenience routine which gets the singleton object.
- static BackgroundPageTracker* GetInstance();
-
- // Returns the number of background apps/extensions currently loaded.
- int GetBackgroundPageCount();
-
- // Returns the number of unacknowledged background pages (for use in badges,
- // etc).
- int GetUnacknowledgedBackgroundPageCount();
-
- // Called when the user has acknowledged that new background apps have been
- // loaded. Future calls to GetUnacknowledgedBackgroundPageCount() will return
- // 0 until another background page is installed.
- void AcknowledgeBackgroundPages();
-
- protected:
- // Constructor marked as protected so we can create mock subclasses.
- BackgroundPageTracker();
- ~BackgroundPageTracker();
- friend struct DefaultSingletonTraits<BackgroundPageTracker>;
- friend class BackgroundPageTrackerTest;
- FRIEND_TEST_ALL_PREFIXES(BackgroundPageTrackerTest, OnBackgroundPageLoaded);
- FRIEND_TEST_ALL_PREFIXES(BackgroundPageTrackerTest,
- AcknowledgeBackgroundPages);
- FRIEND_TEST_ALL_PREFIXES(BackgroundPageTrackerTest,
- TestTrackerChangedNotifications);
-
- // Mockable method to get the PrefService where we store information about
- // background pages.
- virtual PrefService* GetPrefService();
-
- // Helper routine which checks to see if this object should be enabled or not.
- // If false, the BackgroundPageTracker always acts as if there are no
- // background pages. Virtual to allow enabling in mocks.
- virtual bool IsEnabled();
-
- private:
- // NotificationObserver implementation.
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // Invoked once all extensions have been loaded, so we can update our list of
- // tracked pages and send out the appropriate notifications. Returns true if
- // the extension list was changed.
- bool UpdateExtensionList();
-
- // Called when a background page is loaded (either because a hosted app
- // opened a BackgroundContents or a packaged extension was loaded with an
- // extension background page). Updates our internal list of unacknowledged
- // background pages.
- void OnBackgroundPageLoaded(const std::string& parent_application_id);
-
- // When an extension is unloaded, removes it from the list of background pages
- // so we no longer nag the user about it (if it is still unacknowledged) and
- // we inform the user if it is ever re-installed/enabled.
- void OnExtensionUnloaded(const std::string& parent_application_id);
-
- // Sends out a notification that the list of background pages has changed.
- void SendChangeNotification();
-
- NotificationRegistrar registrar_;
-
- DISALLOW_COPY_AND_ASSIGN(BackgroundPageTracker);
-};
-
-#endif // CHROME_BROWSER_BACKGROUND_PAGE_TRACKER_H_