| Index: chrome/browser/chromeos/arc/test/arc_data_removed_waiter.cc
|
| diff --git a/chrome/browser/chromeos/arc/test/arc_data_removed_waiter.cc b/chrome/browser/chromeos/arc/test/arc_data_removed_waiter.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..d9f3acb9172142fa2b835c9d79af9e4582c97b36
|
| --- /dev/null
|
| +++ b/chrome/browser/chromeos/arc/test/arc_data_removed_waiter.cc
|
| @@ -0,0 +1,32 @@
|
| +// Copyright 2017 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.
|
| +#include "chrome/browser/chromeos/arc/test/arc_data_removed_waiter.h"
|
| +
|
| +#include "base/memory/ptr_util.h"
|
| +#include "base/run_loop.h"
|
| +
|
| +namespace arc {
|
| +
|
| +ArcDataRemovedWaiter::ArcDataRemovedWaiter() {
|
| + DCHECK(ArcSessionManager::Get());
|
| + ArcSessionManager::Get()->AddObserver(this);
|
| +}
|
| +
|
| +ArcDataRemovedWaiter::~ArcDataRemovedWaiter() {
|
| + ArcSessionManager::Get()->RemoveObserver(this);
|
| +}
|
| +
|
| +void ArcDataRemovedWaiter::Wait() {
|
| + run_loop_ = base::MakeUnique<base::RunLoop>();
|
| + run_loop_->Run();
|
| + run_loop_.reset();
|
| +}
|
| +
|
| +void ArcDataRemovedWaiter::OnArcDataRemoved() {
|
| + if (!run_loop_)
|
| + return;
|
| + run_loop_->Quit();
|
| +}
|
| +
|
| +} // namespace arc
|
|
|