| 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 // profile should be added to the status icon if one currently exists. | 393 // profile should be added to the status icon if one currently exists. |
| 394 if (in_background_mode_ && status_icon_) | 394 if (in_background_mode_ && status_icon_) |
| 395 UpdateStatusTrayIconContextMenu(); | 395 UpdateStatusTrayIconContextMenu(); |
| 396 } | 396 } |
| 397 | 397 |
| 398 // static | 398 // static |
| 399 void BackgroundModeManager::LaunchBackgroundApplication( | 399 void BackgroundModeManager::LaunchBackgroundApplication( |
| 400 Profile* profile, | 400 Profile* profile, |
| 401 const Extension* extension) { | 401 const Extension* extension) { |
| 402 OpenApplication(CreateAppLaunchParamsUserContainer( | 402 OpenApplication(CreateAppLaunchParamsUserContainer( |
| 403 profile, extension, NEW_FOREGROUND_TAB, extensions::SOURCE_BACKGROUND)); | 403 profile, extension, WindowOpenDisposition::NEW_FOREGROUND_TAB, |
| 404 extensions::SOURCE_BACKGROUND)); |
| 404 } | 405 } |
| 405 | 406 |
| 406 // static | 407 // static |
| 407 Browser* BackgroundModeManager::GetBrowserWindowForProfile(Profile* profile) { | 408 Browser* BackgroundModeManager::GetBrowserWindowForProfile(Profile* profile) { |
| 408 Browser* browser = chrome::FindLastActiveWithProfile(profile); | 409 Browser* browser = chrome::FindLastActiveWithProfile(profile); |
| 409 return browser ? browser : chrome::OpenEmptyWindow(profile); | 410 return browser ? browser : chrome::OpenEmptyWindow(profile); |
| 410 } | 411 } |
| 411 | 412 |
| 412 bool BackgroundModeManager::IsBackgroundModeActive() { | 413 bool BackgroundModeManager::IsBackgroundModeActive() { |
| 413 return in_background_mode_; | 414 return in_background_mode_; |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1046 } | 1047 } |
| 1047 } | 1048 } |
| 1048 return profile_it; | 1049 return profile_it; |
| 1049 } | 1050 } |
| 1050 | 1051 |
| 1051 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { | 1052 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { |
| 1052 PrefService* service = g_browser_process->local_state(); | 1053 PrefService* service = g_browser_process->local_state(); |
| 1053 DCHECK(service); | 1054 DCHECK(service); |
| 1054 return service->GetBoolean(prefs::kBackgroundModeEnabled); | 1055 return service->GetBoolean(prefs::kBackgroundModeEnabled); |
| 1055 } | 1056 } |
| OLD | NEW |