Chromium Code Reviews| Index: ui/views/mus/native_widget_mus.cc |
| diff --git a/ui/views/mus/native_widget_mus.cc b/ui/views/mus/native_widget_mus.cc |
| index 46a3ede494ce19c303e9671f82462405f5170f7b..014f0caad69c3a9df32a0cf13458be60bd67f554 100644 |
| --- a/ui/views/mus/native_widget_mus.cc |
| +++ b/ui/views/mus/native_widget_mus.cc |
| @@ -438,6 +438,41 @@ class NativeWidgetMus::MusWindowObserver : public mus::WindowObserver { |
| DISALLOW_COPY_AND_ASSIGN(MusWindowObserver); |
| }; |
| +class NativeWidgetMus::MusCaptureClient : public aura::client::CaptureClient { |
|
sadrul
2016/05/24 15:25:19
This could subclass DefaultCaptureClient instead,
Mark Dittmer
2016/05/24 16:06:20
Should work.
|
| + public: |
| + MusCaptureClient(aura::Window* root_window, aura::Window* aura_window, |
| + mus::Window* mus_window) |
| + : aura_window_(aura_window), mus_window_(mus_window), |
| + delegate_(new aura::client::DefaultCaptureClient(root_window)) { |
| + SetCaptureClient(root_window, this); |
| + } |
| + ~MusCaptureClient() override {} |
| + |
| + void SetCapture(aura::Window* window) override { |
|
sadrul
2016/05/24 15:25:19
// aura::client::CaptureClient:
Mark Dittmer
2016/05/24 16:06:20
Done (against aura::client::DefaultCaptureClient).
|
| + delegate()->SetCapture(window); |
| + if (aura_window_ == window) |
| + mus_window_->SetCapture(); |
| + } |
| + void ReleaseCapture(aura::Window* window) override { |
| + delegate()->ReleaseCapture(window); |
| + if (aura_window_ == window) |
| + mus_window_->ReleaseCapture(); |
| + } |
| + aura::Window* GetCaptureWindow() override { |
| + return delegate()->GetCaptureWindow(); |
| + } |
| + aura::Window* GetGlobalCaptureWindow() override { |
| + return delegate()->GetGlobalCaptureWindow(); |
| + } |
| + |
| + private: |
| + aura::client::CaptureClient* delegate() { return delegate_.get(); } |
| + |
| + aura::Window* aura_window_; |
| + mus::Window* mus_window_; |
| + std::unique_ptr<aura::client::DefaultCaptureClient> delegate_; |
|
sadrul
2016/05/24 15:25:19
DISALLOW_COPY_AND_ASSIGN
Mark Dittmer
2016/05/24 16:06:20
Done.
|
| +}; |
| + |
| //////////////////////////////////////////////////////////////////////////////// |
| // NativeWidgetMus, public: |
| @@ -645,7 +680,7 @@ void NativeWidgetMus::InitNativeWidget(const Widget::InitParams& params) { |
| window_tree_host_->window()->SetLayoutManager( |
| new ContentWindowLayoutManager(window_tree_host_->window(), content_)); |
| capture_client_.reset( |
| - new aura::client::DefaultCaptureClient(window_tree_host_->window())); |
| + new MusCaptureClient(window_tree_host_->window(), content_, window_)); |
| content_->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
| content_->Init(ui::LAYER_TEXTURED); |