Chromium Code Reviews| Index: chrome/browser/feedback/feedback_profile_observer.h |
| diff --git a/chrome/browser/feedback/feedback_profile_observer.h b/chrome/browser/feedback/feedback_profile_observer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..07094480b3494d6b20dd9082341b8c34f95f3a46 |
| --- /dev/null |
| +++ b/chrome/browser/feedback/feedback_profile_observer.h |
| @@ -0,0 +1,59 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_FEEDBACK_FEEDBACK_PROFILE_OBSERVER_H_ |
| +#define CHROME_BROWSER_FEEDBACK_FEEDBACK_PROFILE_OBSERVER_H_ |
| + |
| +#include <queue> |
|
Lei Zhang
2014/01/23 22:28:41
neither queue or string are actually needed
rkc
2014/01/23 22:57:21
Done.
|
| +#include <string> |
| + |
| +#include "base/basictypes.h" |
| +#include "base/lazy_instance.h" |
| +#include "base/memory/scoped_ptr.h" |
|
Lei Zhang
2014/01/23 22:28:41
No scoped_ptrs, weak_ptrs, time or timer objects h
rkc
2014/01/23 22:57:21
Done.
|
| +#include "base/memory/weak_ptr.h" |
| +#include "base/time/time.h" |
| +#include "base/timer/timer.h" |
| +#include "chrome/browser/feedback/feedback_uploader_delegate.h" |
| +#include "components/browser_context_keyed_service/browser_context_keyed_service.h" |
|
Lei Zhang
2014/01/23 22:28:41
not needed
rkc
2014/01/23 22:57:21
Done.
|
| +#include "content/public/browser/notification_observer.h" |
| +#include "content/public/browser/notification_registrar.h" |
| + |
| +namespace content { |
| +class BrowserContext; |
| +} |
| + |
| +namespace feedback { |
| + |
| +// FeedbackProfileObserver waits on profile creation notifications to check |
| +// if the profile has any pending feedback reports to upload. If it does, it |
| +// queues those reports for upload. |
| +class FeedbackProfileObserver : public content::NotificationObserver { |
| + public: |
| + static void Initialize(); |
| + |
| + private: |
| + friend struct base::DefaultLazyInstanceTraits<FeedbackProfileObserver>; |
| + |
| + FeedbackProfileObserver(); |
| + virtual ~FeedbackProfileObserver(); |
| + |
| + // content::NotificationObserver override |
| + virtual void Observe(int type, |
| + const content::NotificationSource& source, |
| + const content::NotificationDetails& details) OVERRIDE; |
| + |
| + // Loads any unsent reports from disk and queues them to be uploaded in |
| + // the given browser context. |
| + void QueueUnsentReports(content::BrowserContext* context); |
| + |
| + // Used to track creation of profiles so we can load any unsent reports |
| + // for that profile. |
| + content::NotificationRegistrar prefs_registrar_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(FeedbackProfileObserver); |
| +}; |
| + |
| +} // namespace feedback |
| + |
| +#endif // CHROME_BROWSER_FEEDBACK_FEEDBACK_PROFILE_OBSERVER_H_ |