Commit 0d06de41 authored by erg@chromium.org's avatar erg@chromium.org

linux_aura: Close window when the OS requests it.

Alt-F4 key events are handled by the window manager, who then sends an X11
message telling us that we should close. This used to be hooked up, but it
looks like it broke when we merged with the crossplatform
DesktopNativeWidgetAura code that we also use on Windows.

BUG=176783

Review URL: https://chromiumcodereview.appspot.com/15827009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202758 0039d316-1c4b-4281-b951-d872f2087c98
parent 6ce0bbc6
...@@ -178,6 +178,8 @@ DesktopNativeWidgetAura::~DesktopNativeWidgetAura() { ...@@ -178,6 +178,8 @@ DesktopNativeWidgetAura::~DesktopNativeWidgetAura() {
CloseNow(); CloseNow();
stacking_client_.reset(); // Uses root_window_ at destruction. stacking_client_.reset(); // Uses root_window_ at destruction.
root_window_->RemoveRootWindowObserver(this);
root_window_.reset(); // Uses input_method_event_filter_ at destruction. root_window_.reset(); // Uses input_method_event_filter_ at destruction.
input_method_event_filter_.reset(); input_method_event_filter_.reset();
} }
...@@ -235,6 +237,8 @@ void DesktopNativeWidgetAura::InitNativeWidget( ...@@ -235,6 +237,8 @@ void DesktopNativeWidgetAura::InitNativeWidget(
this, params.bounds); this, params.bounds);
root_window_.reset( root_window_.reset(
desktop_root_window_host_->Init(window_, params)); desktop_root_window_host_->Init(window_, params));
root_window_->AddRootWindowObserver(this);
stacking_client_.reset( stacking_client_.reset(
new DesktopNativeWidgetAuraStackingClient(root_window_.get())); new DesktopNativeWidgetAuraStackingClient(root_window_.get()));
drop_helper_.reset(new DropHelper( drop_helper_.reset(new DropHelper(
...@@ -842,4 +846,12 @@ int DesktopNativeWidgetAura::OnPerformDrop(const ui::DropTargetEvent& event) { ...@@ -842,4 +846,12 @@ int DesktopNativeWidgetAura::OnPerformDrop(const ui::DropTargetEvent& event) {
last_drop_operation_); last_drop_operation_);
} }
////////////////////////////////////////////////////////////////////////////////
// DesktopNativeWidgetAura, aura::RootWindowObserver implementation:
void DesktopNativeWidgetAura::OnRootWindowHostCloseRequested(
const aura::RootWindow* root) {
Close();
}
} // namespace views } // namespace views
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "ui/aura/client/activation_delegate.h" #include "ui/aura/client/activation_delegate.h"
#include "ui/aura/client/drag_drop_delegate.h" #include "ui/aura/client/drag_drop_delegate.h"
#include "ui/aura/client/focus_change_observer.h" #include "ui/aura/client/focus_change_observer.h"
#include "ui/aura/root_window_observer.h"
#include "ui/aura/window_delegate.h" #include "ui/aura/window_delegate.h"
#include "ui/views/ime/input_method_delegate.h" #include "ui/views/ime/input_method_delegate.h"
#include "ui/views/widget/native_widget_private.h" #include "ui/views/widget/native_widget_private.h"
...@@ -44,7 +45,8 @@ class VIEWS_EXPORT DesktopNativeWidgetAura ...@@ -44,7 +45,8 @@ class VIEWS_EXPORT DesktopNativeWidgetAura
public aura::client::ActivationChangeObserver, public aura::client::ActivationChangeObserver,
public aura::client::FocusChangeObserver, public aura::client::FocusChangeObserver,
public views::internal::InputMethodDelegate, public views::internal::InputMethodDelegate,
public aura::client::DragDropDelegate { public aura::client::DragDropDelegate,
public aura::RootWindowObserver {
public: public:
explicit DesktopNativeWidgetAura(internal::NativeWidgetDelegate* delegate); explicit DesktopNativeWidgetAura(internal::NativeWidgetDelegate* delegate);
virtual ~DesktopNativeWidgetAura(); virtual ~DesktopNativeWidgetAura();
...@@ -193,6 +195,10 @@ class VIEWS_EXPORT DesktopNativeWidgetAura ...@@ -193,6 +195,10 @@ class VIEWS_EXPORT DesktopNativeWidgetAura
virtual void OnDragExited() OVERRIDE; virtual void OnDragExited() OVERRIDE;
virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE;
// Overridden from aura::RootWindowObserver:
virtual void OnRootWindowHostCloseRequested(
const aura::RootWindow* root) OVERRIDE;
private: private:
// See class documentation for Widget in widget.h for a note about ownership. // See class documentation for Widget in widget.h for a note about ownership.
Widget::InitParams::Ownership ownership_; Widget::InitParams::Ownership ownership_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment