• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 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 "components/feedback/feedback_uploader_factory.h"
6 
7 #include "base/memory/singleton.h"
8 #include "components/feedback/feedback_uploader.h"
9 #include "components/feedback/feedback_uploader_chrome.h"
10 #include "components/keyed_service/content/browser_context_dependency_manager.h"
11 
12 namespace feedback {
13 
14 // static
GetInstance()15 FeedbackUploaderFactory* FeedbackUploaderFactory::GetInstance() {
16   return Singleton<FeedbackUploaderFactory>::get();
17 }
18 
19 // static
GetForBrowserContext(content::BrowserContext * context)20 FeedbackUploader* FeedbackUploaderFactory::GetForBrowserContext(
21     content::BrowserContext* context) {
22   return static_cast<FeedbackUploaderChrome*>(
23       GetInstance()->GetServiceForBrowserContext(context, true));
24 }
25 
FeedbackUploaderFactory()26 FeedbackUploaderFactory::FeedbackUploaderFactory()
27     : BrowserContextKeyedServiceFactory(
28           "feedback::FeedbackUploader",
29           BrowserContextDependencyManager::GetInstance()) {}
30 
~FeedbackUploaderFactory()31 FeedbackUploaderFactory::~FeedbackUploaderFactory() {}
32 
BuildServiceInstanceFor(content::BrowserContext * context) const33 KeyedService* FeedbackUploaderFactory::BuildServiceInstanceFor(
34     content::BrowserContext* context) const {
35   return new FeedbackUploaderChrome(context);
36 }
37 
GetBrowserContextToUse(content::BrowserContext * context) const38 content::BrowserContext* FeedbackUploaderFactory::GetBrowserContextToUse(
39     content::BrowserContext* context) const {
40   return context;
41 }
42 
43 }  // namespace feedback
44