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/lifetime/application_lifetime.h" | 20 #include "chrome/browser/lifetime/application_lifetime.h" |
21 #include "chrome/browser/prefs/pref_service.h" | 21 #include "chrome/browser/prefs/pref_service.h" |
22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/profiles/profile_info_cache.h" | 23 #include "chrome/browser/profiles/profile_info_cache.h" |
24 #include "chrome/browser/profiles/profile_manager.h" | 24 #include "chrome/browser/profiles/profile_manager.h" |
25 #include "chrome/browser/status_icons/status_icon.h" | 25 #include "chrome/browser/status_icons/status_icon.h" |
26 #include "chrome/browser/status_icons/status_tray.h" | 26 #include "chrome/browser/status_icons/status_tray.h" |
27 #include "chrome/browser/ui/browser.h" | 27 #include "chrome/browser/ui/browser.h" |
28 #include "chrome/browser/ui/browser_finder.h" | 28 #include "chrome/browser/ui/browser_finder.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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 } | 259 } |
259 | 260 |
260 // static | 261 // static |
261 void BackgroundModeManager::LaunchBackgroundApplication( | 262 void BackgroundModeManager::LaunchBackgroundApplication( |
262 Profile* profile, | 263 Profile* profile, |
263 const Extension* extension) { | 264 const Extension* extension) { |
264 ExtensionService* service = profile->GetExtensionService(); | 265 ExtensionService* service = profile->GetExtensionService(); |
265 extension_misc::LaunchContainer launch_container = | 266 extension_misc::LaunchContainer launch_container = |
266 service->extension_prefs()->GetLaunchContainer( | 267 service->extension_prefs()->GetLaunchContainer( |
267 extension, ExtensionPrefs::LAUNCH_REGULAR); | 268 extension, ExtensionPrefs::LAUNCH_REGULAR); |
268 Browser::OpenApplication(profile, extension, launch_container, GURL(), | 269 application_launch::OpenApplication(profile, extension, launch_container, |
269 NEW_FOREGROUND_TAB); | 270 GURL(), NEW_FOREGROUND_TAB); |
270 } | 271 } |
271 | 272 |
272 bool BackgroundModeManager::IsBackgroundModeActiveForTest() { | 273 bool BackgroundModeManager::IsBackgroundModeActiveForTest() { |
273 return in_background_mode_; | 274 return in_background_mode_; |
274 } | 275 } |
275 | 276 |
276 int BackgroundModeManager::NumberOfBackgroundModeData() { | 277 int BackgroundModeManager::NumberOfBackgroundModeData() { |
277 return background_mode_data_.size(); | 278 return background_mode_data_.size(); |
278 } | 279 } |
279 | 280 |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 } | 768 } |
768 } | 769 } |
769 return profile_it; | 770 return profile_it; |
770 } | 771 } |
771 | 772 |
772 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { | 773 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { |
773 PrefService* service = g_browser_process->local_state(); | 774 PrefService* service = g_browser_process->local_state(); |
774 DCHECK(service); | 775 DCHECK(service); |
775 return service->GetBoolean(prefs::kBackgroundModeEnabled); | 776 return service->GetBoolean(prefs::kBackgroundModeEnabled); |
776 } | 777 } |
OLD | NEW |