| OLD | NEW |
| (Empty) | |
| 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. |
| 4 |
| 5 #ifndef CHROME_BROWSER_FEEDBACK_FEEDBACK_PROFILE_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_FEEDBACK_FEEDBACK_PROFILE_OBSERVER_H_ |
| 7 |
| 8 #include <queue> |
| 9 #include <string> |
| 10 |
| 11 #include "base/basictypes.h" |
| 12 #include "base/lazy_instance.h" |
| 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/time/time.h" |
| 16 #include "base/timer/timer.h" |
| 17 #include "chrome/browser/feedback/feedback_uploader_delegate.h" |
| 18 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" |
| 19 #include "content/public/browser/notification_observer.h" |
| 20 #include "content/public/browser/notification_registrar.h" |
| 21 |
| 22 namespace content { |
| 23 class BrowserContext; |
| 24 } |
| 25 |
| 26 namespace feedback { |
| 27 |
| 28 // FeedbackProfileObserver waits on profile creation notifications to check |
| 29 // if the profile has any pending feedback reports to upload. If it does, it |
| 30 // queues those reports for upload. |
| 31 class FeedbackProfileObserver : public content::NotificationObserver { |
| 32 public: |
| 33 static void Initialize(); |
| 34 |
| 35 private: |
| 36 friend struct base::DefaultLazyInstanceTraits<FeedbackProfileObserver>; |
| 37 |
| 38 FeedbackProfileObserver(); |
| 39 virtual ~FeedbackProfileObserver(); |
| 40 |
| 41 // content::NotificationObserver override |
| 42 virtual void Observe(int type, |
| 43 const content::NotificationSource& source, |
| 44 const content::NotificationDetails& details) OVERRIDE; |
| 45 |
| 46 // Loads any unsent reports from disk and queues them to be uploaded in |
| 47 // the given browser context. |
| 48 void QueueUnsentReports(content::BrowserContext* context); |
| 49 |
| 50 // Used to track creation of profiles so we can load any unsent reports |
| 51 // for that profile. |
| 52 content::NotificationRegistrar prefs_registrar_; |
| 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(FeedbackProfileObserver); |
| 55 }; |
| 56 |
| 57 } // namespace feedback |
| 58 |
| 59 #endif // CHROME_BROWSER_FEEDBACK_FEEDBACK_PROFILE_OBSERVER_H_ |
| OLD | NEW |