| 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_delegate.h" | 8 #include "ash/common/media_delegate.h" |
| 9 #include "ash/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
| 10 #include "ash/common/system/chromeos/media_security/media_capture_observer.h" | 10 #include "ash/common/system/chromeos/media_security/media_capture_observer.h" |
| 11 #include "ash/common/system/tray/system_tray_notifier.h" | 11 #include "ash/common/system/tray/system_tray_notifier.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 "grit/ash_resources.h" | 14 #include "grit/ash_resources.h" |
| 15 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
| 16 #include "ui/views/controls/image_view.h" | 16 #include "ui/views/controls/image_view.h" |
| 17 #include "ui/views/layout/fill_layout.h" | 17 #include "ui/views/layout/fill_layout.h" |
| 18 | 18 |
| 19 namespace ash { | 19 namespace ash { |
| 20 namespace tray { | 20 namespace tray { |
| 21 | 21 |
| 22 class MultiProfileMediaTrayView : public TrayItemView, | 22 class MultiProfileMediaTrayView : public TrayItemView, |
| 23 public MediaCaptureObserver { | 23 public MediaCaptureObserver { |
| 24 public: | 24 public: |
| 25 explicit MultiProfileMediaTrayView(SystemTrayItem* system_tray_item) | 25 explicit MultiProfileMediaTrayView(SystemTrayItem* system_tray_item) |
| 26 : TrayItemView(system_tray_item) { | 26 : TrayItemView(system_tray_item) { |
| 27 SetLayoutManager(new views::FillLayout); | 27 SetLayoutManager(new views::FillLayout); |
| 28 views::ImageView* icon = new views::ImageView; | 28 CreateImageView(); |
| 29 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 29 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
| 30 icon->SetImage( | 30 image_view()->SetImage( |
| 31 bundle.GetImageNamed(IDR_AURA_UBER_TRAY_RECORDING).ToImageSkia()); | 31 bundle.GetImageNamed(IDR_AURA_UBER_TRAY_RECORDING).ToImageSkia()); |
| 32 AddChildView(icon); | |
| 33 OnMediaCaptureChanged(); | 32 OnMediaCaptureChanged(); |
| 34 WmShell::Get()->system_tray_notifier()->AddMediaCaptureObserver(this); | 33 WmShell::Get()->system_tray_notifier()->AddMediaCaptureObserver(this); |
| 35 set_id(VIEW_ID_MEDIA_TRAY_VIEW); | 34 set_id(VIEW_ID_MEDIA_TRAY_VIEW); |
| 36 } | 35 } |
| 37 | 36 |
| 38 ~MultiProfileMediaTrayView() override { | 37 ~MultiProfileMediaTrayView() override { |
| 39 WmShell::Get()->system_tray_notifier()->RemoveMediaCaptureObserver(this); | 38 WmShell::Get()->system_tray_notifier()->RemoveMediaCaptureObserver(this); |
| 40 } | 39 } |
| 41 | 40 |
| 42 // MediaCaptureObserver: | 41 // MediaCaptureObserver: |
| (...skipping 27 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_ = nullptr; | 75 tray_view_ = nullptr; |
| 77 } | 76 } |
| 78 | 77 |
| 79 } // namespace ash | 78 } // namespace ash |
| OLD | NEW |