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/system/chromeos/media_security/multi_profile_media_tray_item.h" | 5 #include "ash/system/chromeos/media_security/multi_profile_media_tray_item.h" |
6 | 6 |
7 #include "ash/ash_view_ids.h" | 7 #include "ash/ash_view_ids.h" |
| 8 #include "ash/common/media_delegate.h" |
8 #include "ash/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
9 #include "ash/common/system/chromeos/media_security/media_capture_observer.h" | 10 #include "ash/common/system/chromeos/media_security/media_capture_observer.h" |
10 #include "ash/common/system/tray/system_tray_notifier.h" | 11 #include "ash/common/system/tray/system_tray_notifier.h" |
11 #include "ash/common/system/tray/tray_item_view.h" | 12 #include "ash/common/system/tray/tray_item_view.h" |
12 #include "ash/common/wm_shell.h" | 13 #include "ash/common/wm_shell.h" |
13 #include "ash/media_delegate.h" | |
14 #include "ash/shell.h" | |
15 #include "grit/ash_resources.h" | 14 #include "grit/ash_resources.h" |
16 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
17 #include "ui/views/controls/image_view.h" | 16 #include "ui/views/controls/image_view.h" |
18 #include "ui/views/layout/fill_layout.h" | 17 #include "ui/views/layout/fill_layout.h" |
19 | 18 |
20 namespace ash { | 19 namespace ash { |
21 namespace tray { | 20 namespace tray { |
22 | 21 |
23 class MultiProfileMediaTrayView : public TrayItemView, | 22 class MultiProfileMediaTrayView : public TrayItemView, |
24 public MediaCaptureObserver { | 23 public MediaCaptureObserver { |
(...skipping 10 matching lines...) Expand all Loading... |
35 WmShell::Get()->system_tray_notifier()->AddMediaCaptureObserver(this); | 34 WmShell::Get()->system_tray_notifier()->AddMediaCaptureObserver(this); |
36 set_id(VIEW_ID_MEDIA_TRAY_VIEW); | 35 set_id(VIEW_ID_MEDIA_TRAY_VIEW); |
37 } | 36 } |
38 | 37 |
39 ~MultiProfileMediaTrayView() override { | 38 ~MultiProfileMediaTrayView() override { |
40 WmShell::Get()->system_tray_notifier()->RemoveMediaCaptureObserver(this); | 39 WmShell::Get()->system_tray_notifier()->RemoveMediaCaptureObserver(this); |
41 } | 40 } |
42 | 41 |
43 // MediaCaptureObserver: | 42 // MediaCaptureObserver: |
44 void OnMediaCaptureChanged() override { | 43 void OnMediaCaptureChanged() override { |
45 MediaDelegate* media_delegate = Shell::GetInstance()->media_delegate(); | 44 MediaDelegate* media_delegate = WmShell::Get()->media_delegate(); |
46 SessionStateDelegate* session_state_delegate = | 45 SessionStateDelegate* session_state_delegate = |
47 WmShell::Get()->GetSessionStateDelegate(); | 46 WmShell::Get()->GetSessionStateDelegate(); |
48 // The user at 0 is the current desktop user. | 47 // The user at 0 is the current desktop user. |
49 for (UserIndex index = 1; | 48 for (UserIndex index = 1; |
50 index < session_state_delegate->NumberOfLoggedInUsers(); ++index) { | 49 index < session_state_delegate->NumberOfLoggedInUsers(); ++index) { |
51 if (media_delegate->GetMediaCaptureState(index) != MEDIA_CAPTURE_NONE) { | 50 if (media_delegate->GetMediaCaptureState(index) != MEDIA_CAPTURE_NONE) { |
52 SetVisible(true); | 51 SetVisible(true); |
53 return; | 52 return; |
54 } | 53 } |
55 } | 54 } |
(...skipping 14 matching lines...) Expand all Loading... |
70 views::View* MultiProfileMediaTrayItem::CreateTrayView(LoginStatus status) { | 69 views::View* MultiProfileMediaTrayItem::CreateTrayView(LoginStatus status) { |
71 tray_view_ = new tray::MultiProfileMediaTrayView(this); | 70 tray_view_ = new tray::MultiProfileMediaTrayView(this); |
72 return tray_view_; | 71 return tray_view_; |
73 } | 72 } |
74 | 73 |
75 void MultiProfileMediaTrayItem::DestroyTrayView() { | 74 void MultiProfileMediaTrayItem::DestroyTrayView() { |
76 tray_view_ = NULL; | 75 tray_view_ = NULL; |
77 } | 76 } |
78 | 77 |
79 } // namespace ash | 78 } // namespace ash |
OLD | NEW |