summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-12 20:17:24 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-12 20:17:24 +0000
commitbc86070a59cb7812fe9afd0dde467667fd0ea851 (patch)
tree6f2f47549317fdcf24026715fa9166f1f1200475 /ui
parent6cbf3b96ca8ad1f68f6531b14739dddf2caada0f (diff)
downloadchromium_src-bc86070a59cb7812fe9afd0dde467667fd0ea851.zip
chromium_src-bc86070a59cb7812fe9afd0dde467667fd0ea851.tar.gz
chromium_src-bc86070a59cb7812fe9afd0dde467667fd0ea851.tar.bz2
Revert 172624 - Remove a bunch of stuff related to Focus/Activation events.
http://crbug.com/162100 R=sadrul@chromium.org Review URL: https://codereview.chromium.org/11537019 TBR=ben@chromium.org Review URL: https://codereview.chromium.org/11558027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172646 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/views/controls/menu/menu_controller_aura.cc11
-rw-r--r--ui/views/corewm/activation_change_shim.cc41
-rw-r--r--ui/views/corewm/activation_change_shim.h48
-rw-r--r--ui/views/corewm/focus_change_event.cc64
-rw-r--r--ui/views/corewm/focus_change_event.h86
-rw-r--r--ui/views/corewm/focus_change_shim.cc39
-rw-r--r--ui/views/corewm/focus_change_shim.h48
-rw-r--r--ui/views/corewm/focus_controller.cc1
-rw-r--r--ui/views/corewm/focus_controller.h4
-rw-r--r--ui/views/corewm/focus_controller_unittest.cc1
-rw-r--r--ui/views/corewm/shadow_controller.cc23
-rw-r--r--ui/views/corewm/shadow_controller.h10
-rw-r--r--ui/views/views.gyp6
-rw-r--r--ui/views/widget/native_widget_aura_window_observer.cc10
-rw-r--r--ui/views/widget/native_widget_aura_window_observer.h8
15 files changed, 368 insertions, 32 deletions
diff --git a/ui/views/controls/menu/menu_controller_aura.cc b/ui/views/controls/menu/menu_controller_aura.cc
index 3051903..d5c6295 100644
--- a/ui/views/controls/menu/menu_controller_aura.cc
+++ b/ui/views/controls/menu/menu_controller_aura.cc
@@ -5,13 +5,13 @@
#include "ui/views/controls/menu/menu_controller.h"
#include "base/run_loop.h"
-#include "ui/aura/client/activation_change_observer.h"
#include "ui/aura/client/activation_client.h"
#include "ui/aura/client/dispatcher_client.h"
#include "ui/aura/client/drag_drop_client.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window_observer.h"
#include "ui/gfx/screen.h"
+#include "ui/views/corewm/activation_change_shim.h"
#include "ui/views/widget/widget.h"
namespace views {
@@ -22,12 +22,13 @@ namespace {
// the menu. Additionally it listens for the root window to be destroyed and
// cancel the menu as well.
class ActivationChangeObserverImpl
- : public aura::client::ActivationChangeObserver,
+ : public corewm::ActivationChangeShim,
public aura::WindowObserver {
public:
ActivationChangeObserverImpl(MenuController* controller,
aura::RootWindow* root)
- : controller_(controller),
+ : ActivationChangeShim(root),
+ controller_(controller),
root_(root) {
aura::client::GetActivationClient(root_)->AddObserver(this);
root_->AddObserver(this);
@@ -38,8 +39,8 @@ class ActivationChangeObserverImpl
}
// aura::client::ActivationChangeObserver overrides:
- virtual void OnWindowActivated(aura::Window* gained_active,
- aura::Window* lost_active) OVERRIDE {
+ virtual void OnWindowActivated(aura::Window* active,
+ aura::Window* old_active) OVERRIDE {
if (!controller_->drag_in_progress())
controller_->CancelAll();
}
diff --git a/ui/views/corewm/activation_change_shim.cc b/ui/views/corewm/activation_change_shim.cc
new file mode 100644
index 0000000..97c8b82
--- /dev/null
+++ b/ui/views/corewm/activation_change_shim.cc
@@ -0,0 +1,41 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/views/corewm/activation_change_shim.h"
+
+#include "ui/aura/window.h"
+#include "ui/base/events/event_target.h"
+#include "ui/views/corewm/corewm_switches.h"
+#include "ui/views/corewm/focus_change_event.h"
+
+namespace views {
+namespace corewm {
+
+ActivationChangeShim::ActivationChangeShim(ui::EventTarget* target)
+ : target_(target) {
+ if (UseFocusController() && target_)
+ target_->AddPreTargetHandler(this);
+}
+
+ActivationChangeShim::~ActivationChangeShim() {
+ if (UseFocusController() && target_)
+ target_->RemovePreTargetHandler(this);
+}
+
+void ActivationChangeShim::OnWindowActivated(aura::Window* active,
+ aura::Window* old_active) {
+}
+
+void ActivationChangeShim::OnEvent(ui::Event* event) {
+ if (event->type() == FocusChangeEvent::activation_changed_event_type()) {
+ DCHECK(UseFocusController());
+ FocusChangeEvent* fce = static_cast<FocusChangeEvent*>(event);
+ OnWindowActivated(static_cast<aura::Window*>(event->target()),
+ static_cast<aura::Window*>(fce->last_focus()));
+ }
+ EventHandler::OnEvent(event);
+}
+
+} // namespace corewm
+} // namespace views
diff --git a/ui/views/corewm/activation_change_shim.h b/ui/views/corewm/activation_change_shim.h
new file mode 100644
index 0000000..77bed97
--- /dev/null
+++ b/ui/views/corewm/activation_change_shim.h
@@ -0,0 +1,48 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_VIEWS_COREWM_ACTIVATION_CHANGE_SHIM_
+#define UI_VIEWS_COREWM_ACTIVATION_CHANGE_SHIM_
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "ui/aura/client/activation_change_observer.h"
+#include "ui/base/events/event_handler.h"
+#include "ui/views/corewm/focus_change_event.h"
+#include "ui/views/views_export.h"
+
+namespace ui {
+class EventTarget;
+}
+
+namespace views {
+namespace corewm {
+
+// A class that converts FocusChangeEvents to calls to an
+// ActivationChangeObserver. An interim bandaid that allows us to incrementally
+// convert observers to use the new FocusController.
+class VIEWS_EXPORT ActivationChangeShim
+ : public aura::client::ActivationChangeObserver,
+ public ui::EventHandler {
+ protected:
+ explicit ActivationChangeShim(ui::EventTarget* target);
+ virtual ~ActivationChangeShim();
+
+ // Overridden from aura::client::ActivationChangeObserver:
+ virtual void OnWindowActivated(aura::Window* active,
+ aura::Window* old_active) OVERRIDE;
+
+ // Overridden from ui::EventHandler:
+ virtual void OnEvent(ui::Event* event) OVERRIDE;
+
+ private:
+ ui::EventTarget* target_;
+
+ DISALLOW_COPY_AND_ASSIGN(ActivationChangeShim);
+};
+
+} // namespace corewm
+} // namespace views
+
+#endif // UI_VIEWS_COREWM_ACTIVATION_CHANGE_SHIM_
diff --git a/ui/views/corewm/focus_change_event.cc b/ui/views/corewm/focus_change_event.cc
new file mode 100644
index 0000000..90a943e
--- /dev/null
+++ b/ui/views/corewm/focus_change_event.cc
@@ -0,0 +1,64 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/views/corewm/focus_change_event.h"
+
+#include "base/time.h"
+#include "ui/base/events/event_utils.h"
+
+namespace views {
+namespace corewm {
+
+namespace {
+
+std::string FocusChangeEventName(int type) {
+ if (type == FocusChangeEvent::focus_changing_event_type())
+ return "FOCUS_CHANGING";
+ if (type == FocusChangeEvent::focus_changed_event_type())
+ return "FOCUS_CHANGED";
+ if (type == FocusChangeEvent::activation_changing_event_type())
+ return "ACTIVATION_CHANGING";
+ if (type == FocusChangeEvent::activation_changed_event_type())
+ return "ACTIVATION_CHANGED";
+ NOTREACHED();
+ return std::string();
+}
+
+} // namespace
+
+// static
+int FocusChangeEvent::focus_changing_event_type_ = ui::ET_UNKNOWN;
+int FocusChangeEvent::focus_changed_event_type_ = ui::ET_UNKNOWN;
+int FocusChangeEvent::activation_changing_event_type_ = ui::ET_UNKNOWN;
+int FocusChangeEvent::activation_changed_event_type_ = ui::ET_UNKNOWN;
+
+FocusChangeEvent::FocusChangeEvent(int type)
+ : Event(static_cast<ui::EventType>(type),
+ base::TimeDelta::FromMilliseconds(base::Time::Now().ToDoubleT()),
+ 0),
+ last_focus_(NULL) {
+ DCHECK_NE(type, ui::ET_UNKNOWN) <<
+ "Call RegisterEventTypes() before instantiating this class";
+ set_cancelable(false);
+ set_dispatch_to_hidden_targets(true);
+ set_name(FocusChangeEventName(type));
+}
+
+FocusChangeEvent::~FocusChangeEvent() {
+}
+
+// static
+void FocusChangeEvent::RegisterEventTypes() {
+ static bool registered = false;
+ if (!registered) {
+ registered = true;
+ focus_changing_event_type_ = ui::RegisterCustomEventType();
+ focus_changed_event_type_ = ui::RegisterCustomEventType();
+ activation_changing_event_type_ = ui::RegisterCustomEventType();
+ activation_changed_event_type_ = ui::RegisterCustomEventType();
+ }
+}
+
+} // namespace corewm
+} // namespace views
diff --git a/ui/views/corewm/focus_change_event.h b/ui/views/corewm/focus_change_event.h
new file mode 100644
index 0000000..8222bae
--- /dev/null
+++ b/ui/views/corewm/focus_change_event.h
@@ -0,0 +1,86 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_VIEWS_COREWM_FOCUS_CHANGE_EVENT_H_
+#define UI_VIEWS_COREWM_FOCUS_CHANGE_EVENT_H_
+
+#include "ui/base/events/event.h"
+#include "ui/base/events/event_target.h"
+#include "ui/views/views_export.h"
+
+namespace views {
+namespace corewm {
+
+// FocusChangeEvent notifies a change in focus or activation state.
+// Focus refers to the target that can receive key events.
+// Activation is the key "top level window" as defined by the window management
+// scheme in use.
+// Focus and activation are closely related, and the rules governing their
+// change are numerous and complex. The implementation of the dispatch of this
+// event is handled by the FocusController. See that class and its unit tests
+// for specifics.
+class VIEWS_EXPORT FocusChangeEvent : public ui::Event {
+ public:
+ // An API used by the code in FocusController that dispatches
+ // FocusChangeEvents.
+ class DispatcherApi : public ui::Event::DispatcherApi {
+ public:
+ explicit DispatcherApi(FocusChangeEvent* event)
+ : ui::Event::DispatcherApi(event), event_(event) {}
+
+ void set_last_focus(ui::EventTarget* last_focus) {
+ event_->last_focus_ = last_focus;
+ }
+
+ private:
+ FocusChangeEvent* event_;
+
+ DISALLOW_COPY_AND_ASSIGN(DispatcherApi);
+ };
+
+ // |type| is one of the possible FocusChangeEvent types registered by calling
+ // RegisterEventTypes() before instantiating this class. See below.
+ explicit FocusChangeEvent(int type);
+ virtual ~FocusChangeEvent();
+
+ // Must be called before instantiating this class.
+ static void RegisterEventTypes();
+
+ // -ing events are sent when focus or activation is about to be changed. This
+ // gives the target and its pre- and post- handlers the ability to abort the
+ // or re-target the change before the FocusController makes it.
+ static int focus_changing_event_type() { return focus_changing_event_type_; }
+ static int activation_changing_event_type() {
+ return activation_changing_event_type_;
+ }
+
+ // -ed events are sent when focus or activation has been changed in the
+ // FocusController. It is possible to stop propagation of this event but that
+ // only affects handlers downstream from being notified of the change already
+ // made in the FocusController.
+ static int focus_changed_event_type() { return focus_changed_event_type_; }
+ static int activation_changed_event_type() {
+ return activation_changed_event_type_;
+ }
+
+ ui::EventTarget* last_focus() { return last_focus_; }
+
+ private:
+ FocusChangeEvent();
+
+ // The EventTarget that had focus or activation prior to this event.
+ ui::EventTarget* last_focus_;
+
+ static int focus_changing_event_type_;
+ static int focus_changed_event_type_;
+ static int activation_changing_event_type_;
+ static int activation_changed_event_type_;
+
+ DISALLOW_COPY_AND_ASSIGN(FocusChangeEvent);
+};
+
+} // namespace corewm
+} // namespace views
+
+#endif // UI_VIEWS_COREWM_FOCUS_CHANGE_EVENT_H_
diff --git a/ui/views/corewm/focus_change_shim.cc b/ui/views/corewm/focus_change_shim.cc
new file mode 100644
index 0000000..6db643d
--- /dev/null
+++ b/ui/views/corewm/focus_change_shim.cc
@@ -0,0 +1,39 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/views/corewm/focus_change_shim.h"
+
+#include "ui/aura/window.h"
+#include "ui/base/events/event_target.h"
+#include "ui/views/corewm/corewm_switches.h"
+#include "ui/views/corewm/focus_change_event.h"
+
+namespace views {
+namespace corewm {
+
+FocusChangeShim::FocusChangeShim(ui::EventTarget* target)
+ : target_(target) {
+ if (views::corewm::UseFocusController() && target_)
+ target_->AddPreTargetHandler(this);
+}
+
+FocusChangeShim::~FocusChangeShim() {
+ if (views::corewm::UseFocusController() && target_)
+ target_->RemovePreTargetHandler(this);
+}
+
+void FocusChangeShim::OnWindowFocused(aura::Window* gained_focus,
+ aura::Window* lost_focus) {
+}
+
+void FocusChangeShim::OnEvent(ui::Event* event) {
+ if (event->type() == FocusChangeEvent::focus_changed_event_type()) {
+ DCHECK(views::corewm::UseFocusController());
+ OnWindowFocused(static_cast<aura::Window*>(event->target()), NULL);
+ }
+ EventHandler::OnEvent(event);
+}
+
+} // namespace corewm
+} // namespace views
diff --git a/ui/views/corewm/focus_change_shim.h b/ui/views/corewm/focus_change_shim.h
new file mode 100644
index 0000000..1f0f496
--- /dev/null
+++ b/ui/views/corewm/focus_change_shim.h
@@ -0,0 +1,48 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_VIEWS_COREWM_FOCUS_CHANGE_SHIM_
+#define UI_VIEWS_COREWM_FOCUS_CHANGE_SHIM_
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "ui/aura/client/focus_change_observer.h"
+#include "ui/base/events/event_handler.h"
+#include "ui/views/corewm/focus_change_event.h"
+#include "ui/views/views_export.h"
+
+namespace ui {
+class EventTarget;
+}
+
+namespace views {
+namespace corewm {
+
+// A class that converts FocusChangeEvents to calls to an
+// FocusChangeObserver. An interim bandaid that allows us to incrementally
+// convert observers to use the new FocusController.
+class VIEWS_EXPORT FocusChangeShim
+ : public aura::client::FocusChangeObserver,
+ public ui::EventHandler {
+ protected:
+ explicit FocusChangeShim(ui::EventTarget* target);
+ virtual ~FocusChangeShim();
+
+ // Overridden from aura::client::FocusChangeObserver:
+ virtual void OnWindowFocused(aura::Window* gained_focus,
+ aura::Window* lost_focus) OVERRIDE;
+
+ // Overridden from ui::EventHandler:
+ virtual void OnEvent(ui::Event* event) OVERRIDE;
+
+ private:
+ ui::EventTarget* target_;
+
+ DISALLOW_COPY_AND_ASSIGN(FocusChangeShim);
+};
+
+} // namespace corewm
+} // namespace views
+
+#endif // UI_VIEWS_COREWM_FOCUS_CHANGE_SHIM_
diff --git a/ui/views/corewm/focus_controller.cc b/ui/views/corewm/focus_controller.cc
index 088f837..41d6c61 100644
--- a/ui/views/corewm/focus_controller.cc
+++ b/ui/views/corewm/focus_controller.cc
@@ -9,7 +9,6 @@
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/focus_change_observer.h"
#include "ui/aura/env.h"
-#include "ui/base/events/event.h"
#include "ui/views/corewm/focus_rules.h"
namespace views {
diff --git a/ui/views/corewm/focus_controller.h b/ui/views/corewm/focus_controller.h
index 780ee15..f799d62 100644
--- a/ui/views/corewm/focus_controller.h
+++ b/ui/views/corewm/focus_controller.h
@@ -11,6 +11,7 @@
#include "ui/aura/client/focus_client.h"
#include "ui/aura/env_observer.h"
#include "ui/aura/window_observer.h"
+#include "ui/base/events/event_dispatcher.h"
#include "ui/views/views_export.h"
namespace views {
@@ -21,8 +22,7 @@ class FocusRules;
// FocusController handles focus and activation changes for an environment
// encompassing one or more RootWindows. Within an environment there can be
// only one focused and one active window at a time. When focus or activation
-// changes notifications are sent using the
-// aura::client::Focus/ActivationChangeObserver interfaces.
+// changes a FocusChangeEvent is dispatched.
// Changes to focus and activation can be from three sources:
// . the Aura Client API (implemented here in aura::client::ActivationClient).
// (The FocusController must be set as the ActivationClient implementation
diff --git a/ui/views/corewm/focus_controller_unittest.cc b/ui/views/corewm/focus_controller_unittest.cc
index a74346d..3ca5c21 100644
--- a/ui/views/corewm/focus_controller_unittest.cc
+++ b/ui/views/corewm/focus_controller_unittest.cc
@@ -18,6 +18,7 @@
#include "ui/aura/window_tracker.h"
#include "ui/base/events/event_handler.h"
#include "ui/views/corewm/base_focus_rules.h"
+#include "ui/views/corewm/focus_change_event.h"
namespace views {
namespace corewm {
diff --git a/ui/views/corewm/shadow_controller.cc b/ui/views/corewm/shadow_controller.cc
index 5ab2106..0c587b3 100644
--- a/ui/views/corewm/shadow_controller.cc
+++ b/ui/views/corewm/shadow_controller.cc
@@ -67,7 +67,8 @@ Shadow::Style GetShadowStyleForWindowLosingActive(
} // namespace
ShadowController::ShadowController(aura::RootWindow* root_window)
- : ALLOW_THIS_IN_INITIALIZER_LIST(observer_manager_(this)),
+ : ActivationChangeShim(root_window),
+ ALLOW_THIS_IN_INITIALIZER_LIST(observer_manager_(this)),
root_window_(root_window) {
aura::Env::GetInstance()->AddObserver(this);
// Watch for window activation changes.
@@ -107,18 +108,18 @@ void ShadowController::OnWindowDestroyed(aura::Window* window) {
observer_manager_.Remove(window);
}
-void ShadowController::OnWindowActivated(aura::Window* gained_active,
- aura::Window* lost_active) {
- if (gained_active) {
- Shadow* shadow = GetShadowForWindow(gained_active);
- if (shadow && !ShouldUseSmallShadowForWindow(gained_active))
+void ShadowController::OnWindowActivated(aura::Window* gaining_active,
+ aura::Window* losing_active) {
+ if (gaining_active) {
+ Shadow* shadow = GetShadowForWindow(gaining_active);
+ if (shadow && !ShouldUseSmallShadowForWindow(gaining_active))
shadow->SetStyle(Shadow::STYLE_ACTIVE);
}
- if (lost_active) {
- Shadow* shadow = GetShadowForWindow(lost_active);
- if (shadow && !ShouldUseSmallShadowForWindow(lost_active)) {
- shadow->SetStyle(GetShadowStyleForWindowLosingActive(lost_active,
- gained_active));
+ if (losing_active) {
+ Shadow* shadow = GetShadowForWindow(losing_active);
+ if (shadow && !ShouldUseSmallShadowForWindow(losing_active)) {
+ shadow->SetStyle(GetShadowStyleForWindowLosingActive(losing_active,
+ gaining_active));
}
}
}
diff --git a/ui/views/corewm/shadow_controller.h b/ui/views/corewm/shadow_controller.h
index 68381fc..8c8bd72 100644
--- a/ui/views/corewm/shadow_controller.h
+++ b/ui/views/corewm/shadow_controller.h
@@ -11,9 +11,9 @@
#include "base/compiler_specific.h"
#include "base/memory/linked_ptr.h"
#include "base/scoped_observer.h"
-#include "ui/aura/client/activation_change_observer.h"
#include "ui/aura/env_observer.h"
#include "ui/aura/window_observer.h"
+#include "ui/views/corewm/activation_change_shim.h"
#include "ui/views/views_export.h"
namespace aura {
@@ -34,7 +34,7 @@ class Shadow;
class VIEWS_EXPORT ShadowController :
public aura::EnvObserver,
public aura::WindowObserver,
- public aura::client::ActivationChangeObserver {
+ public ActivationChangeShim {
public:
class TestApi {
public:
@@ -66,9 +66,9 @@ class VIEWS_EXPORT ShadowController :
const gfx::Rect& new_bounds) OVERRIDE;
virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE;
- // aura::client::ActivationChangeObserver overrides:
- virtual void OnWindowActivated(aura::Window* gained_active,
- aura::Window* lost_active) OVERRIDE;
+ // ActivationChangeShim overrides:
+ virtual void OnWindowActivated(aura::Window* active,
+ aura::Window* old_active) OVERRIDE;
private:
typedef std::map<aura::Window*, linked_ptr<Shadow> > WindowShadowMap;
diff --git a/ui/views/views.gyp b/ui/views/views.gyp
index adbe911..38f72cc 100644
--- a/ui/views/views.gyp
+++ b/ui/views/views.gyp
@@ -237,12 +237,18 @@
'controls/tree/tree_view_views.h',
'controls/tree/tree_view_win.cc',
'controls/tree/tree_view_win.h',
+ 'corewm/activation_change_shim.cc',
+ 'corewm/activation_change_shim.h',
'corewm/base_focus_rules.cc',
'corewm/base_focus_rules.h',
'corewm/compound_event_filter.cc',
'corewm/compound_event_filter.h',
'corewm/corewm_switches.cc',
'corewm/corewm_switches.h',
+ 'corewm/focus_change_event.cc',
+ 'corewm/focus_change_event.h',
+ 'corewm/focus_change_shim.cc',
+ 'corewm/focus_change_shim.h',
'corewm/focus_controller.cc',
'corewm/focus_controller.h',
'corewm/focus_rules.h',
diff --git a/ui/views/widget/native_widget_aura_window_observer.cc b/ui/views/widget/native_widget_aura_window_observer.cc
index 3be33dd..dc101b4 100644
--- a/ui/views/widget/native_widget_aura_window_observer.cc
+++ b/ui/views/widget/native_widget_aura_window_observer.cc
@@ -13,7 +13,8 @@ namespace views {
NativeWidgetAuraWindowObserver::NativeWidgetAuraWindowObserver(
gfx::NativeView native_view,
internal::NativeWidgetDelegate* delegate)
- : native_view_(native_view),
+ : ActivationChangeShim(native_view->GetRootWindow()),
+ native_view_(native_view),
delegate_(delegate) {
native_view_->GetRootWindow()->AddObserver(this);
native_view_->AddObserver(this);
@@ -26,10 +27,11 @@ NativeWidgetAuraWindowObserver::~NativeWidgetAuraWindowObserver() {
}
void NativeWidgetAuraWindowObserver::OnWindowActivated(
- aura::Window* gained_active,
- aura::Window* lost_active) {
- if (!gained_active || gained_active->transient_parent() != native_view_)
+ aura::Window* active,
+ aura::Window* old_active) {
+ if (!active || active->transient_parent() != native_view_) {
delegate_->EnableInactiveRendering();
+ }
}
void NativeWidgetAuraWindowObserver::OnWindowRemovingFromRootWindow(
diff --git a/ui/views/widget/native_widget_aura_window_observer.h b/ui/views/widget/native_widget_aura_window_observer.h
index 70a6037..380a7fb 100644
--- a/ui/views/widget/native_widget_aura_window_observer.h
+++ b/ui/views/widget/native_widget_aura_window_observer.h
@@ -6,9 +6,9 @@
#define UI_VIEWS_WIDGET_NATIVE_WIDGET_AURA_WINDOW_OBSERVER_H_
#include "base/compiler_specific.h"
-#include "ui/aura/client/activation_change_observer.h"
#include "ui/aura/window_observer.h"
#include "ui/gfx/native_widget_types.h"
+#include "ui/views/corewm/activation_change_shim.h"
#include "ui/views/widget/native_widget_private.h"
namespace views {
@@ -18,7 +18,7 @@ namespace views {
// changes in such a way that we should enable inactive rendering.
class NativeWidgetAuraWindowObserver
: public aura::WindowObserver,
- public aura::client::ActivationChangeObserver {
+ public corewm::ActivationChangeShim {
public:
explicit NativeWidgetAuraWindowObserver(
gfx::NativeView native_view,
@@ -26,8 +26,8 @@ class NativeWidgetAuraWindowObserver
virtual ~NativeWidgetAuraWindowObserver();
// Overridden from aura::client::ActivationChangeObserver:
- virtual void OnWindowActivated(aura::Window* gained_active,
- aura::Window* lost_active) OVERRIDE;
+ virtual void OnWindowActivated(aura::Window* active,
+ aura::Window* old_active) OVERRIDE;
// Overridden from aura::WindowObserver:
virtual void OnWindowRemovingFromRootWindow(aura::Window* window) OVERRIDE;