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

Side by Side 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: Use inheritance for MusCaptureClient 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 unified diff | Download patch
« no previous file with comments | « ui/views/mus/native_widget_mus.h ('k') | ui/views/mus/native_widget_mus_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/mus/native_widget_mus.h" 5 #include "ui/views/mus/native_widget_mus.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 ui::PlatformWindowDelegate* platform_window_delegate() { 431 ui::PlatformWindowDelegate* platform_window_delegate() {
432 return native_widget_mus_->window_tree_host(); 432 return native_widget_mus_->window_tree_host();
433 } 433 }
434 434
435 NativeWidgetMus* native_widget_mus_; 435 NativeWidgetMus* native_widget_mus_;
436 mus::mojom::ShowState show_state_; 436 mus::mojom::ShowState show_state_;
437 437
438 DISALLOW_COPY_AND_ASSIGN(MusWindowObserver); 438 DISALLOW_COPY_AND_ASSIGN(MusWindowObserver);
439 }; 439 };
440 440
441 class NativeWidgetMus::MusCaptureClient
442 : public aura::client::DefaultCaptureClient {
443 public:
444 MusCaptureClient(aura::Window* root_window, aura::Window* aura_window,
445 mus::Window* mus_window)
446 : aura::client::DefaultCaptureClient(root_window),
447 aura_window_(aura_window), mus_window_(mus_window) {}
448 ~MusCaptureClient() override {}
449
450 // aura::client::DefaultCaptureClient:
451 void SetCapture(aura::Window* window) override {
452 aura::client::DefaultCaptureClient::SetCapture(window);
453 if (aura_window_ == window)
454 mus_window_->SetCapture();
455 }
456 void ReleaseCapture(aura::Window* window) override {
457 aura::client::DefaultCaptureClient::ReleaseCapture(window);
458 if (aura_window_ == window)
459 mus_window_->ReleaseCapture();
460 }
461
462 private:
463 aura::Window* aura_window_;
464 mus::Window* mus_window_;
465
466 DISALLOW_COPY_AND_ASSIGN(MusCaptureClient);
467 };
468
441 //////////////////////////////////////////////////////////////////////////////// 469 ////////////////////////////////////////////////////////////////////////////////
442 // NativeWidgetMus, public: 470 // NativeWidgetMus, public:
443 471
444 NativeWidgetMus::NativeWidgetMus(internal::NativeWidgetDelegate* delegate, 472 NativeWidgetMus::NativeWidgetMus(internal::NativeWidgetDelegate* delegate,
445 shell::Connector* connector, 473 shell::Connector* connector,
446 mus::Window* window, 474 mus::Window* window,
447 mus::mojom::SurfaceType surface_type) 475 mus::mojom::SurfaceType surface_type)
448 : window_(window), 476 : window_(window),
449 last_cursor_(mus::mojom::Cursor::CURSOR_NULL), 477 last_cursor_(mus::mojom::Cursor::CURSOR_NULL),
450 native_widget_delegate_(delegate), 478 native_widget_delegate_(delegate),
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 aura::client::SetCursorClient(window_tree_host_->window(), 666 aura::client::SetCursorClient(window_tree_host_->window(),
639 cursor_manager_.get()); 667 cursor_manager_.get());
640 } 668 }
641 669
642 window_tree_client_.reset( 670 window_tree_client_.reset(
643 new NativeWidgetMusWindowTreeClient(window_tree_host_->window())); 671 new NativeWidgetMusWindowTreeClient(window_tree_host_->window()));
644 window_tree_host_->window()->AddPreTargetHandler(focus_client_.get()); 672 window_tree_host_->window()->AddPreTargetHandler(focus_client_.get());
645 window_tree_host_->window()->SetLayoutManager( 673 window_tree_host_->window()->SetLayoutManager(
646 new ContentWindowLayoutManager(window_tree_host_->window(), content_)); 674 new ContentWindowLayoutManager(window_tree_host_->window(), content_));
647 capture_client_.reset( 675 capture_client_.reset(
648 new aura::client::DefaultCaptureClient(window_tree_host_->window())); 676 new MusCaptureClient(window_tree_host_->window(), content_, window_));
649 677
650 content_->SetType(ui::wm::WINDOW_TYPE_NORMAL); 678 content_->SetType(ui::wm::WINDOW_TYPE_NORMAL);
651 content_->Init(ui::LAYER_TEXTURED); 679 content_->Init(ui::LAYER_TEXTURED);
652 if (window_->visible()) 680 if (window_->visible())
653 content_->Show(); 681 content_->Show();
654 content_->SetTransparent(true); 682 content_->SetTransparent(true);
655 content_->SetFillsBoundsCompletely(false); 683 content_->SetFillsBoundsCompletely(false);
656 window_tree_host_->window()->AddChild(content_); 684 window_tree_host_->window()->AddChild(content_);
657 685
658 // Set-up transiency if appropriate. 686 // Set-up transiency if appropriate.
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
1308 window_tree_host_->Show(); 1336 window_tree_host_->Show();
1309 GetNativeWindow()->Show(); 1337 GetNativeWindow()->Show();
1310 } else { 1338 } else {
1311 window_tree_host_->Hide(); 1339 window_tree_host_->Hide();
1312 GetNativeWindow()->Hide(); 1340 GetNativeWindow()->Hide();
1313 } 1341 }
1314 native_widget_delegate_->OnNativeWidgetVisibilityChanged(window->visible()); 1342 native_widget_delegate_->OnNativeWidgetVisibilityChanged(window->visible());
1315 } 1343 }
1316 1344
1317 } // namespace views 1345 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/mus/native_widget_mus.h ('k') | ui/views/mus/native_widget_mus_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698