OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/extensions/extension_test_notification_observer.h" | 5 #include "chrome/browser/extensions/extension_test_notification_observer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/callback_list.h" | 9 #include "base/callback_list.h" |
10 #include "chrome/browser/extensions/extension_action_test_util.h" | 10 #include "chrome/browser/extensions/extension_action_test_util.h" |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 const ConditionCallback& condition, | 277 const ConditionCallback& condition, |
278 NotificationSet* notification_set) { | 278 NotificationSet* notification_set) { |
279 if (condition.Run()) | 279 if (condition.Run()) |
280 return; | 280 return; |
281 condition_ = condition; | 281 condition_ = condition; |
282 | 282 |
283 scoped_refptr<content::MessageLoopRunner> runner( | 283 scoped_refptr<content::MessageLoopRunner> runner( |
284 new content::MessageLoopRunner); | 284 new content::MessageLoopRunner); |
285 quit_closure_ = runner->QuitClosure(); | 285 quit_closure_ = runner->QuitClosure(); |
286 | 286 |
287 scoped_ptr<base::CallbackList<void()>::Subscription> subscription; | 287 std::unique_ptr<base::CallbackList<void()>::Subscription> subscription; |
288 if (notification_set) { | 288 if (notification_set) { |
289 subscription = notification_set->callback_list().Add( | 289 subscription = notification_set->callback_list().Add( |
290 base::Bind(&ExtensionTestNotificationObserver::MaybeQuit, | 290 base::Bind(&ExtensionTestNotificationObserver::MaybeQuit, |
291 base::Unretained(this))); | 291 base::Unretained(this))); |
292 } | 292 } |
293 runner->Run(); | 293 runner->Run(); |
294 | 294 |
295 condition_.Reset(); | 295 condition_.Reset(); |
296 quit_closure_.Reset(); | 296 quit_closure_.Reset(); |
297 } | 297 } |
298 | 298 |
299 void ExtensionTestNotificationObserver::MaybeQuit() { | 299 void ExtensionTestNotificationObserver::MaybeQuit() { |
300 if (condition_.Run()) | 300 if (condition_.Run()) |
301 quit_closure_.Run(); | 301 quit_closure_.Run(); |
302 } | 302 } |
OLD | NEW |