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/user/user_card_view.h" | 5 #include "ash/system/user/user_card_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/common/login_status.h" | 10 #include "ash/common/login_status.h" |
11 #include "ash/common/session/session_state_delegate.h" | 11 #include "ash/common/session/session_state_delegate.h" |
12 #include "ash/common/system/tray/system_tray_delegate.h" | 12 #include "ash/common/system/tray/system_tray_delegate.h" |
13 #include "ash/common/system/tray/system_tray_notifier.h" | 13 #include "ash/common/system/tray/system_tray_notifier.h" |
14 #include "ash/common/system/tray/tray_constants.h" | 14 #include "ash/common/system/tray/tray_constants.h" |
15 #include "ash/common/system/tray/tray_utils.h" | 15 #include "ash/common/system/tray/tray_utils.h" |
16 #include "ash/common/system/user/rounded_image_view.h" | 16 #include "ash/common/system/user/rounded_image_view.h" |
17 #include "ash/common/wm_shell.h" | 17 #include "ash/common/wm_shell.h" |
18 #include "ash/shell.h" | |
19 #include "base/i18n/rtl.h" | 18 #include "base/i18n/rtl.h" |
20 #include "base/memory/scoped_vector.h" | 19 #include "base/memory/scoped_vector.h" |
21 #include "base/strings/string16.h" | 20 #include "base/strings/string16.h" |
22 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
23 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
24 #include "components/user_manager/user_info.h" | 23 #include "components/user_manager/user_info.h" |
25 #include "grit/ash_resources.h" | 24 #include "grit/ash_resources.h" |
26 #include "grit/ash_strings.h" | 25 #include "grit/ash_strings.h" |
27 #include "ui/accessibility/ax_view_state.h" | 26 #include "ui/accessibility/ax_view_state.h" |
28 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
29 #include "ui/base/resource/resource_bundle.h" | 28 #include "ui/base/resource/resource_bundle.h" |
30 #include "ui/gfx/geometry/insets.h" | 29 #include "ui/gfx/geometry/insets.h" |
31 #include "ui/gfx/geometry/rect.h" | 30 #include "ui/gfx/geometry/rect.h" |
32 #include "ui/gfx/geometry/size.h" | 31 #include "ui/gfx/geometry/size.h" |
33 #include "ui/gfx/range/range.h" | 32 #include "ui/gfx/range/range.h" |
34 #include "ui/gfx/render_text.h" | 33 #include "ui/gfx/render_text.h" |
35 #include "ui/gfx/text_elider.h" | 34 #include "ui/gfx/text_elider.h" |
36 #include "ui/gfx/text_utils.h" | 35 #include "ui/gfx/text_utils.h" |
37 #include "ui/views/border.h" | 36 #include "ui/views/border.h" |
38 #include "ui/views/controls/link.h" | 37 #include "ui/views/controls/link.h" |
39 #include "ui/views/controls/link_listener.h" | 38 #include "ui/views/controls/link_listener.h" |
40 #include "ui/views/layout/box_layout.h" | 39 #include "ui/views/layout/box_layout.h" |
41 | 40 |
42 #if defined(OS_CHROMEOS) | 41 #if defined(OS_CHROMEOS) |
43 #include "ash/ash_view_ids.h" | 42 #include "ash/ash_view_ids.h" |
| 43 #include "ash/common/media_delegate.h" |
44 #include "ash/common/system/chromeos/media_security/media_capture_observer.h" | 44 #include "ash/common/system/chromeos/media_security/media_capture_observer.h" |
45 #include "ash/media_delegate.h" | |
46 #include "ui/views/controls/image_view.h" | 45 #include "ui/views/controls/image_view.h" |
47 #include "ui/views/layout/fill_layout.h" | 46 #include "ui/views/layout/fill_layout.h" |
48 #endif | 47 #endif |
49 | 48 |
50 namespace ash { | 49 namespace ash { |
51 namespace tray { | 50 namespace tray { |
52 | 51 |
53 namespace { | 52 namespace { |
54 | 53 |
55 const int kUserDetailsVerticalPadding = 5; | 54 const int kUserDetailsVerticalPadding = 5; |
(...skipping 21 matching lines...) Expand all Loading... |
77 set_id(VIEW_ID_USER_VIEW_MEDIA_INDICATOR); | 76 set_id(VIEW_ID_USER_VIEW_MEDIA_INDICATOR); |
78 } | 77 } |
79 | 78 |
80 ~MediaIndicator() override { | 79 ~MediaIndicator() override { |
81 WmShell::Get()->system_tray_notifier()->RemoveMediaCaptureObserver(this); | 80 WmShell::Get()->system_tray_notifier()->RemoveMediaCaptureObserver(this); |
82 } | 81 } |
83 | 82 |
84 // MediaCaptureObserver: | 83 // MediaCaptureObserver: |
85 void OnMediaCaptureChanged() override { | 84 void OnMediaCaptureChanged() override { |
86 MediaCaptureState state = | 85 MediaCaptureState state = |
87 Shell::GetInstance()->media_delegate()->GetMediaCaptureState(index_); | 86 WmShell::Get()->media_delegate()->GetMediaCaptureState(index_); |
88 int res_id = 0; | 87 int res_id = 0; |
89 switch (state) { | 88 switch (state) { |
90 case MEDIA_CAPTURE_AUDIO_VIDEO: | 89 case MEDIA_CAPTURE_AUDIO_VIDEO: |
91 res_id = IDS_ASH_STATUS_TRAY_MEDIA_RECORDING_AUDIO_VIDEO; | 90 res_id = IDS_ASH_STATUS_TRAY_MEDIA_RECORDING_AUDIO_VIDEO; |
92 break; | 91 break; |
93 case MEDIA_CAPTURE_AUDIO: | 92 case MEDIA_CAPTURE_AUDIO: |
94 res_id = IDS_ASH_STATUS_TRAY_MEDIA_RECORDING_AUDIO; | 93 res_id = IDS_ASH_STATUS_TRAY_MEDIA_RECORDING_AUDIO; |
95 break; | 94 break; |
96 case MEDIA_CAPTURE_VIDEO: | 95 case MEDIA_CAPTURE_VIDEO: |
97 res_id = IDS_ASH_STATUS_TRAY_MEDIA_RECORDING_VIDEO; | 96 res_id = IDS_ASH_STATUS_TRAY_MEDIA_RECORDING_VIDEO; |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 } else { | 441 } else { |
443 SessionStateDelegate* delegate = WmShell::Get()->GetSessionStateDelegate(); | 442 SessionStateDelegate* delegate = WmShell::Get()->GetSessionStateDelegate(); |
444 icon->SetImage(delegate->GetUserInfo(user_index)->GetImage(), | 443 icon->SetImage(delegate->GetUserInfo(user_index)->GetImage(), |
445 gfx::Size(kTrayItemSize, kTrayItemSize)); | 444 gfx::Size(kTrayItemSize, kTrayItemSize)); |
446 } | 445 } |
447 return icon; | 446 return icon; |
448 } | 447 } |
449 | 448 |
450 } // namespace tray | 449 } // namespace tray |
451 } // namespace ash | 450 } // namespace ash |
OLD | NEW |