Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: ash/system/tray/media_security/media_tray_item.cc

Issue 253183003: Media indicator for background recording task (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ash/system/tray/media_security/media_tray_item.h"
6
7 #include "ash/ash_view_ids.h"
8 #include "ash/media_delegate.h"
9 #include "ash/session/session_state_delegate.h"
10 #include "ash/shell.h"
11 #include "ash/system/tray/media_security/media_capture_observer.h"
12 #include "ash/system/tray/system_tray_notifier.h"
13 #include "ash/system/tray/tray_item_view.h"
14 #include "grit/ash_resources.h"
15 #include "ui/base/resource/resource_bundle.h"
16 #include "ui/views/controls/image_view.h"
17 #include "ui/views/layout/fill_layout.h"
18
19 namespace ash {
20 namespace tray {
21
22 class MediaTrayView : public TrayItemView, public MediaCaptureObserver {
23 public:
24 explicit MediaTrayView(SystemTrayItem* system_tray_item)
25 : TrayItemView(system_tray_item) {
26 SetLayoutManager(new views::FillLayout);
27 views::ImageView* icon = new views::ImageView;
28 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
29 icon->SetImage(
30 bundle.GetImageNamed(IDR_AURA_UBER_TRAY_RECORDING).ToImageSkia());
31 AddChildView(icon);
32 OnMediaCaptureChanged();
33 Shell::GetInstance()->system_tray_notifier()->AddMediaCaptureObserver(this);
34 set_id(VIEW_ID_MEDIA_TRAY_VIEW);
35 }
36
37 virtual ~MediaTrayView() {
38 Shell::GetInstance()->system_tray_notifier()->RemoveMediaCaptureObserver(
39 this);
40 }
41
42 virtual void OnMediaCaptureChanged() OVERRIDE {
Mr4D (OOO till 08-26) 2014/04/30 18:24:36 Please add the // MediaCaptureObserver overrides
oshima 2014/04/30 20:40:31 Done.
43 MediaDelegate* media_delegate = Shell::GetInstance()->media_delegate();
44 SessionStateDelegate* session_state_delegate =
45 Shell::GetInstance()->session_state_delegate();
46 // The user at 0 is the current desktop user.
47 for (MultiProfileIndex index = 1;
48 index < session_state_delegate->NumberOfLoggedInUsers();
49 ++index) {
50 content::BrowserContext* context =
51 session_state_delegate->GetBrowserContextByIndex(index);
Mr4D (OOO till 08-26) 2014/04/30 18:24:36 What do we do with visiting windows? Shouldn't we
oshima 2014/04/30 20:40:31 That is handled in GetBackgroundMediaCaptureState.
52 if (media_delegate->GetBackgroundMediaCaptureState(context) !=
53 MEDIA_CAPTURE_NONE) {
54 SetVisible(true);
55 return;
56 }
57 }
58 SetVisible(false);
59 }
60
61 private:
62 DISALLOW_COPY_AND_ASSIGN(MediaTrayView);
63 };
64
65 } // namespace tray
66
67 MediaTrayItem::MediaTrayItem(SystemTray* system_tray)
68 : SystemTrayItem(system_tray), tray_view_(NULL) {
69 }
Mr4D (OOO till 08-26) 2014/04/30 18:24:36 Since this indicator does only get shown for inact
oshima 2014/04/30 20:40:31 There is no "multi user" keyword in ash so far (ex
Mr4D (OOO till 08-26) 2014/05/01 14:36:57 Only because it appears not not to be used (I thin
70
71 MediaTrayItem::~MediaTrayItem() {
72 }
73
74 views::View* MediaTrayItem::CreateTrayView(user::LoginStatus status) {
75 tray_view_ = new tray::MediaTrayView(this);
76 return tray_view_;
77 }
78
79 void MediaTrayItem::DestroyTrayView() {
80 tray_view_ = NULL;
81 }
82
83 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698