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

Unified Diff: ui/wm/core/capture_controller.h

Issue 780273003: Fix releasing capture in Ozone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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/wm/BUILD.gn ('k') | ui/wm/core/capture_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/wm/core/capture_controller.h
diff --git a/ui/wm/core/capture_controller.h b/ui/wm/core/capture_controller.h
index bd9beb922a803de2935ffe0a096c759a56417d5d..cc32ae77b21b3a53ce185b1d2d980b0ba82beb31 100644
--- a/ui/wm/core/capture_controller.h
+++ b/ui/wm/core/capture_controller.h
@@ -5,7 +5,7 @@
#ifndef UI_WM_CORE_CAPTURE_CONTROLLER_H_
#define UI_WM_CORE_CAPTURE_CONTROLLER_H_
-#include <set>
+#include <map>
#include "base/basictypes.h"
#include "base/compiler_specific.h"
@@ -13,20 +13,26 @@
#include "ui/aura/window_observer.h"
#include "ui/wm/wm_export.h"
+namespace aura {
+namespace client {
+class CaptureDelegate;
+}
+}
+
namespace wm {
// Internal CaptureClient implementation. See ScopedCaptureClient for details.
class WM_EXPORT CaptureController : public aura::client::CaptureClient {
public:
- // Adds |root| to the list of RootWindows notified when capture changes.
+ // Adds |root| to the list of root windows notified when capture changes.
void Attach(aura::Window* root);
- // Removes |root| from the list of RootWindows notified when capture changes.
+ // Removes |root| from the list of root windows notified when capture changes.
void Detach(aura::Window* root);
// Returns true if this CaptureController is installed on at least one
- // RootWindow.
- bool is_active() const { return !root_windows_.empty(); }
+ // root window.
+ bool is_active() const { return !delegates_.empty(); }
// Overridden from aura::client::CaptureClient:
void SetCapture(aura::Window* window) override;
@@ -36,7 +42,6 @@ class WM_EXPORT CaptureController : public aura::client::CaptureClient {
private:
friend class ScopedCaptureClient;
- typedef std::set<aura::Window*> RootWindows;
CaptureController();
~CaptureController() override;
@@ -44,8 +49,14 @@ class WM_EXPORT CaptureController : public aura::client::CaptureClient {
// The current capture window. NULL if there is no capture window.
aura::Window* capture_window_;
- // Set of RootWindows notified when capture changes.
- RootWindows root_windows_;
+ // The capture delegate for the root window with native capture. The root
+ // window with native capture may not contain |capture_window_|. This occurs
+ // if |capture_window_| is reparented to a different root window while it has
+ // capture.
+ aura::client::CaptureDelegate* capture_delegate_;
+
+ // The delegates notified when capture changes.
+ std::map<aura::Window*, aura::client::CaptureDelegate*> delegates_;
DISALLOW_COPY_AND_ASSIGN(CaptureController);
};
@@ -55,6 +66,21 @@ class WM_EXPORT CaptureController : public aura::client::CaptureClient {
// among all ScopedCaptureClients and adds the RootWindow to it.
class WM_EXPORT ScopedCaptureClient : public aura::WindowObserver {
public:
+ class WM_EXPORT TestApi {
+ public:
+ explicit TestApi(ScopedCaptureClient* client) : client_(client) {}
+ ~TestApi() {}
+
+ // Sets the delegate.
+ void SetDelegate(aura::client::CaptureDelegate* delegate);
+
+ private:
+ // Not owned.
+ ScopedCaptureClient* client_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestApi);
+ };
+
explicit ScopedCaptureClient(aura::Window* root);
~ScopedCaptureClient() override;
« no previous file with comments | « ui/wm/BUILD.gn ('k') | ui/wm/core/capture_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698