| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_sync/background_sync_controller_impl.h" | 5 #include "chrome/browser/background_sync/background_sync_controller_impl.h" |
| 6 | 6 |
| 7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/common/features.h" |
| 9 #include "components/rappor/rappor_utils.h" | 10 #include "components/rappor/rappor_utils.h" |
| 10 | 11 |
| 11 #if defined(OS_ANDROID) | 12 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 12 #include "chrome/browser/android/background_sync_launcher_android.h" | 13 #include "chrome/browser/android/background_sync_launcher_android.h" |
| 13 #endif | 14 #endif |
| 14 | 15 |
| 15 BackgroundSyncControllerImpl::BackgroundSyncControllerImpl(Profile* profile) | 16 BackgroundSyncControllerImpl::BackgroundSyncControllerImpl(Profile* profile) |
| 16 : profile_(profile) {} | 17 : profile_(profile) {} |
| 17 | 18 |
| 18 BackgroundSyncControllerImpl::~BackgroundSyncControllerImpl() = default; | 19 BackgroundSyncControllerImpl::~BackgroundSyncControllerImpl() = default; |
| 19 | 20 |
| 20 rappor::RapporService* BackgroundSyncControllerImpl::GetRapporService() { | 21 rappor::RapporService* BackgroundSyncControllerImpl::GetRapporService() { |
| 21 return g_browser_process->rappor_service(); | 22 return g_browser_process->rappor_service(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 32 rappor::SampleDomainAndRegistryFromGURL( | 33 rappor::SampleDomainAndRegistryFromGURL( |
| 33 GetRapporService(), "BackgroundSync.Register.Origin", origin); | 34 GetRapporService(), "BackgroundSync.Register.Origin", origin); |
| 34 } | 35 } |
| 35 | 36 |
| 36 void BackgroundSyncControllerImpl::RunInBackground(bool enabled, | 37 void BackgroundSyncControllerImpl::RunInBackground(bool enabled, |
| 37 int64_t min_ms) { | 38 int64_t min_ms) { |
| 38 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 39 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 39 | 40 |
| 40 if (profile_->IsOffTheRecord()) | 41 if (profile_->IsOffTheRecord()) |
| 41 return; | 42 return; |
| 42 #if defined(OS_ANDROID) | 43 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 43 BackgroundSyncLauncherAndroid::LaunchBrowserIfStopped(enabled, min_ms); | 44 BackgroundSyncLauncherAndroid::LaunchBrowserIfStopped(enabled, min_ms); |
| 44 #else | 45 #else |
| 45 // TODO(jkarlin): Use BackgroundModeManager to enter background mode. See | 46 // TODO(jkarlin): Use BackgroundModeManager to enter background mode. See |
| 46 // https://crbug.com/484201. | 47 // https://crbug.com/484201. |
| 47 #endif | 48 #endif |
| 48 } | 49 } |
| OLD | NEW |