Index: ui/aura/client/default_capture_client.cc |
diff --git a/ui/aura/client/default_capture_client.cc b/ui/aura/client/default_capture_client.cc |
index b0719fc14e62849042298d330df840bcdd4f1c84..19f0d40c2a0127b1e21fa39d88db835983db2abd 100644 |
--- a/ui/aura/client/default_capture_client.cc |
+++ b/ui/aura/client/default_capture_client.cc |
@@ -4,27 +4,29 @@ |
#include "ui/aura/client/default_capture_client.h" |
+#include "ui/aura/client/capture_client_observer.h" |
#include "ui/aura/window.h" |
#include "ui/aura/window_event_dispatcher.h" |
#include "ui/aura/window_tree_host.h" |
namespace aura { |
namespace client { |
+namespace { |
-// static |
// Track the active capture window across root windows. |
Window* global_capture_window_ = nullptr; |
+} // namespace |
+ |
DefaultCaptureClient::DefaultCaptureClient(Window* root_window) |
- : root_window_(root_window), |
- capture_window_(NULL) { |
+ : root_window_(root_window), capture_window_(nullptr) { |
SetCaptureClient(root_window_, this); |
} |
DefaultCaptureClient::~DefaultCaptureClient() { |
if (global_capture_window_ == capture_window_) |
global_capture_window_ = nullptr; |
- SetCaptureClient(root_window_, NULL); |
+ SetCaptureClient(root_window_, nullptr); |
} |
void DefaultCaptureClient::SetCapture(Window* window) { |
@@ -44,6 +46,9 @@ void DefaultCaptureClient::SetCapture(Window* window) { |
capture_delegate->ReleaseNativeCapture(); |
capture_delegate->UpdateCapture(old_capture_window, capture_window_); |
+ |
+ for (CaptureClientObserver& observer : observers_) |
+ observer.OnCaptureChanged(old_capture_window, capture_window_); |
} |
void DefaultCaptureClient::ReleaseCapture(Window* window) { |
@@ -60,5 +65,13 @@ Window* DefaultCaptureClient::GetGlobalCaptureWindow() { |
return global_capture_window_; |
} |
+void DefaultCaptureClient::AddObserver(CaptureClientObserver* observer) { |
+ observers_.AddObserver(observer); |
+} |
+ |
+void DefaultCaptureClient::RemoveObserver(CaptureClientObserver* observer) { |
+ observers_.RemoveObserver(observer); |
+} |
+ |
} // namespace client |
} // namespace aura |