| 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 | |
| 9 #include <algorithm> | 8 #include <algorithm> |
| 10 #include <string> | 9 #include <string> |
| 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.h" | 19 #include "base/metrics/histogram.h" |
| 20 #include "base/prefs/pref_registry_simple.h" | 20 #include "base/prefs/pref_registry_simple.h" |
| (...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 PrefService* service = g_browser_process->local_state(); | 981 PrefService* service = g_browser_process->local_state(); |
| 982 DCHECK(service); | 982 DCHECK(service); |
| 983 bool enabled = | 983 bool enabled = |
| 984 service->IsUserModifiablePreference(prefs::kBackgroundModeEnabled); | 984 service->IsUserModifiablePreference(prefs::kBackgroundModeEnabled); |
| 985 menu->SetCommandIdEnabled(IDC_STATUS_TRAY_KEEP_CHROME_RUNNING_IN_BACKGROUND, | 985 menu->SetCommandIdEnabled(IDC_STATUS_TRAY_KEEP_CHROME_RUNNING_IN_BACKGROUND, |
| 986 enabled); | 986 enabled); |
| 987 | 987 |
| 988 menu->AddItemWithStringId(IDC_EXIT, IDS_EXIT); | 988 menu->AddItemWithStringId(IDC_EXIT, IDS_EXIT); |
| 989 | 989 |
| 990 context_menu_ = menu.get(); | 990 context_menu_ = menu.get(); |
| 991 status_icon_->SetContextMenu(menu.Pass()); | 991 status_icon_->SetContextMenu(std::move(menu)); |
| 992 } | 992 } |
| 993 | 993 |
| 994 void BackgroundModeManager::RemoveStatusTrayIcon() { | 994 void BackgroundModeManager::RemoveStatusTrayIcon() { |
| 995 if (status_icon_) | 995 if (status_icon_) |
| 996 status_tray_->RemoveStatusIcon(status_icon_); | 996 status_tray_->RemoveStatusIcon(status_icon_); |
| 997 status_icon_ = NULL; | 997 status_icon_ = NULL; |
| 998 context_menu_ = NULL; | 998 context_menu_ = NULL; |
| 999 } | 999 } |
| 1000 | 1000 |
| 1001 BackgroundModeManager::BackgroundModeData* | 1001 BackgroundModeManager::BackgroundModeData* |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1022 } | 1022 } |
| 1023 } | 1023 } |
| 1024 return profile_it; | 1024 return profile_it; |
| 1025 } | 1025 } |
| 1026 | 1026 |
| 1027 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { | 1027 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { |
| 1028 PrefService* service = g_browser_process->local_state(); | 1028 PrefService* service = g_browser_process->local_state(); |
| 1029 DCHECK(service); | 1029 DCHECK(service); |
| 1030 return service->GetBoolean(prefs::kBackgroundModeEnabled); | 1030 return service->GetBoolean(prefs::kBackgroundModeEnabled); |
| 1031 } | 1031 } |
| OLD | NEW |