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.
5 #include "chrome/browser/feedback/feedback_uploader_factory.h"
7 #include "base/memory/singleton.h"
8 #include "chrome/browser/feedback/feedback_uploader.h"
9 #include "chrome/browser/feedback/feedback_uploader_chrome.h"
10 #include "chrome/browser/profiles/incognito_helpers.h"
11 #include "components/keyed_service/content/browser_context_dependency_manager.h"
16 FeedbackUploaderFactory
* FeedbackUploaderFactory::GetInstance() {
17 return Singleton
<FeedbackUploaderFactory
>::get();
21 FeedbackUploader
* FeedbackUploaderFactory::GetForBrowserContext(
22 content::BrowserContext
* context
) {
23 return static_cast<FeedbackUploaderChrome
*>(
24 GetInstance()->GetServiceForBrowserContext(context
, true));
27 FeedbackUploaderFactory::FeedbackUploaderFactory()
28 : BrowserContextKeyedServiceFactory(
29 "feedback::FeedbackUploader",
30 BrowserContextDependencyManager::GetInstance()) {}
32 FeedbackUploaderFactory::~FeedbackUploaderFactory() {}
34 KeyedService
* FeedbackUploaderFactory::BuildServiceInstanceFor(
35 content::BrowserContext
* context
) const {
36 return new FeedbackUploaderChrome(context
);
39 content::BrowserContext
* FeedbackUploaderFactory::GetBrowserContextToUse(
40 content::BrowserContext
* context
) const {
41 return chrome::GetBrowserContextOwnInstanceInIncognito(context
);
44 } // namespace feedback