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/vector_icons/vector_icons.h" | 14 #include "ash/resources/vector_icons/vector_icons.h" |
15 #include "ui/gfx/paint_vector_icon.h" | 15 #include "ui/gfx/paint_vector_icon.h" |
16 #include "ui/views/controls/image_view.h" | 16 #include "ui/views/controls/image_view.h" |
17 | 17 |
18 namespace ash { | 18 namespace ash { |
19 namespace tray { | 19 namespace tray { |
(...skipping 12 matching lines...) Expand all Loading... |
32 set_id(VIEW_ID_MEDIA_TRAY_VIEW); | 32 set_id(VIEW_ID_MEDIA_TRAY_VIEW); |
33 } | 33 } |
34 | 34 |
35 ~MultiProfileMediaTrayView() override { | 35 ~MultiProfileMediaTrayView() override { |
36 WmShell::Get()->media_controller()->RemoveObserver(this); | 36 WmShell::Get()->media_controller()->RemoveObserver(this); |
37 } | 37 } |
38 | 38 |
39 // MediaCaptureObserver: | 39 // MediaCaptureObserver: |
40 void OnMediaCaptureChanged( | 40 void OnMediaCaptureChanged( |
41 const std::vector<mojom::MediaCaptureState>& capture_states) override { | 41 const std::vector<mojom::MediaCaptureState>& capture_states) override { |
42 SessionStateDelegate* session_state_delegate = | 42 SessionController* controller = WmShell::Get()->session_controller(); |
43 WmShell::Get()->GetSessionStateDelegate(); | |
44 // The user at 0 is the current desktop user. | 43 // The user at 0 is the current desktop user. |
45 for (UserIndex index = 1; | 44 for (UserIndex index = 1; index < controller->NumberOfLoggedInUsers(); |
46 index < session_state_delegate->NumberOfLoggedInUsers(); ++index) { | 45 ++index) { |
47 if (capture_states[index] != mojom::MediaCaptureState::NONE) { | 46 if (capture_states[index] != mojom::MediaCaptureState::NONE) { |
48 SetVisible(true); | 47 SetVisible(true); |
49 return; | 48 return; |
50 } | 49 } |
51 } | 50 } |
52 SetVisible(false); | 51 SetVisible(false); |
53 } | 52 } |
54 | 53 |
55 private: | 54 private: |
56 DISALLOW_COPY_AND_ASSIGN(MultiProfileMediaTrayView); | 55 DISALLOW_COPY_AND_ASSIGN(MultiProfileMediaTrayView); |
57 }; | 56 }; |
58 | 57 |
59 } // namespace tray | 58 } // namespace tray |
60 | 59 |
61 MultiProfileMediaTrayItem::MultiProfileMediaTrayItem(SystemTray* system_tray) | 60 MultiProfileMediaTrayItem::MultiProfileMediaTrayItem(SystemTray* system_tray) |
62 : SystemTrayItem(system_tray, UMA_MULTI_PROFILE_MEDIA) {} | 61 : SystemTrayItem(system_tray, UMA_MULTI_PROFILE_MEDIA) {} |
63 | 62 |
64 MultiProfileMediaTrayItem::~MultiProfileMediaTrayItem() {} | 63 MultiProfileMediaTrayItem::~MultiProfileMediaTrayItem() {} |
65 | 64 |
66 views::View* MultiProfileMediaTrayItem::CreateTrayView(LoginStatus status) { | 65 views::View* MultiProfileMediaTrayItem::CreateTrayView(LoginStatus status) { |
67 return new tray::MultiProfileMediaTrayView(this); | 66 return new tray::MultiProfileMediaTrayView(this); |
68 } | 67 } |
69 | 68 |
70 } // namespace ash | 69 } // namespace ash |
OLD | NEW |