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> |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 void BackgroundModeManager::LaunchBackgroundApplication( | 393 void BackgroundModeManager::LaunchBackgroundApplication( |
394 Profile* profile, | 394 Profile* profile, |
395 const Extension* extension) { | 395 const Extension* extension) { |
396 OpenApplication(AppLaunchParams(profile, extension, NEW_FOREGROUND_TAB, | 396 OpenApplication(AppLaunchParams(profile, extension, NEW_FOREGROUND_TAB, |
397 extensions::SOURCE_BACKGROUND)); | 397 extensions::SOURCE_BACKGROUND)); |
398 } | 398 } |
399 | 399 |
400 // static | 400 // static |
401 Browser* BackgroundModeManager::GetBrowserWindowForProfile(Profile* profile) { | 401 Browser* BackgroundModeManager::GetBrowserWindowForProfile(Profile* profile) { |
402 chrome::HostDesktopType host_desktop_type = chrome::GetActiveDesktop(); | 402 chrome::HostDesktopType host_desktop_type = chrome::GetActiveDesktop(); |
403 Browser* browser = | 403 Browser* browser = chrome::FindLastActiveWithProfile(profile); |
404 chrome::FindLastActiveWithProfile(profile, host_desktop_type); | |
405 return browser ? browser | 404 return browser ? browser |
406 : chrome::OpenEmptyWindow(profile, host_desktop_type); | 405 : chrome::OpenEmptyWindow(profile, host_desktop_type); |
407 } | 406 } |
408 | 407 |
409 bool BackgroundModeManager::IsBackgroundModeActive() { | 408 bool BackgroundModeManager::IsBackgroundModeActive() { |
410 return in_background_mode_; | 409 return in_background_mode_; |
411 } | 410 } |
412 | 411 |
413 int BackgroundModeManager::NumberOfBackgroundModeData() { | 412 int BackgroundModeManager::NumberOfBackgroundModeData() { |
414 return background_mode_data_.size(); | 413 return background_mode_data_.size(); |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1022 } | 1021 } |
1023 } | 1022 } |
1024 return profile_it; | 1023 return profile_it; |
1025 } | 1024 } |
1026 | 1025 |
1027 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { | 1026 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { |
1028 PrefService* service = g_browser_process->local_state(); | 1027 PrefService* service = g_browser_process->local_state(); |
1029 DCHECK(service); | 1028 DCHECK(service); |
1030 return service->GetBoolean(prefs::kBackgroundModeEnabled); | 1029 return service->GetBoolean(prefs::kBackgroundModeEnabled); |
1031 } | 1030 } |
OLD | NEW |