Index: ash/system/chromeos/screen_security/screen_capture_tray_item.cc |
diff --git a/ash/system/chromeos/screen_security/screen_capture_tray_item.cc b/ash/system/chromeos/screen_security/screen_capture_tray_item.cc |
index c4689ded2cac3c6cb62486c8d7eb69d46ab1872f..c8c5bac2ac198db76e376bc3a995060174d20c1c 100644 |
--- a/ash/system/chromeos/screen_security/screen_capture_tray_item.cc |
+++ b/ash/system/chromeos/screen_security/screen_capture_tray_item.cc |
@@ -24,11 +24,13 @@ const char kScreenCaptureNotificationId[] = "chrome://screen/capture"; |
ScreenCaptureTrayItem::ScreenCaptureTrayItem(SystemTray* system_tray) |
: ScreenTrayItem(system_tray) { |
+ Shell::GetInstance()->AddShellObserver(this); |
Shell::GetInstance()->system_tray_notifier()-> |
AddScreenCaptureObserver(this); |
} |
ScreenCaptureTrayItem::~ScreenCaptureTrayItem() { |
+ Shell::GetInstance()->RemoveShellObserver(this); |
Shell::GetInstance()->system_tray_notifier()-> |
RemoveScreenCaptureObserver(this); |
} |
@@ -79,6 +81,17 @@ void ScreenCaptureTrayItem::OnScreenCaptureStart( |
const base::Closure& stop_callback, |
const base::string16& screen_capture_status) { |
screen_capture_status_ = screen_capture_status; |
+ |
+ // This suppression technique is currently dependent on the order |
+ // that OnScreenCaptureStart and OnCastingSessionStartedOrStopped |
+ // get invoked. OnCastingSessionStartedOrStopped currently gets |
+ // called first. |
+ // |
+ // TODO(jdufault): Does this break casting and capturing the screen at the |
+ // same time? |
+ if (is_casting_) |
+ return; |
+ |
Start(stop_callback); |
} |
@@ -89,4 +102,8 @@ void ScreenCaptureTrayItem::OnScreenCaptureStop() { |
Update(); |
} |
+void ScreenCaptureTrayItem::OnCastingSessionStartedOrStopped(bool started) { |
+ is_casting_ = started; |
+} |
+ |
} // namespace ash |