OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_FEEDBACK_FEEDBACK_PROFILE_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_FEEDBACK_FEEDBACK_PROFILE_OBSERVER_H_ |
6 #define CHROME_BROWSER_FEEDBACK_FEEDBACK_PROFILE_OBSERVER_H_ | 6 #define CHROME_BROWSER_FEEDBACK_FEEDBACK_PROFILE_OBSERVER_H_ |
7 | 7 |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "content/public/browser/notification_observer.h" | 10 #include "content/public/browser/notification_observer.h" |
11 #include "content/public/browser/notification_registrar.h" | 11 #include "content/public/browser/notification_registrar.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 class BrowserContext; | 14 class BrowserContext; |
15 } | 15 } |
16 | 16 |
17 namespace feedback { | 17 namespace feedback { |
18 | 18 |
19 class FeedbackUploader; | 19 class FeedbackUploader; |
20 | 20 |
21 // FeedbackProfileObserver waits on profile creation notifications to check | 21 // FeedbackProfileObserver waits on profile creation notifications to check |
22 // if the profile has any pending feedback reports to upload. If it does, it | 22 // if the profile has any pending feedback reports to upload. If it does, it |
23 // queues those reports for upload. | 23 // queues those reports for upload. |
24 class FeedbackProfileObserver : public content::NotificationObserver { | 24 class FeedbackProfileObserver : public content::NotificationObserver { |
25 public: | 25 public: |
26 static void Initialize(); | 26 static void Initialize(); |
27 | 27 |
28 private: | 28 private: |
29 friend struct base::DefaultLazyInstanceTraits<FeedbackProfileObserver>; | 29 friend struct base::LazyInstanceTraitsBase<FeedbackProfileObserver>; |
30 | 30 |
31 FeedbackProfileObserver(); | 31 FeedbackProfileObserver(); |
32 ~FeedbackProfileObserver() override; | 32 ~FeedbackProfileObserver() override; |
33 | 33 |
34 // content::NotificationObserver override | 34 // content::NotificationObserver override |
35 void Observe(int type, | 35 void Observe(int type, |
36 const content::NotificationSource& source, | 36 const content::NotificationSource& source, |
37 const content::NotificationDetails& details) override; | 37 const content::NotificationDetails& details) override; |
38 | 38 |
39 // Loads any unsent reports from disk and queues them to be uploaded in | 39 // Loads any unsent reports from disk and queues them to be uploaded in |
40 // the given browser context. | 40 // the given browser context. |
41 void QueueUnsentReports(content::BrowserContext* context); | 41 void QueueUnsentReports(content::BrowserContext* context); |
42 | 42 |
43 static void QueueSingleReport(feedback::FeedbackUploader* uploader, | 43 static void QueueSingleReport(feedback::FeedbackUploader* uploader, |
44 const std::string& data); | 44 const std::string& data); |
45 | 45 |
46 // Used to track creation of profiles so we can load any unsent reports | 46 // Used to track creation of profiles so we can load any unsent reports |
47 // for that profile. | 47 // for that profile. |
48 content::NotificationRegistrar prefs_registrar_; | 48 content::NotificationRegistrar prefs_registrar_; |
49 | 49 |
50 DISALLOW_COPY_AND_ASSIGN(FeedbackProfileObserver); | 50 DISALLOW_COPY_AND_ASSIGN(FeedbackProfileObserver); |
51 }; | 51 }; |
52 | 52 |
53 } // namespace feedback | 53 } // namespace feedback |
54 | 54 |
55 #endif // CHROME_BROWSER_FEEDBACK_FEEDBACK_PROFILE_OBSERVER_H_ | 55 #endif // CHROME_BROWSER_FEEDBACK_FEEDBACK_PROFILE_OBSERVER_H_ |
OLD | NEW |