| OLD | NEW |
| 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" |
| 11 #include "chrome/browser/prefs/pref_change_registrar.h" | 11 #include "chrome/browser/prefs/pref_change_registrar.h" |
| 12 #include "chrome/browser/profiles/profile_keyed_service.h" |
| 12 #include "chrome/browser/status_icons/status_icon.h" | 13 #include "chrome/browser/status_icons/status_icon.h" |
| 13 #include "content/common/notification_observer.h" | 14 #include "content/common/notification_observer.h" |
| 14 #include "content/common/notification_registrar.h" | 15 #include "content/common/notification_registrar.h" |
| 15 #include "ui/base/models/simple_menu_model.h" | 16 #include "ui/base/models/simple_menu_model.h" |
| 16 | 17 |
| 17 class Browser; | 18 class Browser; |
| 18 class CommandLine; | 19 class CommandLine; |
| 19 class Extension; | 20 class Extension; |
| 20 class PrefService; | 21 class PrefService; |
| 21 class Profile; | 22 class Profile; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 32 // mode at the appropriate time. | 33 // mode at the appropriate time. |
| 33 // | 34 // |
| 34 // When Chrome is in background mode, it will continue running even after the | 35 // When Chrome is in background mode, it will continue running even after the |
| 35 // last browser window is closed, until the user explicitly exits the app. | 36 // last browser window is closed, until the user explicitly exits the app. |
| 36 // Additionally, when in background mode, Chrome will launch on OS login with | 37 // Additionally, when in background mode, Chrome will launch on OS login with |
| 37 // no open windows to allow apps with the "background" permission to run in the | 38 // no open windows to allow apps with the "background" permission to run in the |
| 38 // background. | 39 // background. |
| 39 class BackgroundModeManager | 40 class BackgroundModeManager |
| 40 : public NotificationObserver, | 41 : public NotificationObserver, |
| 41 public ui::SimpleMenuModel::Delegate, | 42 public ui::SimpleMenuModel::Delegate, |
| 42 public BackgroundApplicationListModel::Observer { | 43 public BackgroundApplicationListModel::Observer, |
| 44 public ProfileKeyedService { |
| 43 public: | 45 public: |
| 44 BackgroundModeManager(Profile* profile, CommandLine* command_line); | 46 BackgroundModeManager(Profile* profile, CommandLine* command_line); |
| 45 virtual ~BackgroundModeManager(); | 47 virtual ~BackgroundModeManager(); |
| 46 | 48 |
| 47 static bool IsBackgroundModeEnabled(const CommandLine* command_line); | 49 static bool IsBackgroundModeEnabled(const CommandLine* command_line); |
| 48 | 50 |
| 49 private: | 51 private: |
| 50 friend class TestBackgroundModeManager; | 52 friend class TestBackgroundModeManager; |
| 51 friend class BackgroundModeManagerTest; | 53 friend class BackgroundModeManagerTest; |
| 52 FRIEND_TEST_ALL_PREFIXES(BackgroundModeManagerTest, | 54 FRIEND_TEST_ALL_PREFIXES(BackgroundModeManagerTest, |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 // platform doesn't support status icons. | 178 // platform doesn't support status icons. |
| 177 StatusTray* status_tray_; | 179 StatusTray* status_tray_; |
| 178 | 180 |
| 179 // Reference to our status icon (if any) - owned by the StatusTray. | 181 // Reference to our status icon (if any) - owned by the StatusTray. |
| 180 StatusIcon* status_icon_; | 182 StatusIcon* status_icon_; |
| 181 | 183 |
| 182 DISALLOW_COPY_AND_ASSIGN(BackgroundModeManager); | 184 DISALLOW_COPY_AND_ASSIGN(BackgroundModeManager); |
| 183 }; | 185 }; |
| 184 | 186 |
| 185 #endif // CHROME_BROWSER_BACKGROUND_MODE_MANAGER_H_ | 187 #endif // CHROME_BROWSER_BACKGROUND_MODE_MANAGER_H_ |
| OLD | NEW |