[Metrics] Make MetricsStateManager take a callback param to check if UMA is enabled.
[chromium-blink-merge.git] / chrome / browser / feedback / feedback_profile_observer.h
blobbde27ff3fa5199d6158cb95a1e0634e7763c39c4
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.
5 #ifndef CHROME_BROWSER_FEEDBACK_FEEDBACK_PROFILE_OBSERVER_H_
6 #define CHROME_BROWSER_FEEDBACK_FEEDBACK_PROFILE_OBSERVER_H_
8 #include "base/basictypes.h"
9 #include "base/lazy_instance.h"
10 #include "content/public/browser/notification_observer.h"
11 #include "content/public/browser/notification_registrar.h"
13 namespace content {
14 class BrowserContext;
17 namespace feedback {
19 class FeedbackUploader;
21 // FeedbackProfileObserver waits on profile creation notifications to check
22 // if the profile has any pending feedback reports to upload. If it does, it
23 // queues those reports for upload.
24 class FeedbackProfileObserver : public content::NotificationObserver {
25 public:
26 static void Initialize();
28 private:
29 friend struct base::DefaultLazyInstanceTraits<FeedbackProfileObserver>;
31 FeedbackProfileObserver();
32 virtual ~FeedbackProfileObserver();
34 // content::NotificationObserver override
35 virtual void Observe(int type,
36 const content::NotificationSource& source,
37 const content::NotificationDetails& details) OVERRIDE;
39 // Loads any unsent reports from disk and queues them to be uploaded in
40 // the given browser context.
41 void QueueUnsentReports(content::BrowserContext* context);
43 static void QueueSingleReport(feedback::FeedbackUploader* uploader,
44 const std::string& data);
46 // Used to track creation of profiles so we can load any unsent reports
47 // for that profile.
48 content::NotificationRegistrar prefs_registrar_;
50 DISALLOW_COPY_AND_ASSIGN(FeedbackProfileObserver);
53 } // namespace feedback
55 #endif // CHROME_BROWSER_FEEDBACK_FEEDBACK_PROFILE_OBSERVER_H_