Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Unified Diff: content/public/browser/notification_watcher.h

Issue 12218078: Implement a policy to autologin a public account. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move user activity timer reset to WebUILoginDisplay Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/public/browser/notification_watcher.h
diff --git a/content/public/browser/notification_watcher.h b/content/public/browser/notification_watcher.h
new file mode 100644
index 0000000000000000000000000000000000000000..2522c7909969a7268605195c39856a931e895d15
--- /dev/null
+++ b/content/public/browser/notification_watcher.h
@@ -0,0 +1,46 @@
+// Copyright 2013 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 CONTENT_PUBLIC_BROWSER_NOTIFICATION_WATCHER_H_
+#define CONTENT_PUBLIC_BROWSER_NOTIFICATION_WATCHER_H_
+
+#include "base/run_loop.h"
+#include "content/common/content_export.h"
+#include "content/public/browser/notification_observer.h"
+
+namespace content {
+
+class NotificationDetails;
+class NotificationSource;
+
+// Observes a specific notification type and quits the message loop once a
+// condition holds.
+class CONTENT_EXPORT NotificationWatcher
+ : public content::NotificationObserver {
+ public:
+ // Callback invoked on notifications. Should return true when the condition
+ // that the caller is waiting for is satisfied.
+ typedef base::Callback<bool(void)> ConditionTestCallback;
bartfab (slow) 2013/02/28 10:21:33 Include "base/callback.h" for this.
dconnelly 2013/02/28 12:52:56 Done.
+
+ explicit NotificationWatcher(int notification_type,
+ const ConditionTestCallback& callback);
+
+ void Run();
+
+ // content::NotificationObserver:
+ virtual void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) OVERRIDE;
bartfab (slow) 2013/02/28 10:21:33 Include "base/compiler_specific.h" for this.
dconnelly 2013/02/28 12:52:56 Done.
+
+ private:
+ int type_;
+ ConditionTestCallback callback_;
+ base::RunLoop run_loop_;
+
+ DISALLOW_COPY_AND_ASSIGN(NotificationWatcher);
bartfab (slow) 2013/02/28 10:21:33 Include "base/basictypes.h" for this.
dconnelly 2013/02/28 12:52:56 Done.
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_BROWSER_NOTIFICATION_WATCHER_H_

Powered by Google App Engine
This is Rietveld 408576698