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

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

Issue 1462123002: views/mus: Set-up transient windows correctly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tot.merge Created 4 years, 11 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
« no previous file with comments | « mash/wm/property_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6c644a80a7674556af23c1bbcc639adee7b0ff9f..11b77a2e6966e5d6978723c95e6f707dd0641756 100644
--- a/ui/views/mus/native_widget_mus.cc
+++ b/ui/views/mus/native_widget_mus.cc
@@ -16,6 +16,7 @@
#include "ui/aura/layout_manager.h"
#include "ui/aura/mus/mus_util.h"
#include "ui/aura/window.h"
+#include "ui/aura/window_property.h"
#include "ui/base/hit_test.h"
#include "ui/gfx/canvas.h"
#include "ui/native_theme/native_theme_aura.h"
@@ -30,9 +31,13 @@
#include "ui/wm/core/capture_controller.h"
#include "ui/wm/core/focus_controller.h"
+DECLARE_WINDOW_PROPERTY_TYPE(mus::Window*);
+
namespace views {
namespace {
+DEFINE_WINDOW_PROPERTY_KEY(mus::Window*, kMusWindow, nullptr);
+
// TODO: figure out what this should be.
class FocusRulesImpl : public wm::BaseFocusRules {
public:
@@ -288,6 +293,7 @@ void NativeWidgetMus::InitNativeWidget(const Widget::InitParams& params) {
window_tree_host_->AddObserver(this);
window_tree_host_->InitHost();
aura::Env::GetInstance()->set_context_factory(default_context_factory);
+ window_tree_host_->window()->SetProperty(kMusWindow, window_);
focus_client_.reset(new wm::FocusController(new FocusRulesImpl));
@@ -308,8 +314,16 @@ void NativeWidgetMus::InitNativeWidget(const Widget::InitParams& params) {
content_->Show();
content_->SetTransparent(true);
content_->SetFillsBoundsCompletely(false);
-
window_tree_host_->window()->AddChild(content_);
+
+ // Set-up transiency if appropriate.
+ if (params.parent && !params.child) {
+ aura::Window* parent_root = params.parent->GetRootWindow();
+ mus::Window* parent_mus = parent_root->GetProperty(kMusWindow);
+ if (parent_mus)
+ parent_mus->AddTransientWindow(window_);
+ }
+
// TODO(beng): much else, see [Desktop]NativeWidgetAura.
native_widget_delegate_->OnNativeWidgetCreated(false);
« no previous file with comments | « mash/wm/property_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698