| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ash/test/tray_cast_test_api.h" | 5 #include "ash/test/tray_cast_test_api.h" |
| 6 | 6 |
| 7 #include "ash/common/cast_config_delegate.h" | |
| 8 #include "ash/common/system/tray/system_tray.h" | 7 #include "ash/common/system/tray/system_tray.h" |
| 9 #include "ash/common/system/tray/system_tray_delegate.h" | 8 #include "ash/common/system/tray/system_tray_delegate.h" |
| 10 #include "ash/common/wm_shell.h" | 9 #include "ash/common/wm_shell.h" |
| 11 #include "ui/views/view.h" | 10 #include "ui/views/view.h" |
| 12 | 11 |
| 13 namespace ash { | 12 namespace ash { |
| 14 | 13 |
| 15 TrayCastTestAPI::TrayCastTestAPI(TrayCast* tray_cast) : tray_cast_(tray_cast) {} | 14 TrayCastTestAPI::TrayCastTestAPI(TrayCast* tray_cast) : tray_cast_(tray_cast) {} |
| 16 | 15 |
| 17 TrayCastTestAPI::~TrayCastTestAPI() {} | 16 TrayCastTestAPI::~TrayCastTestAPI() {} |
| (...skipping 23 matching lines...) Expand all Loading... |
| 41 } | 40 } |
| 42 | 41 |
| 43 void TrayCastTestAPI::StopCast() { | 42 void TrayCastTestAPI::StopCast() { |
| 44 return tray_cast_->StopCastForTest(); | 43 return tray_cast_->StopCastForTest(); |
| 45 } | 44 } |
| 46 | 45 |
| 47 void TrayCastTestAPI::OnCastingSessionStartedOrStopped(bool is_casting) { | 46 void TrayCastTestAPI::OnCastingSessionStartedOrStopped(bool is_casting) { |
| 48 tray_cast_->OnCastingSessionStartedOrStopped(is_casting); | 47 tray_cast_->OnCastingSessionStartedOrStopped(is_casting); |
| 49 } | 48 } |
| 50 | 49 |
| 51 void TrayCastTestAPI::ReleaseConfigCallbacks() { | |
| 52 if (WmShell::Get() && WmShell::Get()->system_tray_delegate()) { | |
| 53 WmShell::Get() | |
| 54 ->system_tray_delegate() | |
| 55 ->GetCastConfigDelegate() | |
| 56 ->RemoveObserver(tray_cast_); | |
| 57 } | |
| 58 } | |
| 59 | |
| 60 bool TrayCastTestAPI::IsViewDrawn(TrayCast::ChildViewId id) const { | 50 bool TrayCastTestAPI::IsViewDrawn(TrayCast::ChildViewId id) const { |
| 61 const views::View* view = tray_cast_->GetDefaultView()->GetViewByID(id); | 51 const views::View* view = tray_cast_->GetDefaultView()->GetViewByID(id); |
| 62 return view != nullptr && view->IsDrawn(); | 52 return view != nullptr && view->IsDrawn(); |
| 63 } | 53 } |
| 64 | 54 |
| 65 } // namespace ash | 55 } // namespace ash |
| OLD | NEW |