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/extensions/api/feedback_private/feedback_service.h"
7 #include "base/callback.h"
8 #include "base/memory/weak_ptr.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/profiles/profile_manager.h"
11 #include "chrome/browser/signin/signin_manager_factory.h"
12 #include "components/signin/core/browser/signin_manager.h"
14 namespace extensions
{
16 class FeedbackServiceImpl
17 : public FeedbackService
,
18 public base::SupportsWeakPtr
<FeedbackServiceImpl
> {
20 FeedbackServiceImpl();
21 virtual ~FeedbackServiceImpl();
23 virtual std::string
GetUserEmail() OVERRIDE
;
24 virtual void GetHistograms(std::string
* histograms
) OVERRIDE
;
27 // Overridden from FeedbackService:
28 virtual base::WeakPtr
<FeedbackService
> GetWeakPtr() OVERRIDE
;
30 DISALLOW_COPY_AND_ASSIGN(FeedbackServiceImpl
);
33 FeedbackService
* FeedbackService::CreateInstance() {
34 return new FeedbackServiceImpl
;
37 FeedbackServiceImpl::FeedbackServiceImpl() {
40 FeedbackServiceImpl::~FeedbackServiceImpl() {
43 std::string
FeedbackServiceImpl::GetUserEmail() {
44 Profile
* profile
= ProfileManager::GetLastUsedProfile();
48 SigninManager
* signin
= SigninManagerFactory::GetForProfile(profile
);
52 return signin
->GetAuthenticatedUsername();
55 void FeedbackServiceImpl::GetHistograms(std::string
* histograms
) {
58 base::WeakPtr
<FeedbackService
> FeedbackServiceImpl::GetWeakPtr() {
62 } // namespace extensions