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

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

Issue 6954001: Add "Keep chrome running in background" preference. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed formatting nits Created 9 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_MODE_MANAGER_H_ 5 #ifndef CHROME_BROWSER_BACKGROUND_MODE_MANAGER_H_
6 #define CHROME_BROWSER_BACKGROUND_MODE_MANAGER_H_ 6 #define CHROME_BROWSER_BACKGROUND_MODE_MANAGER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/gtest_prod_util.h" 9 #include "base/gtest_prod_util.h"
10 #include "chrome/browser/background_application_list_model.h" 10 #include "chrome/browser/background_application_list_model.h"
(...skipping 28 matching lines...) Expand all
39 // background. 39 // background.
40 class BackgroundModeManager 40 class BackgroundModeManager
41 : public NotificationObserver, 41 : public NotificationObserver,
42 public ui::SimpleMenuModel::Delegate, 42 public ui::SimpleMenuModel::Delegate,
43 public BackgroundApplicationListModel::Observer, 43 public BackgroundApplicationListModel::Observer,
44 public ProfileKeyedService { 44 public ProfileKeyedService {
45 public: 45 public:
46 BackgroundModeManager(Profile* profile, CommandLine* command_line); 46 BackgroundModeManager(Profile* profile, CommandLine* command_line);
47 virtual ~BackgroundModeManager(); 47 virtual ~BackgroundModeManager();
48 48
49 static bool IsBackgroundModeEnabled(const CommandLine* command_line);
50 static void RegisterPrefs(PrefService* prefs); 49 static void RegisterPrefs(PrefService* prefs);
51 50
52 private: 51 private:
53 friend class TestBackgroundModeManager; 52 friend class TestBackgroundModeManager;
54 friend class BackgroundModeManagerTest; 53 friend class BackgroundModeManagerTest;
55 FRIEND_TEST_ALL_PREFIXES(BackgroundModeManagerTest, 54 FRIEND_TEST_ALL_PREFIXES(BackgroundModeManagerTest,
56 BackgroundAppLoadUnload); 55 BackgroundAppLoadUnload);
57 FRIEND_TEST_ALL_PREFIXES(BackgroundModeManagerTest, 56 FRIEND_TEST_ALL_PREFIXES(BackgroundModeManagerTest,
58 BackgroundAppInstallUninstall); 57 BackgroundAppInstallUninstall);
59 FRIEND_TEST_ALL_PREFIXES(BackgroundModeManagerTest, 58 FRIEND_TEST_ALL_PREFIXES(BackgroundModeManagerTest,
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 // Create a context menu, or replace/update an existing context menu, for the 138 // Create a context menu, or replace/update an existing context menu, for the
140 // status tray icon which, among other things, allows the user to shutdown 139 // status tray icon which, among other things, allows the user to shutdown
141 // Chrome when running in background mode. 140 // Chrome when running in background mode.
142 virtual void UpdateStatusTrayIconContextMenu(); 141 virtual void UpdateStatusTrayIconContextMenu();
143 142
144 // Returns a browser window, or creates one if none are open. Used by 143 // Returns a browser window, or creates one if none are open. Used by
145 // operations (like displaying the preferences dialog) that require a Browser 144 // operations (like displaying the preferences dialog) that require a Browser
146 // window. 145 // window.
147 Browser* GetBrowserWindow(); 146 Browser* GetBrowserWindow();
148 147
148 // Returns true if the "Let chrome run in the background" pref is checked.
149 bool IsBackgroundModePrefEnabled();
150
151 // Turns off background mode if it's currently enabled.
152 void DisableBackgroundMode();
153
154 // Turns on background mode if it's currently disabled.
155 void EnableBackgroundMode();
156
157 // Returns true if background mode is permanently disabled for this chrome
158 // session.
159 static bool IsBackgroundModePermanentlyDisabled(
160 const CommandLine* command_line);
161
162 // Registrars for managing our change observers.
149 NotificationRegistrar registrar_; 163 NotificationRegistrar registrar_;
164 PrefChangeRegistrar pref_registrar_;
150 165
151 // The parent profile for this object. 166 // The parent profile for this object.
152 Profile* profile_; 167 Profile* profile_;
153 168
154 // The cached list of BackgroundApplications. 169 // The cached list of BackgroundApplications.
155 BackgroundApplicationListModel applications_; 170 BackgroundApplicationListModel applications_;
156 171
157 // The number of background apps currently loaded. 172 // The number of background apps currently loaded.
158 int background_app_count_; 173 int background_app_count_;
159 174
(...skipping 19 matching lines...) Expand all
179 // platform doesn't support status icons. 194 // platform doesn't support status icons.
180 StatusTray* status_tray_; 195 StatusTray* status_tray_;
181 196
182 // Reference to our status icon (if any) - owned by the StatusTray. 197 // Reference to our status icon (if any) - owned by the StatusTray.
183 StatusIcon* status_icon_; 198 StatusIcon* status_icon_;
184 199
185 DISALLOW_COPY_AND_ASSIGN(BackgroundModeManager); 200 DISALLOW_COPY_AND_ASSIGN(BackgroundModeManager);
186 }; 201 };
187 202
188 #endif // CHROME_BROWSER_BACKGROUND_MODE_MANAGER_H_ 203 #endif // CHROME_BROWSER_BACKGROUND_MODE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698