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 "chrome/browser/background/background_mode_manager.h" | 5 #include "chrome/browser/background/background_mode_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/base_paths.h" | 13 #include "base/base_paths.h" |
14 #include "base/bind.h" | 14 #include "base/bind.h" |
15 #include "base/callback.h" | 15 #include "base/callback.h" |
16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
17 #include "base/location.h" | 17 #include "base/location.h" |
18 #include "base/logging.h" | 18 #include "base/logging.h" |
19 #include "base/metrics/histogram_macros.h" | 19 #include "base/metrics/histogram_macros.h" |
| 20 #include "base/metrics/user_metrics.h" |
20 #include "base/single_thread_task_runner.h" | 21 #include "base/single_thread_task_runner.h" |
21 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
22 #include "base/threading/thread_task_runner_handle.h" | 23 #include "base/threading/thread_task_runner_handle.h" |
23 #include "build/build_config.h" | 24 #include "build/build_config.h" |
24 #include "chrome/app/chrome_command_ids.h" | 25 #include "chrome/app/chrome_command_ids.h" |
25 #include "chrome/browser/background/background_application_list_model.h" | 26 #include "chrome/browser/background/background_application_list_model.h" |
26 #include "chrome/browser/background/background_mode_optimizer.h" | 27 #include "chrome/browser/background/background_mode_optimizer.h" |
27 #include "chrome/browser/background/background_trigger.h" | 28 #include "chrome/browser/background/background_trigger.h" |
28 #include "chrome/browser/browser_process.h" | 29 #include "chrome/browser/browser_process.h" |
29 #include "chrome/browser/browser_shutdown.h" | 30 #include "chrome/browser/browser_shutdown.h" |
(...skipping 19 matching lines...) Expand all Loading... |
49 #include "chrome/common/chrome_constants.h" | 50 #include "chrome/common/chrome_constants.h" |
50 #include "chrome/common/chrome_switches.h" | 51 #include "chrome/common/chrome_switches.h" |
51 #include "chrome/common/extensions/extension_constants.h" | 52 #include "chrome/common/extensions/extension_constants.h" |
52 #include "chrome/common/pref_names.h" | 53 #include "chrome/common/pref_names.h" |
53 #include "chrome/grit/chrome_unscaled_resources.h" | 54 #include "chrome/grit/chrome_unscaled_resources.h" |
54 #include "chrome/grit/chromium_strings.h" | 55 #include "chrome/grit/chromium_strings.h" |
55 #include "chrome/grit/generated_resources.h" | 56 #include "chrome/grit/generated_resources.h" |
56 #include "components/prefs/pref_registry_simple.h" | 57 #include "components/prefs/pref_registry_simple.h" |
57 #include "components/prefs/pref_service.h" | 58 #include "components/prefs/pref_service.h" |
58 #include "content/public/browser/notification_service.h" | 59 #include "content/public/browser/notification_service.h" |
59 #include "content/public/browser/user_metrics.h" | |
60 #include "extensions/browser/extension_system.h" | 60 #include "extensions/browser/extension_system.h" |
61 #include "extensions/common/constants.h" | 61 #include "extensions/common/constants.h" |
62 #include "extensions/common/extension.h" | 62 #include "extensions/common/extension.h" |
63 #include "extensions/common/manifest_handlers/options_page_info.h" | 63 #include "extensions/common/manifest_handlers/options_page_info.h" |
64 #include "extensions/common/one_shot_event.h" | 64 #include "extensions/common/one_shot_event.h" |
65 #include "extensions/common/permissions/permission_set.h" | 65 #include "extensions/common/permissions/permission_set.h" |
66 #include "ui/base/l10n/l10n_util.h" | 66 #include "ui/base/l10n/l10n_util.h" |
67 #include "ui/base/resource/resource_bundle.h" | 67 #include "ui/base/resource/resource_bundle.h" |
68 | 68 |
69 #if defined(OS_WIN) | 69 #if defined(OS_WIN) |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 if (bmd) { | 651 if (bmd) { |
652 chrome::OpenTaskManager(bmd->GetBrowserWindow()); | 652 chrome::OpenTaskManager(bmd->GetBrowserWindow()); |
653 } else { | 653 } else { |
654 UserManager::Show(base::FilePath(), | 654 UserManager::Show(base::FilePath(), |
655 profiles::USER_MANAGER_NO_TUTORIAL, | 655 profiles::USER_MANAGER_NO_TUTORIAL, |
656 profiles::USER_MANAGER_SELECT_PROFILE_TASK_MANAGER); | 656 profiles::USER_MANAGER_SELECT_PROFILE_TASK_MANAGER); |
657 } | 657 } |
658 break; | 658 break; |
659 case IDC_EXIT: | 659 case IDC_EXIT: |
660 RecordMenuItemClick(MENU_ITEM_EXIT); | 660 RecordMenuItemClick(MENU_ITEM_EXIT); |
661 content::RecordAction(UserMetricsAction("Exit")); | 661 base::RecordAction(UserMetricsAction("Exit")); |
662 chrome::CloseAllBrowsers(); | 662 chrome::CloseAllBrowsers(); |
663 break; | 663 break; |
664 case IDC_STATUS_TRAY_KEEP_CHROME_RUNNING_IN_BACKGROUND: { | 664 case IDC_STATUS_TRAY_KEEP_CHROME_RUNNING_IN_BACKGROUND: { |
665 // Background mode must already be enabled (as otherwise this menu would | 665 // Background mode must already be enabled (as otherwise this menu would |
666 // not be visible). | 666 // not be visible). |
667 DCHECK(IsBackgroundModePrefEnabled()); | 667 DCHECK(IsBackgroundModePrefEnabled()); |
668 DCHECK(KeepAliveRegistry::GetInstance()->IsKeepingAlive()); | 668 DCHECK(KeepAliveRegistry::GetInstance()->IsKeepingAlive()); |
669 | 669 |
670 RecordMenuItemClick(MENU_ITEM_KEEP_RUNNING); | 670 RecordMenuItemClick(MENU_ITEM_KEEP_RUNNING); |
671 | 671 |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1047 } | 1047 } |
1048 } | 1048 } |
1049 return profile_it; | 1049 return profile_it; |
1050 } | 1050 } |
1051 | 1051 |
1052 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { | 1052 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { |
1053 PrefService* service = g_browser_process->local_state(); | 1053 PrefService* service = g_browser_process->local_state(); |
1054 DCHECK(service); | 1054 DCHECK(service); |
1055 return service->GetBoolean(prefs::kBackgroundModeEnabled); | 1055 return service->GetBoolean(prefs::kBackgroundModeEnabled); |
1056 } | 1056 } |
OLD | NEW |