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

Unified Diff: content/public/test/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: more nits Created 7 years, 9 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/test/notification_watcher.h
diff --git a/content/public/test/notification_watcher.h b/content/public/test/notification_watcher.h
new file mode 100644
index 0000000000000000000000000000000000000000..ccc44b67014cc9fa950b605606f39bce702b0233
--- /dev/null
+++ b/content/public/test/notification_watcher.h
@@ -0,0 +1,49 @@
+// 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_
bartfab (slow) 2013/03/07 12:17:23 This no longer matches the file path.
dconnelly 2013/03/07 14:45:19 Done.
+#define CONTENT_PUBLIC_BROWSER_NOTIFICATION_WATCHER_H_
+
+#include "base/basictypes.h"
+#include "base/callback.h"
+#include "base/compiler_specific.h"
+#include "base/run_loop.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 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;
+
+ explicit NotificationWatcher(int notification_type,
+ const ConditionTestCallback& callback);
+ virtual ~NotificationWatcher();
+
+ void Run();
+
+ // content::NotificationObserver:
+ virtual void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) OVERRIDE;
+
+ private:
+ int type_;
+ ConditionTestCallback callback_;
+ base::RunLoop run_loop_;
+
+ DISALLOW_COPY_AND_ASSIGN(NotificationWatcher);
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_BROWSER_NOTIFICATION_WATCHER_H_

Powered by Google App Engine
This is Rietveld 408576698