diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-27 00:19:13 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-27 00:19:13 +0000 |
commit | b8b456ce8db6d7d081e80c675c9282e3d956e27b (patch) | |
tree | e3cc5e52d14d4de5848f499a0994da105a829d30 /views/widget | |
parent | d5cf9fbc833bd243a92beaeee43da5745b3ac50d (diff) | |
download | chromium_src-b8b456ce8db6d7d081e80c675c9282e3d956e27b.zip chromium_src-b8b456ce8db6d7d081e80c675c9282e3d956e27b.tar.gz chromium_src-b8b456ce8db6d7d081e80c675c9282e3d956e27b.tar.bz2 |
Adds support for activation to aura.
BUG=93938
TEST=none
R=ben@chromium.org
Review URL: http://codereview.chromium.org/8041023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102840 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/widget')
-rw-r--r-- | views/widget/native_widget_aura.cc | 20 | ||||
-rw-r--r-- | views/widget/native_widget_aura.h | 5 |
2 files changed, 24 insertions, 1 deletions
diff --git a/views/widget/native_widget_aura.cc b/views/widget/native_widget_aura.cc index 43e39d5..f85ff1a 100644 --- a/views/widget/native_widget_aura.cc +++ b/views/widget/native_widget_aura.cc @@ -27,7 +27,8 @@ NativeWidgetAura::NativeWidgetAura(internal::NativeWidgetDelegate* delegate) : delegate_(delegate), ALLOW_THIS_IN_INITIALIZER_LIST(window_(new aura::Window(this))), ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET), - ALLOW_THIS_IN_INITIALIZER_LIST(close_widget_factory_(this)) { + ALLOW_THIS_IN_INITIALIZER_LIST(close_widget_factory_(this)), + can_activate_(true) { } NativeWidgetAura::~NativeWidgetAura() { @@ -63,6 +64,7 @@ void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) { // TODO(beng): do this some other way. delegate_->OnNativeWidgetSizeChanged(params.bounds.size()); window_->SetVisibility(aura::Window::VISIBILITY_SHOWN); + can_activate_ = params.can_activate; } NonClientFrameView* NativeWidgetAura::CreateNonClientFrameView() { @@ -410,6 +412,22 @@ bool NativeWidgetAura::OnMouseEvent(aura::MouseEvent* event) { return delegate_->OnMouseEvent(MouseEvent(event)); } +bool NativeWidgetAura::ShouldActivate(aura::MouseEvent* event) { + return can_activate_; +} + +void NativeWidgetAura::OnActivated() { + delegate_->OnNativeWidgetActivationChanged(true); + if (IsVisible()) + GetWidget()->non_client_view()->SchedulePaint(); +} + +void NativeWidgetAura::OnLostActive() { + delegate_->OnNativeWidgetActivationChanged(false); + if (IsVisible()) + GetWidget()->non_client_view()->SchedulePaint(); +} + void NativeWidgetAura::OnCaptureLost() { delegate_->OnMouseCaptureLost(); } diff --git a/views/widget/native_widget_aura.h b/views/widget/native_widget_aura.h index bf4c84a..d3283be 100644 --- a/views/widget/native_widget_aura.h +++ b/views/widget/native_widget_aura.h @@ -123,6 +123,9 @@ class VIEWS_EXPORT NativeWidgetAura : public internal::NativeWidgetPrivate, virtual bool OnKeyEvent(aura::KeyEvent* event) OVERRIDE; virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE; virtual bool OnMouseEvent(aura::MouseEvent* event) OVERRIDE; + virtual bool ShouldActivate(aura::MouseEvent* event) OVERRIDE; + virtual void OnActivated() OVERRIDE; + virtual void OnLostActive() OVERRIDE; virtual void OnCaptureLost() OVERRIDE; virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; virtual void OnWindowDestroying() OVERRIDE; @@ -140,6 +143,8 @@ class VIEWS_EXPORT NativeWidgetAura : public internal::NativeWidgetPrivate, // instance. ScopedRunnableMethodFactory<NativeWidgetAura> close_widget_factory_; + bool can_activate_; + DISALLOW_COPY_AND_ASSIGN(NativeWidgetAura); }; |