Chromium Code Reviews| 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/arc_session_manager_data_removed_waiter.h" | |
| 5 | |
| 6 #include "base/run_loop.h" | |
| 7 | |
| 8 namespace arc { | |
| 9 | |
| 10 ArcSessionManagerDataRemovedWaiter::ArcSessionManagerDataRemovedWaiter() { | |
| 11 DCHECK(ArcSessionManager::Get()); | |
| 12 ArcSessionManager::Get()->AddObserver(this); | |
| 13 } | |
| 14 | |
| 15 ArcSessionManagerDataRemovedWaiter::~ArcSessionManagerDataRemovedWaiter() { | |
| 16 ArcSessionManager::Get()->RemoveObserver(this); | |
| 17 } | |
| 18 | |
| 19 void ArcSessionManagerDataRemovedWaiter::Wait() { | |
| 20 run_loop_.reset(new base::RunLoop); | |
|
hidehiko
2017/01/30 10:12:35
run_loop_ = base::MakeUnique<RunLoop>();
cf) Pleas
khmel
2017/01/31 02:47:08
Done.
| |
| 21 run_loop_->Run(); | |
| 22 run_loop_.reset(); | |
| 23 } | |
| 24 | |
| 25 void ArcSessionManagerDataRemovedWaiter::OnArcDataRemoved() { | |
| 26 if (!run_loop_) | |
| 27 return; | |
| 28 run_loop_->Quit(); | |
| 29 } | |
| 30 | |
| 31 } // namespace arc | |
| OLD | NEW |