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 717a8be72285a951a6d6dfe54e2d7aa740a07efa..842e1360b72f6c2f1a708b7ff0441901ccbe37bd 100644 |
--- a/ui/views/mus/native_widget_mus.cc |
+++ b/ui/views/mus/native_widget_mus.cc |
@@ -7,6 +7,7 @@ |
#include "components/mus/public/cpp/window.h" |
#include "mojo/converters/geometry/geometry_type_converters.h" |
#include "ui/aura/client/default_capture_client.h" |
+#include "ui/aura/client/window_tree_client.h" |
#include "ui/aura/layout_manager.h" |
#include "ui/aura/window.h" |
#include "ui/base/hit_test.h" |
@@ -68,6 +69,29 @@ class ContentWindowLayoutManager : public aura::LayoutManager { |
DISALLOW_COPY_AND_ASSIGN(ContentWindowLayoutManager); |
}; |
+class NativeWidgetMusWindowTreeClient : public aura::client::WindowTreeClient { |
sky
2015/11/06 17:07:46
Wow, I hadn't realized we have aura::client::Windo
|
+ public: |
+ explicit NativeWidgetMusWindowTreeClient(aura::Window* root_window) |
+ : root_window_(root_window) { |
+ aura::client::SetWindowTreeClient(root_window_, this); |
+ } |
+ ~NativeWidgetMusWindowTreeClient() override { |
+ aura::client::SetWindowTreeClient(root_window_, NULL); |
sky
2015/11/06 17:07:46
nit: nullptr.
|
+ } |
+ |
+ // Overridden from client::WindowTreeClient: |
+ aura::Window* GetDefaultParent(aura::Window* context, |
+ aura::Window* window, |
+ const gfx::Rect& bounds) override { |
+ return root_window_; |
+ } |
+ |
+ private: |
+ aura::Window* root_window_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(NativeWidgetMusWindowTreeClient); |
+}; |
+ |
// As the window manager renderers the non-client decorations this class does |
// very little but honor the client area insets from the window manager. |
class ClientSideNonClientFrameView : public NonClientFrameView { |
@@ -182,6 +206,8 @@ void NativeWidgetMus::InitNativeWidget(const Widget::InitParams& params) { |
focus_client_.get()); |
aura::client::SetActivationClient(window_tree_host_->window(), |
focus_client_.get()); |
+ window_tree_client_.reset( |
+ new NativeWidgetMusWindowTreeClient(window_tree_host_->window())); |
window_tree_host_->window()->AddPreTargetHandler(focus_client_.get()); |
window_tree_host_->window()->SetLayoutManager( |
new ContentWindowLayoutManager(window_tree_host_->window(), content_)); |
@@ -190,6 +216,7 @@ void NativeWidgetMus::InitNativeWidget(const Widget::InitParams& params) { |
content_->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
content_->Init(ui::LAYER_TEXTURED); |
+ content_->Show(); |
content_->SetTransparent(true); |
content_->SetFillsBoundsCompletely(false); |
@@ -374,8 +401,8 @@ void NativeWidgetMus::ShowWithWindowState(ui::WindowShowState state) { |
} |
bool NativeWidgetMus::IsVisible() const { |
- // NOTIMPLEMENTED(); |
- return true; |
+ // TODO(beng): this should probably be wired thru PlatformWindow. |
+ return window_tree_host_->mus_window()->visible(); |
} |
void NativeWidgetMus::Activate() { |