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
3 // found in the LICENSE file.
5 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_CAPTURE_CLIENT_H_
6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_CAPTURE_CLIENT_H_
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "ui/aura/client/capture_client.h"
13 #include "ui/views/views_export.h"
21 // Desktop implementation of CaptureClient. There is one CaptureClient per
22 // DesktopNativeWidgetAura.
24 // DesktopCaptureClient and CaptureController (used by ash) differ slightly in
25 // how they handle capture. CaptureController is a singleton shared among all
26 // RootWindows created by ash. An implication of this is that all RootWindows
27 // know which window has capture. This is not the case with
28 // DesktopCaptureClient. Instead each RootWindow has its own
29 // DesktopCaptureClient. This means only the RootWindow of the Window that has
30 // capture knows which window has capture. All others think no one has
31 // capture. This behavior is necessitated by Windows occassionally delivering
32 // mouse events to a window other than the capture window and expecting that
33 // window to get the event. If we shared the capture window on the desktop this
34 // behavior would not be possible.
35 class VIEWS_EXPORT DesktopCaptureClient
: public aura::client::CaptureClient
{
37 explicit DesktopCaptureClient(aura::Window
* root
);
38 virtual ~DesktopCaptureClient();
40 // Overridden from aura::client::CaptureClient:
41 virtual void SetCapture(aura::Window
* window
) OVERRIDE
;
42 virtual void ReleaseCapture(aura::Window
* window
) OVERRIDE
;
43 virtual aura::Window
* GetCaptureWindow() OVERRIDE
;
44 virtual aura::Window
* GetGlobalCaptureWindow() OVERRIDE
;
47 typedef std::set
<DesktopCaptureClient
*> CaptureClients
;
50 aura::Window
* capture_window_
;
52 // Set of DesktopCaptureClients.
53 static CaptureClients
* capture_clients_
;
55 DISALLOW_COPY_AND_ASSIGN(DesktopCaptureClient
);
60 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_CAPTURE_CLIENT_H_