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

Side by Side Diff: chrome/browser/background/background_mode_manager.h

Issue 648653003: Standardize usage of virtual/override/final in chrome/browser/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 unified diff | Download patch
OLDNEW
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // background. 49 // background.
50 class BackgroundModeManager 50 class BackgroundModeManager
51 : public content::NotificationObserver, 51 : public content::NotificationObserver,
52 public chrome::BrowserListObserver, 52 public chrome::BrowserListObserver,
53 public BackgroundApplicationListModel::Observer, 53 public BackgroundApplicationListModel::Observer,
54 public ProfileInfoCacheObserver, 54 public ProfileInfoCacheObserver,
55 public StatusIconMenuModel::Delegate { 55 public StatusIconMenuModel::Delegate {
56 public: 56 public:
57 BackgroundModeManager(base::CommandLine* command_line, 57 BackgroundModeManager(base::CommandLine* command_line,
58 ProfileInfoCache* profile_cache); 58 ProfileInfoCache* profile_cache);
59 virtual ~BackgroundModeManager(); 59 ~BackgroundModeManager() override;
60 60
61 static void RegisterPrefs(PrefRegistrySimple* registry); 61 static void RegisterPrefs(PrefRegistrySimple* registry);
62 62
63 virtual void RegisterProfile(Profile* profile); 63 virtual void RegisterProfile(Profile* profile);
64 64
65 static void LaunchBackgroundApplication(Profile* profile, 65 static void LaunchBackgroundApplication(Profile* profile,
66 const extensions::Extension* extension); 66 const extensions::Extension* extension);
67 67
68 // Returns true if background mode is active. 68 // Returns true if background mode is active.
69 virtual bool IsBackgroundModeActive(); 69 virtual bool IsBackgroundModeActive();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 FRIEND_TEST_ALL_PREFIXES(BackgroundModeManagerWithExtensionsTest, 112 FRIEND_TEST_ALL_PREFIXES(BackgroundModeManagerWithExtensionsTest,
113 BalloonDisplay); 113 BalloonDisplay);
114 FRIEND_TEST_ALL_PREFIXES(BackgroundAppBrowserTest, 114 FRIEND_TEST_ALL_PREFIXES(BackgroundAppBrowserTest,
115 ReloadBackgroundApp); 115 ReloadBackgroundApp);
116 116
117 class BackgroundModeData : public StatusIconMenuModel::Delegate { 117 class BackgroundModeData : public StatusIconMenuModel::Delegate {
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 ~BackgroundModeData() override;
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 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 // Similarly, we can't just have a map of BackgroundModeData objects, 184 // Similarly, we can't just have a map of BackgroundModeData objects,
185 // since BackgroundModeData contains a scoped_ptr which once again 185 // since BackgroundModeData contains a scoped_ptr which once again
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 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 void OnApplicationDataChanged(const extensions::Extension* extension,
203 Profile* profile) override; 203 Profile* profile) override;
204 virtual void OnApplicationListChanged(Profile* profile) override; 204 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 void OnProfileAdded(const base::FilePath& profile_path) override;
208 virtual void OnProfileWillBeRemoved( 208 void OnProfileWillBeRemoved(const base::FilePath& profile_path) override;
209 const base::FilePath& profile_path) override; 209 void OnProfileNameChanged(const base::FilePath& profile_path,
210 virtual void OnProfileNameChanged( 210 const base::string16& old_profile_name) override;
211 const base::FilePath& profile_path,
212 const base::string16& old_profile_name) override;
213 211
214 // Overrides from StatusIconMenuModel::Delegate implementation. 212 // Overrides from StatusIconMenuModel::Delegate implementation.
215 virtual void ExecuteCommand(int command_id, int event_flags) override; 213 void ExecuteCommand(int command_id, int event_flags) override;
216 214
217 // chrome::BrowserListObserver implementation. 215 // chrome::BrowserListObserver implementation.
218 virtual void OnBrowserAdded(Browser* browser) override; 216 void OnBrowserAdded(Browser* browser) override;
219 217
220 // Invoked when an extension is installed so we can ensure that 218 // Invoked when an extension is installed so we can ensure that
221 // launch-on-startup is enabled if appropriate. |extension| can be NULL when 219 // launch-on-startup is enabled if appropriate. |extension| can be NULL when
222 // called from unit tests. 220 // called from unit tests.
223 void OnBackgroundAppInstalled( 221 void OnBackgroundAppInstalled(
224 const extensions::Extension* extension); 222 const extensions::Extension* extension);
225 223
226 // Walk the list of profiles and see if an extension or app is being 224 // 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 225 // currently upgraded or reloaded by any profile. If so, update the
228 // output variables appropriately. 226 // output variables appropriately.
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 // Set to true when background mode is suspended. 355 // Set to true when background mode is suspended.
358 bool background_mode_suspended_; 356 bool background_mode_suspended_;
359 357
360 // Set to true when background mode is keeping Chrome alive. 358 // Set to true when background mode is keeping Chrome alive.
361 bool keeping_alive_; 359 bool keeping_alive_;
362 360
363 DISALLOW_COPY_AND_ASSIGN(BackgroundModeManager); 361 DISALLOW_COPY_AND_ASSIGN(BackgroundModeManager);
364 }; 362 };
365 363
366 #endif // CHROME_BROWSER_BACKGROUND_BACKGROUND_MODE_MANAGER_H_ 364 #endif // CHROME_BROWSER_BACKGROUND_BACKGROUND_MODE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698