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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 // static | 392 // static |
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(); | |
403 Browser* browser = chrome::FindLastActiveWithProfile(profile); | 402 Browser* browser = chrome::FindLastActiveWithProfile(profile); |
404 return browser ? browser | 403 return browser ? browser : chrome::OpenEmptyWindow(profile); |
405 : chrome::OpenEmptyWindow(profile, host_desktop_type); | |
406 } | 404 } |
407 | 405 |
408 bool BackgroundModeManager::IsBackgroundModeActive() { | 406 bool BackgroundModeManager::IsBackgroundModeActive() { |
409 return in_background_mode_; | 407 return in_background_mode_; |
410 } | 408 } |
411 | 409 |
412 int BackgroundModeManager::NumberOfBackgroundModeData() { | 410 int BackgroundModeManager::NumberOfBackgroundModeData() { |
413 return background_mode_data_.size(); | 411 return background_mode_data_.size(); |
414 } | 412 } |
415 | 413 |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1021 } | 1019 } |
1022 } | 1020 } |
1023 return profile_it; | 1021 return profile_it; |
1024 } | 1022 } |
1025 | 1023 |
1026 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { | 1024 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { |
1027 PrefService* service = g_browser_process->local_state(); | 1025 PrefService* service = g_browser_process->local_state(); |
1028 DCHECK(service); | 1026 DCHECK(service); |
1029 return service->GetBoolean(prefs::kBackgroundModeEnabled); | 1027 return service->GetBoolean(prefs::kBackgroundModeEnabled); |
1030 } | 1028 } |
OLD | NEW |