18bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 28bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 38bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// found in the LICENSE file. 48bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 58bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_CAPTURE_CLIENT_H_ 68bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_CAPTURE_CLIENT_H_ 78bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 88bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include <set> 98bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 108bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "base/basictypes.h" 118bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "base/compiler_specific.h" 128bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "ui/aura/client/capture_client.h" 138bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "ui/views/views_export.h" 148bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 151e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)namespace aura { 161e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)class RootWindow; 171e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)} 181e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 198bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)namespace views { 208bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 218bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// Desktop implementation of CaptureClient. There is one CaptureClient per 228bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// DesktopNativeWidgetAura. 23f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// 24f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// DesktopCaptureClient and CaptureController (used by ash) differ slightly in 25f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// how they handle capture. CaptureController is a singleton shared among all 26f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// RootWindows created by ash. An implication of this is that all RootWindows 27f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// know which window has capture. This is not the case with 28f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// DesktopCaptureClient. Instead each RootWindow has its own 29f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// DesktopCaptureClient. This means only the RootWindow of the Window that has 30f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// capture knows which window has capture. All others think no one has 31f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// capture. This behavior is necessitated by Windows occassionally delivering 32f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// mouse events to a window other than the capture window and expecting that 33f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// window to get the event. If we shared the capture window on the desktop this 34f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// behavior would not be possible. 358bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)class VIEWS_EXPORT DesktopCaptureClient : public aura::client::CaptureClient { 368bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) public: 37f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) explicit DesktopCaptureClient(aura::Window* root); 388bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) virtual ~DesktopCaptureClient(); 398bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 408bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) // Overridden from aura::client::CaptureClient: 418bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) virtual void SetCapture(aura::Window* window) OVERRIDE; 428bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) virtual void ReleaseCapture(aura::Window* window) OVERRIDE; 438bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) virtual aura::Window* GetCaptureWindow() OVERRIDE; 44f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) virtual aura::Window* GetGlobalCaptureWindow() OVERRIDE; 458bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 468bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) private: 471e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) typedef std::set<DesktopCaptureClient*> CaptureClients; 488bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 49f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) aura::Window* root_; 508bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) aura::Window* capture_window_; 518bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 521e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) // Set of DesktopCaptureClients. 531e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) static CaptureClients* capture_clients_; 548bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 558bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(DesktopCaptureClient); 568bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)}; 578bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 588bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)} // namespace views 598bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 608bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_CAPTURE_CLIENT_H_ 61