| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/common/system/chromeos/media_security/multi_profile_media_tray_ite
m.h" | 5 #include "ash/common/system/chromeos/media_security/multi_profile_media_tray_ite
m.h" |
| 6 | 6 |
| 7 #include "ash/common/ash_view_ids.h" | 7 #include "ash/common/ash_view_ids.h" |
| 8 #include "ash/common/media_controller.h" | 8 #include "ash/common/media_controller.h" |
| 9 #include "ash/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_controller.h" |
| 10 #include "ash/common/system/tray/system_tray_notifier.h" | 10 #include "ash/common/system/tray/system_tray_notifier.h" |
| 11 #include "ash/common/system/tray/tray_constants.h" | 11 #include "ash/common/system/tray/tray_constants.h" |
| 12 #include "ash/common/system/tray/tray_item_view.h" | 12 #include "ash/common/system/tray/tray_item_view.h" |
| 13 #include "ash/common/wm_shell.h" | 13 #include "ash/common/wm_shell.h" |
| 14 #include "ash/resources/grit/ash_resources.h" | 14 #include "ash/resources/grit/ash_resources.h" |
| 15 #include "ash/resources/vector_icons/vector_icons.h" | 15 #include "ash/resources/vector_icons/vector_icons.h" |
| 16 #include "ui/base/resource/resource_bundle.h" | 16 #include "ui/base/resource/resource_bundle.h" |
| 17 #include "ui/gfx/paint_vector_icon.h" | 17 #include "ui/gfx/paint_vector_icon.h" |
| 18 #include "ui/views/controls/image_view.h" | 18 #include "ui/views/controls/image_view.h" |
| 19 | 19 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 37 set_id(VIEW_ID_MEDIA_TRAY_VIEW); | 37 set_id(VIEW_ID_MEDIA_TRAY_VIEW); |
| 38 } | 38 } |
| 39 | 39 |
| 40 ~MultiProfileMediaTrayView() override { | 40 ~MultiProfileMediaTrayView() override { |
| 41 WmShell::Get()->media_controller()->RemoveObserver(this); | 41 WmShell::Get()->media_controller()->RemoveObserver(this); |
| 42 } | 42 } |
| 43 | 43 |
| 44 // MediaCaptureObserver: | 44 // MediaCaptureObserver: |
| 45 void OnMediaCaptureChanged( | 45 void OnMediaCaptureChanged( |
| 46 const std::vector<mojom::MediaCaptureState>& capture_states) override { | 46 const std::vector<mojom::MediaCaptureState>& capture_states) override { |
| 47 SessionStateDelegate* session_state_delegate = | 47 SessionController* controller = WmShell::Get()->session_controller(); |
| 48 WmShell::Get()->GetSessionStateDelegate(); | |
| 49 // The user at 0 is the current desktop user. | 48 // The user at 0 is the current desktop user. |
| 50 for (UserIndex index = 1; | 49 for (UserIndex index = 1; index < controller->NumberOfLoggedInUsers(); |
| 51 index < session_state_delegate->NumberOfLoggedInUsers(); ++index) { | 50 ++index) { |
| 52 if (capture_states[index] != mojom::MediaCaptureState::NONE) { | 51 if (capture_states[index] != mojom::MediaCaptureState::NONE) { |
| 53 SetVisible(true); | 52 SetVisible(true); |
| 54 return; | 53 return; |
| 55 } | 54 } |
| 56 } | 55 } |
| 57 SetVisible(false); | 56 SetVisible(false); |
| 58 } | 57 } |
| 59 | 58 |
| 60 private: | 59 private: |
| 61 DISALLOW_COPY_AND_ASSIGN(MultiProfileMediaTrayView); | 60 DISALLOW_COPY_AND_ASSIGN(MultiProfileMediaTrayView); |
| 62 }; | 61 }; |
| 63 | 62 |
| 64 } // namespace tray | 63 } // namespace tray |
| 65 | 64 |
| 66 MultiProfileMediaTrayItem::MultiProfileMediaTrayItem(SystemTray* system_tray) | 65 MultiProfileMediaTrayItem::MultiProfileMediaTrayItem(SystemTray* system_tray) |
| 67 : SystemTrayItem(system_tray, UMA_MULTI_PROFILE_MEDIA) {} | 66 : SystemTrayItem(system_tray, UMA_MULTI_PROFILE_MEDIA) {} |
| 68 | 67 |
| 69 MultiProfileMediaTrayItem::~MultiProfileMediaTrayItem() {} | 68 MultiProfileMediaTrayItem::~MultiProfileMediaTrayItem() {} |
| 70 | 69 |
| 71 views::View* MultiProfileMediaTrayItem::CreateTrayView(LoginStatus status) { | 70 views::View* MultiProfileMediaTrayItem::CreateTrayView(LoginStatus status) { |
| 72 return new tray::MultiProfileMediaTrayView(this); | 71 return new tray::MultiProfileMediaTrayView(this); |
| 73 } | 72 } |
| 74 | 73 |
| 75 } // namespace ash | 74 } // namespace ash |
| OLD | NEW |