| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/screen_security/screen_capture_tray_item.h" | 5 #include "ash/system/chromeos/screen_security/screen_capture_tray_item.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/common/system/system_notifier.h" | 9 #include "ash/common/system/system_notifier.h" |
| 10 #include "ash/common/system/tray/system_tray_notifier.h" |
| 10 #include "ash/common/wm_shell.h" | 11 #include "ash/common/wm_shell.h" |
| 11 #include "ash/shell.h" | |
| 12 #include "grit/ash_resources.h" | 12 #include "grit/ash_resources.h" |
| 13 #include "grit/ash_strings.h" | 13 #include "grit/ash_strings.h" |
| 14 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
| 15 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
| 16 #include "ui/message_center/message_center.h" | 16 #include "ui/message_center/message_center.h" |
| 17 #include "ui/message_center/notification.h" | 17 #include "ui/message_center/notification.h" |
| 18 | 18 |
| 19 using message_center::Notification; | 19 using message_center::Notification; |
| 20 | 20 |
| 21 namespace ash { | 21 namespace ash { |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 const char kScreenCaptureNotificationId[] = "chrome://screen/capture"; | 24 const char kScreenCaptureNotificationId[] = "chrome://screen/capture"; |
| 25 | 25 |
| 26 } // namespace | 26 } // namespace |
| 27 | 27 |
| 28 ScreenCaptureTrayItem::ScreenCaptureTrayItem(SystemTray* system_tray) | 28 ScreenCaptureTrayItem::ScreenCaptureTrayItem(SystemTray* system_tray) |
| 29 : ScreenTrayItem(system_tray) { | 29 : ScreenTrayItem(system_tray) { |
| 30 WmShell::Get()->AddShellObserver(this); | 30 WmShell::Get()->AddShellObserver(this); |
| 31 Shell::GetInstance()->system_tray_notifier()-> | 31 WmShell::Get()->system_tray_notifier()->AddScreenCaptureObserver(this); |
| 32 AddScreenCaptureObserver(this); | |
| 33 } | 32 } |
| 34 | 33 |
| 35 ScreenCaptureTrayItem::~ScreenCaptureTrayItem() { | 34 ScreenCaptureTrayItem::~ScreenCaptureTrayItem() { |
| 36 WmShell::Get()->RemoveShellObserver(this); | 35 WmShell::Get()->RemoveShellObserver(this); |
| 37 Shell::GetInstance()->system_tray_notifier()-> | 36 WmShell::Get()->system_tray_notifier()->RemoveScreenCaptureObserver(this); |
| 38 RemoveScreenCaptureObserver(this); | |
| 39 } | 37 } |
| 40 | 38 |
| 41 views::View* ScreenCaptureTrayItem::CreateTrayView(LoginStatus status) { | 39 views::View* ScreenCaptureTrayItem::CreateTrayView(LoginStatus status) { |
| 42 set_tray_view( | 40 set_tray_view( |
| 43 new tray::ScreenTrayView(this, IDR_AURA_UBER_TRAY_SCREENSHARE)); | 41 new tray::ScreenTrayView(this, IDR_AURA_UBER_TRAY_SCREENSHARE)); |
| 44 return tray_view(); | 42 return tray_view(); |
| 45 } | 43 } |
| 46 | 44 |
| 47 views::View* ScreenCaptureTrayItem::CreateDefaultView(LoginStatus status) { | 45 views::View* ScreenCaptureTrayItem::CreateDefaultView(LoginStatus status) { |
| 48 set_default_view(new tray::ScreenStatusView( | 46 set_default_view(new tray::ScreenStatusView( |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 // screen capture is stopped externally. | 97 // screen capture is stopped externally. |
| 100 set_is_started(false); | 98 set_is_started(false); |
| 101 Update(); | 99 Update(); |
| 102 } | 100 } |
| 103 | 101 |
| 104 void ScreenCaptureTrayItem::OnCastingSessionStartedOrStopped(bool started) { | 102 void ScreenCaptureTrayItem::OnCastingSessionStartedOrStopped(bool started) { |
| 105 is_casting_ = started; | 103 is_casting_ = started; |
| 106 } | 104 } |
| 107 | 105 |
| 108 } // namespace ash | 106 } // namespace ash |
| OLD | NEW |