| 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 "components/rappor/rappor_utils.h" | 9 #include "components/rappor/rappor_utils.h" |
| 10 | 10 |
| 11 #if defined(OS_ANDROID) |
| 12 #include "chrome/browser/android/background_sync_launcher_android.h" |
| 13 #endif |
| 14 |
| 11 BackgroundSyncControllerImpl::BackgroundSyncControllerImpl(Profile* profile) | 15 BackgroundSyncControllerImpl::BackgroundSyncControllerImpl(Profile* profile) |
| 12 : profile_(profile) {} | 16 : profile_(profile) {} |
| 13 | 17 |
| 14 BackgroundSyncControllerImpl::~BackgroundSyncControllerImpl() = default; | 18 BackgroundSyncControllerImpl::~BackgroundSyncControllerImpl() = default; |
| 15 | 19 |
| 16 rappor::RapporService* BackgroundSyncControllerImpl::GetRapporService() { | 20 rappor::RapporService* BackgroundSyncControllerImpl::GetRapporService() { |
| 17 return g_browser_process->rappor_service(); | 21 return g_browser_process->rappor_service(); |
| 18 } | 22 } |
| 19 | 23 |
| 20 void BackgroundSyncControllerImpl::NotifyBackgroundSyncRegistered( | 24 void BackgroundSyncControllerImpl::NotifyBackgroundSyncRegistered( |
| 21 const GURL& origin) { | 25 const GURL& origin) { |
| 22 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 26 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 23 DCHECK_EQ(origin, origin.GetOrigin()); | 27 DCHECK_EQ(origin, origin.GetOrigin()); |
| 24 | 28 |
| 25 if (profile_->IsOffTheRecord()) | 29 if (profile_->IsOffTheRecord()) |
| 26 return; | 30 return; |
| 27 | 31 |
| 28 rappor::SampleDomainAndRegistryFromGURL( | 32 rappor::SampleDomainAndRegistryFromGURL( |
| 29 GetRapporService(), "BackgroundSync.Register.Origin", origin); | 33 GetRapporService(), "BackgroundSync.Register.Origin", origin); |
| 30 } | 34 } |
| 35 |
| 36 #if defined(OS_ANDROID) |
| 37 void BackgroundSyncControllerImpl::LaunchBrowserWhenNextOnline( |
| 38 const content::BackgroundSyncManager* registrant, |
| 39 bool launch_when_next_online) { |
| 40 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 41 BackgroundSyncLauncherAndroid::LaunchBrowserWhenNextOnline( |
| 42 registrant, launch_when_next_online); |
| 43 } |
| 44 #endif |
| OLD | NEW |