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 #include <algorithm> | 5 #include <algorithm> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 void BackgroundModeManager::ExecuteCommand(int command_id, int event_flags) { | 480 void BackgroundModeManager::ExecuteCommand(int command_id, int event_flags) { |
481 // When a browser window is necessary, we use the first profile. The windows | 481 // When a browser window is necessary, we use the first profile. The windows |
482 // opened for these commands are not profile-specific, so any profile would | 482 // opened for these commands are not profile-specific, so any profile would |
483 // work and the first is convenient. | 483 // work and the first is convenient. |
484 BackgroundModeData* bmd = background_mode_data_.begin()->second.get(); | 484 BackgroundModeData* bmd = background_mode_data_.begin()->second.get(); |
485 switch (command_id) { | 485 switch (command_id) { |
486 case IDC_ABOUT: | 486 case IDC_ABOUT: |
487 chrome::ShowAboutChrome(bmd->GetBrowserWindow()); | 487 chrome::ShowAboutChrome(bmd->GetBrowserWindow()); |
488 break; | 488 break; |
489 case IDC_TASK_MANAGER: | 489 case IDC_TASK_MANAGER: |
490 chrome::OpenTaskManager(bmd->GetBrowserWindow(), true); | 490 chrome::OpenTaskManager(bmd->GetBrowserWindow()); |
491 break; | 491 break; |
492 case IDC_EXIT: | 492 case IDC_EXIT: |
493 content::RecordAction(UserMetricsAction("Exit")); | 493 content::RecordAction(UserMetricsAction("Exit")); |
494 chrome::AttemptExit(); | 494 chrome::AttemptExit(); |
495 break; | 495 break; |
496 case IDC_STATUS_TRAY_KEEP_CHROME_RUNNING_IN_BACKGROUND: { | 496 case IDC_STATUS_TRAY_KEEP_CHROME_RUNNING_IN_BACKGROUND: { |
497 // Background mode must already be enabled (as otherwise this menu would | 497 // Background mode must already be enabled (as otherwise this menu would |
498 // not be visible). | 498 // not be visible). |
499 DCHECK(IsBackgroundModePrefEnabled()); | 499 DCHECK(IsBackgroundModePrefEnabled()); |
500 DCHECK(chrome::WillKeepAlive()); | 500 DCHECK(chrome::WillKeepAlive()); |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 } | 756 } |
757 } | 757 } |
758 return profile_it; | 758 return profile_it; |
759 } | 759 } |
760 | 760 |
761 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { | 761 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { |
762 PrefService* service = g_browser_process->local_state(); | 762 PrefService* service = g_browser_process->local_state(); |
763 DCHECK(service); | 763 DCHECK(service); |
764 return service->GetBoolean(prefs::kBackgroundModeEnabled); | 764 return service->GetBoolean(prefs::kBackgroundModeEnabled); |
765 } | 765 } |
OLD | NEW |