| 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" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 public: | 118 public: |
| 119 explicit BackgroundModeData( | 119 explicit BackgroundModeData( |
| 120 Profile* profile, | 120 Profile* profile, |
| 121 CommandIdExtensionVector* command_id_extension_vector); | 121 CommandIdExtensionVector* command_id_extension_vector); |
| 122 virtual ~BackgroundModeData(); | 122 virtual ~BackgroundModeData(); |
| 123 | 123 |
| 124 // The cached list of BackgroundApplications. | 124 // The cached list of BackgroundApplications. |
| 125 scoped_ptr<BackgroundApplicationListModel> applications_; | 125 scoped_ptr<BackgroundApplicationListModel> applications_; |
| 126 | 126 |
| 127 // Overrides from StatusIconMenuModel::Delegate implementation. | 127 // Overrides from StatusIconMenuModel::Delegate implementation. |
| 128 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; | 128 virtual void ExecuteCommand(int command_id, int event_flags) override; |
| 129 | 129 |
| 130 // Returns a browser window, or creates one if none are open. Used by | 130 // Returns a browser window, or creates one if none are open. Used by |
| 131 // operations (like displaying the preferences dialog) that require a | 131 // operations (like displaying the preferences dialog) that require a |
| 132 // Browser window. | 132 // Browser window. |
| 133 Browser* GetBrowserWindow(); | 133 Browser* GetBrowserWindow(); |
| 134 | 134 |
| 135 // Returns the number of background apps for this profile. | 135 // Returns the number of background apps for this profile. |
| 136 int GetBackgroundAppCount() const; | 136 int GetBackgroundAppCount() const; |
| 137 | 137 |
| 138 // Builds the profile specific parts of the menu. The menu passed in may | 138 // Builds the profile specific parts of the menu. The menu passed in may |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 // can't be copied. So rather than using BackgroundModeData* which | 186 // can't be copied. So rather than using BackgroundModeData* which |
| 187 // we'd have to remember to delete, we use the ref-counted linked_ptr | 187 // we'd have to remember to delete, we use the ref-counted linked_ptr |
| 188 // which is similar to a shared_ptr. | 188 // which is similar to a shared_ptr. |
| 189 typedef linked_ptr<BackgroundModeData> BackgroundModeInfo; | 189 typedef linked_ptr<BackgroundModeData> BackgroundModeInfo; |
| 190 | 190 |
| 191 typedef std::map<Profile*, BackgroundModeInfo> BackgroundModeInfoMap; | 191 typedef std::map<Profile*, BackgroundModeInfo> BackgroundModeInfoMap; |
| 192 | 192 |
| 193 // content::NotificationObserver implementation. | 193 // content::NotificationObserver implementation. |
| 194 virtual void Observe(int type, | 194 virtual void Observe(int type, |
| 195 const content::NotificationSource& source, | 195 const content::NotificationSource& source, |
| 196 const content::NotificationDetails& details) OVERRIDE; | 196 const content::NotificationDetails& details) override; |
| 197 | 197 |
| 198 // Called when the kBackgroundModeEnabled preference changes. | 198 // Called when the kBackgroundModeEnabled preference changes. |
| 199 void OnBackgroundModeEnabledPrefChanged(); | 199 void OnBackgroundModeEnabledPrefChanged(); |
| 200 | 200 |
| 201 // BackgroundApplicationListModel::Observer implementation. | 201 // BackgroundApplicationListModel::Observer implementation. |
| 202 virtual void OnApplicationDataChanged(const extensions::Extension* extension, | 202 virtual void OnApplicationDataChanged(const extensions::Extension* extension, |
| 203 Profile* profile) OVERRIDE; | 203 Profile* profile) override; |
| 204 virtual void OnApplicationListChanged(Profile* profile) OVERRIDE; | 204 virtual void OnApplicationListChanged(Profile* profile) override; |
| 205 | 205 |
| 206 // Overrides from ProfileInfoCacheObserver | 206 // Overrides from ProfileInfoCacheObserver |
| 207 virtual void OnProfileAdded(const base::FilePath& profile_path) OVERRIDE; | 207 virtual void OnProfileAdded(const base::FilePath& profile_path) override; |
| 208 virtual void OnProfileWillBeRemoved( | 208 virtual void OnProfileWillBeRemoved( |
| 209 const base::FilePath& profile_path) OVERRIDE; | 209 const base::FilePath& profile_path) override; |
| 210 virtual void OnProfileNameChanged( | 210 virtual void OnProfileNameChanged( |
| 211 const base::FilePath& profile_path, | 211 const base::FilePath& profile_path, |
| 212 const base::string16& old_profile_name) OVERRIDE; | 212 const base::string16& old_profile_name) override; |
| 213 | 213 |
| 214 // Overrides from StatusIconMenuModel::Delegate implementation. | 214 // Overrides from StatusIconMenuModel::Delegate implementation. |
| 215 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; | 215 virtual void ExecuteCommand(int command_id, int event_flags) override; |
| 216 | 216 |
| 217 // chrome::BrowserListObserver implementation. | 217 // chrome::BrowserListObserver implementation. |
| 218 virtual void OnBrowserAdded(Browser* browser) OVERRIDE; | 218 virtual void OnBrowserAdded(Browser* browser) override; |
| 219 | 219 |
| 220 // Invoked when an extension is installed so we can ensure that | 220 // Invoked when an extension is installed so we can ensure that |
| 221 // launch-on-startup is enabled if appropriate. |extension| can be NULL when | 221 // launch-on-startup is enabled if appropriate. |extension| can be NULL when |
| 222 // called from unit tests. | 222 // called from unit tests. |
| 223 void OnBackgroundAppInstalled( | 223 void OnBackgroundAppInstalled( |
| 224 const extensions::Extension* extension); | 224 const extensions::Extension* extension); |
| 225 | 225 |
| 226 // Walk the list of profiles and see if an extension or app is being | 226 // Walk the list of profiles and see if an extension or app is being |
| 227 // currently upgraded or reloaded by any profile. If so, update the | 227 // currently upgraded or reloaded by any profile. If so, update the |
| 228 // output variables appropriately. | 228 // output variables appropriately. |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 // Set to true when background mode is suspended. | 357 // Set to true when background mode is suspended. |
| 358 bool background_mode_suspended_; | 358 bool background_mode_suspended_; |
| 359 | 359 |
| 360 // Set to true when background mode is keeping Chrome alive. | 360 // Set to true when background mode is keeping Chrome alive. |
| 361 bool keeping_alive_; | 361 bool keeping_alive_; |
| 362 | 362 |
| 363 DISALLOW_COPY_AND_ASSIGN(BackgroundModeManager); | 363 DISALLOW_COPY_AND_ASSIGN(BackgroundModeManager); |
| 364 }; | 364 }; |
| 365 | 365 |
| 366 #endif // CHROME_BROWSER_BACKGROUND_BACKGROUND_MODE_MANAGER_H_ | 366 #endif // CHROME_BROWSER_BACKGROUND_BACKGROUND_MODE_MANAGER_H_ |
| OLD | NEW |