| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 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 #include "chrome/browser/chromeos/arc/test/arc_data_removed_waiter.h" |
| 5 |
| 6 #include "base/memory/ptr_util.h" |
| 7 #include "base/run_loop.h" |
| 8 |
| 9 namespace arc { |
| 10 |
| 11 ArcDataRemovedWaiter::ArcDataRemovedWaiter() { |
| 12 DCHECK(ArcSessionManager::Get()); |
| 13 ArcSessionManager::Get()->AddObserver(this); |
| 14 } |
| 15 |
| 16 ArcDataRemovedWaiter::~ArcDataRemovedWaiter() { |
| 17 ArcSessionManager::Get()->RemoveObserver(this); |
| 18 } |
| 19 |
| 20 void ArcDataRemovedWaiter::Wait() { |
| 21 run_loop_ = base::MakeUnique<base::RunLoop>(); |
| 22 run_loop_->Run(); |
| 23 run_loop_.reset(); |
| 24 } |
| 25 |
| 26 void ArcDataRemovedWaiter::OnArcDataRemoved() { |
| 27 if (!run_loop_) |
| 28 return; |
| 29 run_loop_->Quit(); |
| 30 } |
| 31 |
| 32 } // namespace arc |
| OLD | NEW |