privet_notifications_factory.cc revision d0247b1b59f9c528cb6df88b4f2b9afaf80d181e
1// Copyright 2013 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#include "chrome/browser/local_discovery/privet_notifications_factory.h" 6 7#include "base/command_line.h" 8#include "chrome/browser/browser_process.h" 9#include "chrome/browser/local_discovery/privet_notifications.h" 10#include "chrome/common/chrome_switches.h" 11#include "components/browser_context_keyed_service/browser_context_dependency_manager.h" 12 13namespace local_discovery { 14 15PrivetNotificationServiceFactory* 16PrivetNotificationServiceFactory::GetInstance() { 17 return Singleton<PrivetNotificationServiceFactory>::get(); 18} 19 20PrivetNotificationServiceFactory::PrivetNotificationServiceFactory() 21 : BrowserContextKeyedServiceFactory( 22 "PrivetNotificationService", 23 BrowserContextDependencyManager::GetInstance()) { 24} 25 26PrivetNotificationServiceFactory::~PrivetNotificationServiceFactory() { 27} 28 29BrowserContextKeyedService* 30PrivetNotificationServiceFactory::BuildServiceInstanceFor( 31 content::BrowserContext* profile) const { 32 return new PrivetNotificationService(profile); 33} 34 35bool 36PrivetNotificationServiceFactory::ServiceIsCreatedWithBrowserContext() const { 37 CommandLine* command_line = CommandLine::ForCurrentProcess(); 38 using switches::kDisableDeviceDiscovery; 39 using switches::kDisableDeviceDiscoveryNotifications; 40 return !command_line->HasSwitch(kDisableDeviceDiscovery) && 41 !command_line->HasSwitch(kDisableDeviceDiscoveryNotifications); 42} 43 44bool PrivetNotificationServiceFactory::ServiceIsNULLWhileTesting() const { 45 return true; 46} 47 48} // namespace local_discovery 49