| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_BACKGROUND_PAGE_TRACKER_H_ | 5 #ifndef CHROME_BROWSER_BACKGROUND_PAGE_TRACKER_H_ |
| 6 #define CHROME_BROWSER_BACKGROUND_PAGE_TRACKER_H_ | 6 #define CHROME_BROWSER_BACKGROUND_PAGE_TRACKER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "base/singleton.h" | 13 #include "base/singleton.h" |
| 14 #include "chrome/common/notification_observer.h" | 14 #include "chrome/common/notification_observer.h" |
| 15 #include "chrome/common/notification_registrar.h" | 15 #include "chrome/common/notification_registrar.h" |
| 16 | 16 |
| 17 class PrefService; | 17 class PrefService; |
| 18 | 18 |
| 19 /////////////////////////////////////////////////////////////////////////////// | 19 /////////////////////////////////////////////////////////////////////////////// |
| 20 // BackgroundPageTracker | 20 // BackgroundPageTracker |
| 21 // | 21 // |
| 22 // This class is a singleton class that monitors when new background pages are | 22 // This class is a singleton class that monitors when new background pages are |
| 23 // loaded, and sends out a notification. | 23 // loaded, and sends out a notification. |
| 24 // | 24 // |
| 25 class BackgroundPageTracker : public NotificationObserver { | 25 class BackgroundPageTracker : public NotificationObserver { |
| 26 public: | 26 public: |
| 27 static void RegisterPrefs(PrefService* prefs); | 27 static void RegisterPrefs(PrefService* prefs); |
| 28 | 28 |
| 29 // Convenience routine which gets the singleton object. | 29 // Convenience routine which gets the singleton object. |
| 30 static BackgroundPageTracker* GetSingleton(); | 30 static BackgroundPageTracker* GetInstance(); |
| 31 | 31 |
| 32 // Returns the number of background apps/extensions currently loaded. | 32 // Returns the number of background apps/extensions currently loaded. |
| 33 int GetBackgroundPageCount(); | 33 int GetBackgroundPageCount(); |
| 34 | 34 |
| 35 // Returns the number of unacknowledged background pages (for use in badges, | 35 // Returns the number of unacknowledged background pages (for use in badges, |
| 36 // etc). | 36 // etc). |
| 37 int GetUnacknowledgedBackgroundPageCount(); | 37 int GetUnacknowledgedBackgroundPageCount(); |
| 38 | 38 |
| 39 // Called when the user has acknowledged that new background apps have been | 39 // Called when the user has acknowledged that new background apps have been |
| 40 // loaded. Future calls to GetUnacknowledgedBackgroundPageCount() will return | 40 // loaded. Future calls to GetUnacknowledgedBackgroundPageCount() will return |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 // Sends out a notification that the list of background pages has changed. | 87 // Sends out a notification that the list of background pages has changed. |
| 88 void SendChangeNotification(); | 88 void SendChangeNotification(); |
| 89 | 89 |
| 90 NotificationRegistrar registrar_; | 90 NotificationRegistrar registrar_; |
| 91 | 91 |
| 92 DISALLOW_COPY_AND_ASSIGN(BackgroundPageTracker); | 92 DISALLOW_COPY_AND_ASSIGN(BackgroundPageTracker); |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 #endif // CHROME_BROWSER_BACKGROUND_PAGE_TRACKER_H_ | 95 #endif // CHROME_BROWSER_BACKGROUND_PAGE_TRACKER_H_ |
| OLD | NEW |