| 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" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "chrome/app/chrome_command_ids.h" | 14 #include "chrome/app/chrome_command_ids.h" |
| 15 #include "chrome/browser/background/background_application_list_model.h" | 15 #include "chrome/browser/background/background_application_list_model.h" |
| 16 #include "chrome/browser/background/background_mode_manager.h" | 16 #include "chrome/browser/background/background_mode_manager.h" |
| 17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
| 18 #include "chrome/browser/browser_shutdown.h" | 18 #include "chrome/browser/browser_shutdown.h" |
| 19 #include "chrome/browser/extensions/extension_service.h" | 19 #include "chrome/browser/extensions/extension_service.h" |
| 20 #include "chrome/browser/prefs/pref_service.h" | 20 #include "chrome/browser/prefs/pref_service.h" |
| 21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 22 #include "chrome/browser/profiles/profile_info_cache.h" | 22 #include "chrome/browser/profiles/profile_info_cache.h" |
| 23 #include "chrome/browser/profiles/profile_manager.h" | 23 #include "chrome/browser/profiles/profile_manager.h" |
| 24 #include "chrome/browser/status_icons/status_icon.h" | 24 #include "chrome/browser/status_icons/status_icon.h" |
| 25 #include "chrome/browser/status_icons/status_tray.h" | 25 #include "chrome/browser/status_icons/status_tray.h" |
| 26 #include "chrome/browser/ui/browser.h" |
| 27 #include "chrome/browser/ui/browser_finder.h" |
| 26 #include "chrome/browser/ui/browser_list.h" | 28 #include "chrome/browser/ui/browser_list.h" |
| 27 #include "chrome/common/chrome_constants.h" | 29 #include "chrome/common/chrome_constants.h" |
| 28 #include "chrome/common/chrome_notification_types.h" | 30 #include "chrome/common/chrome_notification_types.h" |
| 29 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
| 30 #include "chrome/common/extensions/extension.h" | 32 #include "chrome/common/extensions/extension.h" |
| 31 #include "chrome/common/extensions/extension_constants.h" | 33 #include "chrome/common/extensions/extension_constants.h" |
| 32 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
| 33 #include "content/public/browser/notification_service.h" | 35 #include "content/public/browser/notification_service.h" |
| 34 #include "content/public/browser/notification_types.h" | 36 #include "content/public/browser/notification_types.h" |
| 35 #include "content/public/browser/user_metrics.h" | 37 #include "content/public/browser/user_metrics.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 break; | 80 break; |
| 79 default: | 81 default: |
| 80 // Launch the app associated with this item. | 82 // Launch the app associated with this item. |
| 81 const Extension* extension = applications_->GetExtension(item); | 83 const Extension* extension = applications_->GetExtension(item); |
| 82 BackgroundModeManager::LaunchBackgroundApplication(profile_, extension); | 84 BackgroundModeManager::LaunchBackgroundApplication(profile_, extension); |
| 83 break; | 85 break; |
| 84 } | 86 } |
| 85 } | 87 } |
| 86 | 88 |
| 87 Browser* BackgroundModeManager::BackgroundModeData::GetBrowserWindow() { | 89 Browser* BackgroundModeManager::BackgroundModeData::GetBrowserWindow() { |
| 88 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); | 90 Browser* browser = browser::FindLastActiveWithProfile(profile_); |
| 89 if (!browser) { | 91 if (!browser) { |
| 90 Browser::OpenEmptyWindow(profile_); | 92 Browser::OpenEmptyWindow(profile_); |
| 91 browser = BrowserList::GetLastActiveWithProfile(profile_); | 93 browser = browser::FindLastActiveWithProfile(profile_); |
| 92 } | 94 } |
| 93 return browser; | 95 return browser; |
| 94 } | 96 } |
| 95 | 97 |
| 96 int BackgroundModeManager::BackgroundModeData::GetBackgroundAppCount() const { | 98 int BackgroundModeManager::BackgroundModeData::GetBackgroundAppCount() const { |
| 97 return applications_->size(); | 99 return applications_->size(); |
| 98 } | 100 } |
| 99 | 101 |
| 100 void BackgroundModeManager::BackgroundModeData::BuildProfileMenu( | 102 void BackgroundModeManager::BackgroundModeData::BuildProfileMenu( |
| 101 ui::SimpleMenuModel* menu, | 103 ui::SimpleMenuModel* menu, |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 } | 763 } |
| 762 } | 764 } |
| 763 return profile_it; | 765 return profile_it; |
| 764 } | 766 } |
| 765 | 767 |
| 766 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { | 768 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { |
| 767 PrefService* service = g_browser_process->local_state(); | 769 PrefService* service = g_browser_process->local_state(); |
| 768 DCHECK(service); | 770 DCHECK(service); |
| 769 return service->GetBoolean(prefs::kBackgroundModeEnabled); | 771 return service->GetBoolean(prefs::kBackgroundModeEnabled); |
| 770 } | 772 } |
| OLD | NEW |