| 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 #include <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 BackgroundModeData* bmd = background_mode_data_.begin()->second.get(); | 389 BackgroundModeData* bmd = background_mode_data_.begin()->second.get(); |
| 390 switch (command_id) { | 390 switch (command_id) { |
| 391 case IDC_ABOUT: | 391 case IDC_ABOUT: |
| 392 bmd->GetBrowserWindow()->OpenAboutChromeDialog(); | 392 bmd->GetBrowserWindow()->OpenAboutChromeDialog(); |
| 393 break; | 393 break; |
| 394 case IDC_TASK_MANAGER: | 394 case IDC_TASK_MANAGER: |
| 395 bmd->GetBrowserWindow()->OpenTaskManager(true); | 395 bmd->GetBrowserWindow()->OpenTaskManager(true); |
| 396 break; | 396 break; |
| 397 case IDC_EXIT: | 397 case IDC_EXIT: |
| 398 UserMetrics::RecordAction(UserMetricsAction("Exit")); | 398 UserMetrics::RecordAction(UserMetricsAction("Exit")); |
| 399 BrowserList::AttemptExit(); | 399 BrowserList::AttemptExit(false); |
| 400 break; | 400 break; |
| 401 case IDC_STATUS_TRAY_KEEP_CHROME_RUNNING_IN_BACKGROUND: { | 401 case IDC_STATUS_TRAY_KEEP_CHROME_RUNNING_IN_BACKGROUND: { |
| 402 // Background mode must already be enabled (as otherwise this menu would | 402 // Background mode must already be enabled (as otherwise this menu would |
| 403 // not be visible). | 403 // not be visible). |
| 404 DCHECK(IsBackgroundModePrefEnabled()); | 404 DCHECK(IsBackgroundModePrefEnabled()); |
| 405 DCHECK(BrowserList::WillKeepAlive()); | 405 DCHECK(BrowserList::WillKeepAlive()); |
| 406 | 406 |
| 407 // Set the background mode pref to "disabled" - the resulting notification | 407 // Set the background mode pref to "disabled" - the resulting notification |
| 408 // will result in a call to DisableBackgroundMode(). | 408 // will result in a call to DisableBackgroundMode(). |
| 409 PrefService* service = g_browser_process->local_state(); | 409 PrefService* service = g_browser_process->local_state(); |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 command_line->HasSwitch(switches::kDisableExtensions); | 650 command_line->HasSwitch(switches::kDisableExtensions); |
| 651 return background_mode_disabled; | 651 return background_mode_disabled; |
| 652 #endif | 652 #endif |
| 653 } | 653 } |
| 654 | 654 |
| 655 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { | 655 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { |
| 656 PrefService* service = g_browser_process->local_state(); | 656 PrefService* service = g_browser_process->local_state(); |
| 657 DCHECK(service); | 657 DCHECK(service); |
| 658 return service->GetBoolean(prefs::kBackgroundModeEnabled); | 658 return service->GetBoolean(prefs::kBackgroundModeEnabled); |
| 659 } | 659 } |
| OLD | NEW |