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

Unified Diff: ui/aura/client/default_capture_client.cc

Issue 2436023003: Adds CaptureClientObserver as a way to track changes in capture (Closed)
Patch Set: fix comments Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/aura/client/default_capture_client.h ('k') | ui/views/widget/desktop_aura/desktop_capture_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ui/aura/client/default_capture_client.h ('k') | ui/views/widget/desktop_aura/desktop_capture_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698