OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BACKGROUND_MODE_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_BACKGROUND_BACKGROUND_MODE_MANAGER_H_ |
6 #define CHROME_BROWSER_BACKGROUND_BACKGROUND_MODE_MANAGER_H_ | 6 #define CHROME_BROWSER_BACKGROUND_BACKGROUND_MODE_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
| 12 #include "base/memory/weak_ptr.h" |
12 #include "base/prefs/pref_change_registrar.h" | 13 #include "base/prefs/pref_change_registrar.h" |
13 #include "chrome/browser/background/background_application_list_model.h" | 14 #include "chrome/browser/background/background_application_list_model.h" |
14 #include "chrome/browser/profiles/profile_info_cache_observer.h" | 15 #include "chrome/browser/profiles/profile_info_cache_observer.h" |
15 #include "chrome/browser/status_icons/status_icon.h" | 16 #include "chrome/browser/status_icons/status_icon.h" |
16 #include "chrome/browser/status_icons/status_icon_menu_model.h" | 17 #include "chrome/browser/status_icons/status_icon_menu_model.h" |
17 #include "chrome/browser/ui/browser_list_observer.h" | 18 #include "chrome/browser/ui/browser_list_observer.h" |
18 #include "components/keyed_service/core/keyed_service.h" | 19 #include "components/keyed_service/core/keyed_service.h" |
19 #include "content/public/browser/notification_observer.h" | 20 #include "content/public/browser/notification_observer.h" |
20 #include "content/public/browser/notification_registrar.h" | 21 #include "content/public/browser/notification_registrar.h" |
21 #include "extensions/common/extension.h" | 22 #include "extensions/common/extension.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 // which is similar to a shared_ptr. | 189 // which is similar to a shared_ptr. |
189 typedef linked_ptr<BackgroundModeData> BackgroundModeInfo; | 190 typedef linked_ptr<BackgroundModeData> BackgroundModeInfo; |
190 | 191 |
191 typedef std::map<Profile*, BackgroundModeInfo> BackgroundModeInfoMap; | 192 typedef std::map<Profile*, BackgroundModeInfo> BackgroundModeInfoMap; |
192 | 193 |
193 // content::NotificationObserver implementation. | 194 // content::NotificationObserver implementation. |
194 void Observe(int type, | 195 void Observe(int type, |
195 const content::NotificationSource& source, | 196 const content::NotificationSource& source, |
196 const content::NotificationDetails& details) override; | 197 const content::NotificationDetails& details) override; |
197 | 198 |
| 199 // Called when ExtensionSystem is ready. |
| 200 void OnExtensionsReady(); |
| 201 |
198 // Called when the kBackgroundModeEnabled preference changes. | 202 // Called when the kBackgroundModeEnabled preference changes. |
199 void OnBackgroundModeEnabledPrefChanged(); | 203 void OnBackgroundModeEnabledPrefChanged(); |
200 | 204 |
201 // BackgroundApplicationListModel::Observer implementation. | 205 // BackgroundApplicationListModel::Observer implementation. |
202 void OnApplicationDataChanged(const extensions::Extension* extension, | 206 void OnApplicationDataChanged(const extensions::Extension* extension, |
203 Profile* profile) override; | 207 Profile* profile) override; |
204 void OnApplicationListChanged(Profile* profile) override; | 208 void OnApplicationListChanged(Profile* profile) override; |
205 | 209 |
206 // Overrides from ProfileInfoCacheObserver | 210 // Overrides from ProfileInfoCacheObserver |
207 void OnProfileAdded(const base::FilePath& profile_path) override; | 211 void OnProfileAdded(const base::FilePath& profile_path) override; |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 // (used for testing background mode without having to install a background | 353 // (used for testing background mode without having to install a background |
350 // app). | 354 // app). |
351 bool keep_alive_for_test_; | 355 bool keep_alive_for_test_; |
352 | 356 |
353 // Set to true when background mode is suspended. | 357 // Set to true when background mode is suspended. |
354 bool background_mode_suspended_; | 358 bool background_mode_suspended_; |
355 | 359 |
356 // Set to true when background mode is keeping Chrome alive. | 360 // Set to true when background mode is keeping Chrome alive. |
357 bool keeping_alive_; | 361 bool keeping_alive_; |
358 | 362 |
| 363 base::WeakPtrFactory<BackgroundModeManager> weak_factory_; |
| 364 |
359 DISALLOW_COPY_AND_ASSIGN(BackgroundModeManager); | 365 DISALLOW_COPY_AND_ASSIGN(BackgroundModeManager); |
360 }; | 366 }; |
361 | 367 |
362 #endif // CHROME_BROWSER_BACKGROUND_BACKGROUND_MODE_MANAGER_H_ | 368 #endif // CHROME_BROWSER_BACKGROUND_BACKGROUND_MODE_MANAGER_H_ |
OLD | NEW |