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

Side by Side Diff: content/public/browser/notification_watcher.cc

Issue 12218078: Implement a policy to autologin a public account. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: split an assert 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 #include "content/public/browser/notification_watcher.h"
6
7 #include "content/public/browser/notification_details.h"
8 #include "content/public/browser/notification_registrar.h"
9 #include "content/public/browser/notification_service.h"
10 #include "content/public/browser/notification_source.h"
11
12 namespace content {
13
14 NotificationWatcher::NotificationWatcher(int notification_type,
15 const ConditionTestCallback& callback)
16 : type_(notification_type),
17 callback_(callback) {
18 }
19
20 void NotificationWatcher::Run() {
21 if (callback_.Run())
22 return;
23
24 content::NotificationRegistrar registrar;
25 registrar.Add(this, type_, content::NotificationService::AllSources());
26 run_loop_.Run();
27 }
28
29 void NotificationWatcher::Observe(
30 int type,
31 const content::NotificationSource& source,
32 const content::NotificationDetails& details) {
33 if (callback_.Run())
34 run_loop_.Quit();
35 }
36
37 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698