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

Unified Diff: ui/views/mus/native_widget_mus.cc

Issue 1988283002: Implement and test aura::client::CaptureClient in views::NativeWidgetMus for plumbing (Set|Release)… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@native_widget_mus7
Patch Set: rebase Created 4 years, 7 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
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);

Powered by Google App Engine
This is Rietveld 408576698