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" | 26 #include "chrome/browser/ui/browser.h" |
27 #include "chrome/browser/ui/browser_finder.h" | 27 #include "chrome/browser/ui/browser_finder.h" |
28 #include "chrome/browser/ui/browser_list.h" | 28 #include "chrome/browser/ui/browser_list.h" |
| 29 #include "chrome/browser/ui/extensions/application_launch.h" |
29 #include "chrome/common/chrome_constants.h" | 30 #include "chrome/common/chrome_constants.h" |
30 #include "chrome/common/chrome_notification_types.h" | 31 #include "chrome/common/chrome_notification_types.h" |
31 #include "chrome/common/chrome_switches.h" | 32 #include "chrome/common/chrome_switches.h" |
32 #include "chrome/common/extensions/extension.h" | 33 #include "chrome/common/extensions/extension.h" |
33 #include "chrome/common/extensions/extension_constants.h" | 34 #include "chrome/common/extensions/extension_constants.h" |
34 #include "chrome/common/pref_names.h" | 35 #include "chrome/common/pref_names.h" |
35 #include "content/public/browser/notification_service.h" | 36 #include "content/public/browser/notification_service.h" |
36 #include "content/public/browser/notification_types.h" | 37 #include "content/public/browser/notification_types.h" |
37 #include "content/public/browser/user_metrics.h" | 38 #include "content/public/browser/user_metrics.h" |
38 #include "grit/chromium_strings.h" | 39 #include "grit/chromium_strings.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 } | 255 } |
255 | 256 |
256 // static | 257 // static |
257 void BackgroundModeManager::LaunchBackgroundApplication( | 258 void BackgroundModeManager::LaunchBackgroundApplication( |
258 Profile* profile, | 259 Profile* profile, |
259 const Extension* extension) { | 260 const Extension* extension) { |
260 ExtensionService* service = profile->GetExtensionService(); | 261 ExtensionService* service = profile->GetExtensionService(); |
261 extension_misc::LaunchContainer launch_container = | 262 extension_misc::LaunchContainer launch_container = |
262 service->extension_prefs()->GetLaunchContainer( | 263 service->extension_prefs()->GetLaunchContainer( |
263 extension, ExtensionPrefs::LAUNCH_REGULAR); | 264 extension, ExtensionPrefs::LAUNCH_REGULAR); |
264 Browser::OpenApplication(profile, extension, launch_container, GURL(), | 265 ApplicationLaunch::OpenApplication(profile, extension, launch_container, |
265 NEW_FOREGROUND_TAB); | 266 GURL(), NEW_FOREGROUND_TAB); |
266 } | 267 } |
267 | 268 |
268 bool BackgroundModeManager::IsBackgroundModeActiveForTest() { | 269 bool BackgroundModeManager::IsBackgroundModeActiveForTest() { |
269 return in_background_mode_; | 270 return in_background_mode_; |
270 } | 271 } |
271 | 272 |
272 int BackgroundModeManager::NumberOfBackgroundModeData() { | 273 int BackgroundModeManager::NumberOfBackgroundModeData() { |
273 return background_mode_data_.size(); | 274 return background_mode_data_.size(); |
274 } | 275 } |
275 | 276 |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 } | 764 } |
764 } | 765 } |
765 return profile_it; | 766 return profile_it; |
766 } | 767 } |
767 | 768 |
768 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { | 769 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { |
769 PrefService* service = g_browser_process->local_state(); | 770 PrefService* service = g_browser_process->local_state(); |
770 DCHECK(service); | 771 DCHECK(service); |
771 return service->GetBoolean(prefs::kBackgroundModeEnabled); | 772 return service->GetBoolean(prefs::kBackgroundModeEnabled); |
772 } | 773 } |
OLD | NEW |