summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--ash/root_window_controller_unittest.cc1
-rw-r--r--ash/shell.cc15
-rw-r--r--ash/shell.h11
-rw-r--r--ash/test/test_activation_delegate.cc1
-rw-r--r--ash/wm/app_list_controller.cc3
-rw-r--r--ash/wm/app_list_controller.h5
-rw-r--r--ash/wm/base_layout_manager.cc28
-rw-r--r--ash/wm/base_layout_manager.h21
-rw-r--r--ash/wm/panel_layout_manager.cc15
-rw-r--r--ash/wm/panel_layout_manager.h8
-rw-r--r--ash/wm/shelf_layout_manager.cc8
-rw-r--r--ash/wm/shelf_layout_manager.h8
-rw-r--r--ash/wm/window_cycle_controller.cc14
-rw-r--r--ash/wm/window_cycle_controller.h10
-rw-r--r--ash/wm/workspace_controller.cc13
-rw-r--r--ash/wm/workspace_controller.h8
-rw-r--r--chrome/browser/ui/ash/launcher/shell_window_launcher_controller.cc4
-rw-r--r--chrome/browser/ui/ash/launcher/shell_window_launcher_controller.h8
-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
33 files changed, 453 insertions, 128 deletions
diff --git a/ash/root_window_controller_unittest.cc b/ash/root_window_controller_unittest.cc
index 793e03c..9de5b8c 100644
--- a/ash/root_window_controller_unittest.cc
+++ b/ash/root_window_controller_unittest.cc
@@ -22,6 +22,7 @@
#include "ui/aura/window.h"
#include "ui/aura/window_tracker.h"
#include "ui/views/controls/menu/menu_controller.h"
+#include "ui/views/corewm/focus_change_event.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h"
diff --git a/ash/shell.cc b/ash/shell.cc
index 1651251..de1721d 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -87,6 +87,7 @@
#include "ui/ui_controls/ui_controls.h"
#include "ui/views/corewm/compound_event_filter.h"
#include "ui/views/corewm/corewm_switches.h"
+#include "ui/views/corewm/focus_change_event.h"
#include "ui/views/corewm/focus_controller.h"
#include "ui/views/corewm/input_method_event_filter.h"
#include "ui/views/corewm/shadow_controller.h"
@@ -413,7 +414,6 @@ void Shell::Init() {
new views::corewm::FocusController(new wm::AshFocusRules);
focus_client_.reset(focus_controller);
activation_client_ = focus_controller;
- activation_client_->AddObserver(this);
} else {
focus_client_.reset(new aura::FocusManager);
activation_controller_.reset(
@@ -891,14 +891,11 @@ ui::EventTarget* Shell::GetParentTarget() {
}
void Shell::OnEvent(ui::Event* event) {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// Shell, aura::client::ActivationChangeObserver implementation:
-
-void Shell::OnWindowActivated(aura::Window* gained_active,
- aura::Window* lost_active) {
- active_root_window_ = gained_active->GetRootWindow();
+ if (event->type() ==
+ views::corewm::FocusChangeEvent::activation_changed_event_type()) {
+ active_root_window_ =
+ static_cast<aura::Window*>(event->target())->GetRootWindow();
+ }
}
} // namespace ash
diff --git a/ash/shell.h b/ash/shell.h
index 5bd0fbf..b63010b 100644
--- a/ash/shell.h
+++ b/ash/shell.h
@@ -18,7 +18,6 @@
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
-#include "ui/aura/client/activation_change_observer.h"
#include "ui/base/events/event_target.h"
#include "ui/gfx/insets.h"
#include "ui/gfx/screen.h"
@@ -127,10 +126,8 @@ class ShellTestApi;
//
// Upon creation, the Shell sets itself as the RootWindow's delegate, which
// takes ownership of the Shell.
-class ASH_EXPORT Shell
- : public internal::SystemModalContainerEventFilterDelegate,
- public ui::EventTarget,
- public aura::client::ActivationChangeObserver {
+class ASH_EXPORT Shell : internal::SystemModalContainerEventFilterDelegate,
+ public ui::EventTarget {
public:
typedef std::vector<aura::RootWindow*> RootWindowList;
typedef std::vector<internal::RootWindowController*> RootWindowControllerList;
@@ -454,10 +451,6 @@ class ASH_EXPORT Shell
virtual EventTarget* GetParentTarget() OVERRIDE;
virtual void OnEvent(ui::Event* event) OVERRIDE;
- // Overridden from aura::client::ActivationChangeObserver:
- virtual void OnWindowActivated(aura::Window* gained_active,
- aura::Window* lost_active) OVERRIDE;
-
static Shell* instance_;
// If set before the Shell is initialized, the mouse cursor will be hidden
diff --git a/ash/test/test_activation_delegate.cc b/ash/test/test_activation_delegate.cc
index 5ad14d0..5c57609 100644
--- a/ash/test/test_activation_delegate.cc
+++ b/ash/test/test_activation_delegate.cc
@@ -8,6 +8,7 @@
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h"
#include "ui/base/events/event.h"
+#include "ui/views/corewm/focus_change_event.h"
namespace ash {
namespace test {
diff --git a/ash/wm/app_list_controller.cc b/ash/wm/app_list_controller.cc
index bcc85e5..d21e19f 100644
--- a/ash/wm/app_list_controller.cc
+++ b/ash/wm/app_list_controller.cc
@@ -82,7 +82,8 @@ gfx::Rect OffsetTowardsShelf(const gfx::Rect& rect, views::Widget* widget) {
// AppListController, public:
AppListController::AppListController()
- : pagination_model_(new app_list::PaginationModel),
+ : FocusChangeShim(Shell::GetInstance()),
+ pagination_model_(new app_list::PaginationModel),
is_visible_(false),
view_(NULL),
should_snap_back_(false) {
diff --git a/ash/wm/app_list_controller.h b/ash/wm/app_list_controller.h
index 9111370..07314aa 100644
--- a/ash/wm/app_list_controller.h
+++ b/ash/wm/app_list_controller.h
@@ -11,11 +11,11 @@
#include "base/compiler_specific.h"
#include "base/timer.h"
#include "ui/app_list/pagination_model_observer.h"
-#include "ui/aura/client/focus_change_observer.h"
#include "ui/aura/root_window_observer.h"
#include "ui/base/events/event_handler.h"
#include "ui/compositor/layer_animation_observer.h"
#include "ui/gfx/rect.h"
+#include "ui/views/corewm/focus_change_shim.h"
#include "ui/views/widget/widget_observer.h"
namespace app_list {
@@ -34,8 +34,7 @@ namespace internal {
// It creates AppListView and schedules showing/hiding animation.
// While the UI is visible, it monitors things such as app list widget's
// activation state and desktop mouse click to auto dismiss the UI.
-class AppListController : public ui::EventHandler,
- public aura::client::FocusChangeObserver,
+class AppListController : public views::corewm::FocusChangeShim,
public aura::RootWindowObserver,
public ui::ImplicitAnimationObserver,
public views::WidgetObserver,
diff --git a/ash/wm/base_layout_manager.cc b/ash/wm/base_layout_manager.cc
index f811bad..87c2567 100644
--- a/ash/wm/base_layout_manager.cc
+++ b/ash/wm/base_layout_manager.cc
@@ -11,13 +11,13 @@
#include "ash/wm/window_properties.h"
#include "ash/wm/window_util.h"
#include "ash/wm/workspace/workspace_window_resizer.h"
-#include "ui/aura/client/activation_client.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/base/ui_base_types.h"
#include "ui/compositor/layer.h"
#include "ui/gfx/screen.h"
+#include "ui/views/corewm/focus_change_event.h"
#include "ui/views/corewm/window_util.h"
namespace ash {
@@ -27,15 +27,16 @@ namespace internal {
// BaseLayoutManager, public:
BaseLayoutManager::BaseLayoutManager(aura::RootWindow* root_window)
- : root_window_(root_window),
- added_observer_(false) {
+ : root_window_(root_window) {
Shell::GetInstance()->AddShellObserver(this);
root_window_->AddRootWindowObserver(this);
root_window_->AddObserver(this);
+ root_window_->AddPreTargetHandler(this);
}
BaseLayoutManager::~BaseLayoutManager() {
if (root_window_) {
+ root_window_->RemovePreTargetHandler(this);
root_window_->RemoveObserver(this);
root_window_->RemoveRootWindowObserver(this);
}
@@ -66,10 +67,6 @@ void BaseLayoutManager::OnWindowResized() {
}
void BaseLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
- if (!added_observer_) {
- added_observer_ = true;
- aura::client::GetActivationClient(root_window_)->AddObserver(this);
- }
windows_.insert(child);
child->AddObserver(this);
// Only update the bounds if the window has a show state that depends on the
@@ -153,13 +150,16 @@ void BaseLayoutManager::OnWindowDestroying(aura::Window* window) {
}
//////////////////////////////////////////////////////////////////////////////
-// BaseLayoutManager, aura::client::ActivationChangeObserver implementation:
-
-void BaseLayoutManager::OnWindowActivated(aura::Window* gained_active,
- aura::Window* lost_active) {
- if (gained_active && wm::IsWindowMinimized(gained_active)) {
- gained_active->Show();
- DCHECK(!wm::IsWindowMinimized(gained_active));
+// BaseLayoutManager, ui::EventHandler implementation:
+
+void BaseLayoutManager::OnEvent(ui::Event* event) {
+ if (event->type() ==
+ views::corewm::FocusChangeEvent::activation_changed_event_type()) {
+ aura::Window* activated = static_cast<aura::Window*>(event->target());
+ if (wm::IsWindowMinimized(activated)) {
+ activated->Show();
+ DCHECK(!wm::IsWindowMinimized(activated));
+ }
}
}
diff --git a/ash/wm/base_layout_manager.h b/ash/wm/base_layout_manager.h
index 1ad6ffb..312e8ae 100644
--- a/ash/wm/base_layout_manager.h
+++ b/ash/wm/base_layout_manager.h
@@ -11,12 +11,11 @@
#include "ash/shell_observer.h"
#include "base/basictypes.h"
#include "base/compiler_specific.h"
-#include "ui/aura/client/activation_change_observer.h"
#include "ui/aura/layout_manager.h"
#include "ui/aura/root_window_observer.h"
-#include "ui/aura/window_observer.h"
#include "ui/base/events/event_handler.h"
#include "ui/base/ui_base_types.h"
+#include "ui/aura/window_observer.h"
namespace aura {
class RootWindow;
@@ -31,12 +30,11 @@ namespace internal {
// window appropriately. Subclasses should be sure to invoke the base class
// for adding and removing windows, otherwise show state will not be tracked
// properly.
-class ASH_EXPORT BaseLayoutManager
- : public aura::LayoutManager,
- public aura::RootWindowObserver,
- public ash::ShellObserver,
- public aura::WindowObserver,
- public aura::client::ActivationChangeObserver {
+class ASH_EXPORT BaseLayoutManager : public aura::LayoutManager,
+ public aura::RootWindowObserver,
+ public ash::ShellObserver,
+ public aura::WindowObserver,
+ public ui::EventHandler {
public:
typedef std::set<aura::Window*> WindowSet;
@@ -74,9 +72,8 @@ class ASH_EXPORT BaseLayoutManager
intptr_t old) OVERRIDE;
virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
- // aura::client::ActivationChangeObserver overrides:
- virtual void OnWindowActivated(aura::Window* gained_active,
- aura::Window* lost_active) OVERRIDE;
+ // ui::EventHandler overrides:
+ virtual void OnEvent(ui::Event* event) OVERRIDE;
protected:
// Invoked from OnWindowPropertyChanged() if |kShowStateKey| changes.
@@ -96,8 +93,6 @@ class ASH_EXPORT BaseLayoutManager
aura::RootWindow* root_window_;
- bool added_observer_;
-
DISALLOW_COPY_AND_ASSIGN(BaseLayoutManager);
};
diff --git a/ash/wm/panel_layout_manager.cc b/ash/wm/panel_layout_manager.cc
index 7aa9207..1c22001 100644
--- a/ash/wm/panel_layout_manager.cc
+++ b/ash/wm/panel_layout_manager.cc
@@ -122,7 +122,8 @@ void FanOutPanels(std::vector<VisiblePanelPositionInfo>::iterator first,
////////////////////////////////////////////////////////////////////////////////
// PanelLayoutManager public implementation:
PanelLayoutManager::PanelLayoutManager(aura::Window* panel_container)
- : panel_container_(panel_container),
+ : ActivationChangeShim(Shell::GetInstance()),
+ panel_container_(panel_container),
in_layout_(false),
dragged_panel_(NULL),
launcher_(NULL),
@@ -283,13 +284,11 @@ void PanelLayoutManager::OnWindowPropertyChanged(aura::Window* window,
////////////////////////////////////////////////////////////////////////////////
// PanelLayoutManager, aura::client::ActivationChangeObserver implementation:
-
-void PanelLayoutManager::OnWindowActivated(aura::Window* gained_active,
- aura::Window* lost_active) {
- if (gained_active &&
- gained_active->type() == aura::client::WINDOW_TYPE_PANEL) {
- UpdateStacking(gained_active);
- UpdateCallout(gained_active);
+void PanelLayoutManager::OnWindowActivated(aura::Window* active,
+ aura::Window* old_active) {
+ if (active && active->type() == aura::client::WINDOW_TYPE_PANEL) {
+ UpdateStacking(active);
+ UpdateCallout(active);
} else {
UpdateCallout(NULL);
}
diff --git a/ash/wm/panel_layout_manager.h b/ash/wm/panel_layout_manager.h
index eb10cbe..5418a3e 100644
--- a/ash/wm/panel_layout_manager.h
+++ b/ash/wm/panel_layout_manager.h
@@ -13,9 +13,9 @@
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
-#include "ui/aura/client/activation_change_observer.h"
#include "ui/aura/layout_manager.h"
#include "ui/aura/window_observer.h"
+#include "ui/views/corewm/activation_change_shim.h"
namespace aura {
class Window;
@@ -47,7 +47,7 @@ class ASH_EXPORT PanelLayoutManager
: public aura::LayoutManager,
public ash::LauncherIconObserver,
public aura::WindowObserver,
- public aura::client::ActivationChangeObserver {
+ public views::corewm::ActivationChangeShim {
public:
explicit PanelLayoutManager(aura::Window* panel_container);
virtual ~PanelLayoutManager();
@@ -78,8 +78,8 @@ class ASH_EXPORT PanelLayoutManager
intptr_t old) OVERRIDE;
// 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;
private:
friend class PanelLayoutManagerTest;
diff --git a/ash/wm/shelf_layout_manager.cc b/ash/wm/shelf_layout_manager.cc
index dce2fd2..e37e486 100644
--- a/ash/wm/shelf_layout_manager.cc
+++ b/ash/wm/shelf_layout_manager.cc
@@ -144,7 +144,9 @@ class ShelfLayoutManager::UpdateShelfObserver
// ShelfLayoutManager ----------------------------------------------------------
ShelfLayoutManager::ShelfLayoutManager(StatusAreaWidget* status_area_widget)
- : root_window_(status_area_widget->GetNativeView()->GetRootWindow()),
+ : ActivationChangeShim(
+ status_area_widget->GetNativeView()->GetRootWindow()),
+ root_window_(status_area_widget->GetNativeView()->GetRootWindow()),
in_layout_(false),
auto_hide_behavior_(SHELF_AUTO_HIDE_BEHAVIOR_NEVER),
alignment_(SHELF_ALIGNMENT_BOTTOM),
@@ -468,8 +470,8 @@ void ShelfLayoutManager::OnLockStateChanged(bool locked) {
UpdateVisibilityState();
}
-void ShelfLayoutManager::OnWindowActivated(aura::Window* gained_active,
- aura::Window* lost_active) {
+void ShelfLayoutManager::OnWindowActivated(aura::Window* active,
+ aura::Window* old_active) {
UpdateAutoHideStateNow();
}
diff --git a/ash/wm/shelf_layout_manager.h b/ash/wm/shelf_layout_manager.h
index f58a4dc..0a4a018 100644
--- a/ash/wm/shelf_layout_manager.h
+++ b/ash/wm/shelf_layout_manager.h
@@ -14,10 +14,10 @@
#include "base/logging.h"
#include "base/observer_list.h"
#include "base/timer.h"
-#include "ui/aura/client/activation_change_observer.h"
#include "ui/aura/layout_manager.h"
#include "ui/gfx/insets.h"
#include "ui/gfx/rect.h"
+#include "ui/views/corewm/activation_change_shim.h"
namespace aura {
class RootWindow;
@@ -44,7 +44,7 @@ class WorkspaceController;
class ASH_EXPORT ShelfLayoutManager :
public aura::LayoutManager,
public ash::ShellObserver,
- public aura::client::ActivationChangeObserver {
+ public views::corewm::ActivationChangeShim {
public:
class ASH_EXPORT Observer {
public:
@@ -154,8 +154,8 @@ class ASH_EXPORT ShelfLayoutManager :
virtual void OnLockStateChanged(bool locked) OVERRIDE;
// Overriden 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;
// TODO(harrym|oshima): These templates will be moved to
// new Shelf class.
diff --git a/ash/wm/window_cycle_controller.cc b/ash/wm/window_cycle_controller.cc
index 4158451..92f1363 100644
--- a/ash/wm/window_cycle_controller.cc
+++ b/ash/wm/window_cycle_controller.cc
@@ -89,7 +89,8 @@ void AddCycleWindows(aura::RootWindow* root,
WindowCycleController::WindowCycleController(
aura::client::ActivationClient* activation_client)
- : activation_client_(activation_client) {
+ : ActivationChangeShim(Shell::GetInstance()),
+ activation_client_(activation_client) {
activation_client_->AddObserver(this);
}
@@ -266,12 +267,11 @@ void WindowCycleController::InstallEventFilter() {
Shell::GetInstance()->AddPreTargetHandler(event_handler_.get());
}
-void WindowCycleController::OnWindowActivated(aura::Window* gained_active,
- aura::Window* lost_active) {
- if (gained_active && !IsCycling() &&
- IsTrackedContainer(gained_active->parent())) {
- mru_windows_.remove(gained_active);
- mru_windows_.push_front(gained_active);
+void WindowCycleController::OnWindowActivated(aura::Window* active,
+ aura::Window* old_active) {
+ if (active && !IsCycling() && IsTrackedContainer(active->parent())) {
+ mru_windows_.remove(active);
+ mru_windows_.push_front(active);
}
}
diff --git a/ash/wm/window_cycle_controller.h b/ash/wm/window_cycle_controller.h
index e673892..b568e92 100644
--- a/ash/wm/window_cycle_controller.h
+++ b/ash/wm/window_cycle_controller.h
@@ -11,8 +11,8 @@
#include "ash/ash_export.h"
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
-#include "ui/aura/client/activation_change_observer.h"
#include "ui/aura/window_observer.h"
+#include "ui/views/corewm/activation_change_shim.h"
namespace aura {
class RootWindow;
@@ -38,7 +38,7 @@ class WindowCycleList;
// at the beginning of the gesture so you can cycle through in a consistent
// order.
class ASH_EXPORT WindowCycleController
- : public aura::client::ActivationChangeObserver,
+ : public views::corewm::ActivationChangeShim,
public aura::WindowObserver {
public:
enum Direction {
@@ -97,9 +97,9 @@ class ASH_EXPORT WindowCycleController
// Checks if the window represents a container whose children we track.
static bool IsTrackedContainer(aura::Window* window);
- // Overridden from aura::client::ActivationChangeObserver:
- virtual void OnWindowActivated(aura::Window* gained_active,
- aura::Window* lost_active) OVERRIDE;
+ // Overridden from views::corewm::ActivationChangeShim:
+ virtual void OnWindowActivated(aura::Window* active,
+ aura::Window* old_active) OVERRIDE;
// Overridden from WindowObserver:
virtual void OnWindowAdded(aura::Window* window) OVERRIDE;
diff --git a/ash/wm/workspace_controller.cc b/ash/wm/workspace_controller.cc
index 3ca70d6..0232d76 100644
--- a/ash/wm/workspace_controller.cc
+++ b/ash/wm/workspace_controller.cc
@@ -18,7 +18,8 @@ namespace ash {
namespace internal {
WorkspaceController::WorkspaceController(aura::Window* viewport)
- : viewport_(viewport),
+ : ActivationChangeShim(viewport->GetRootWindow()),
+ viewport_(viewport),
workspace_cycler_(NULL) {
aura::RootWindow* root_window = viewport->GetRootWindow();
workspace_manager_.reset(new WorkspaceManager(viewport));
@@ -55,12 +56,10 @@ void WorkspaceController::DoInitialAnimation() {
workspace_manager_->DoInitialAnimation();
}
-void WorkspaceController::OnWindowActivated(aura::Window* gained_active,
- aura::Window* lost_active) {
- if (!gained_active ||
- gained_active->GetRootWindow() == viewport_->GetRootWindow()) {
- workspace_manager_->SetActiveWorkspaceByWindow(gained_active);
- }
+void WorkspaceController::OnWindowActivated(aura::Window* window,
+ aura::Window* old_active) {
+ if (!window || window->GetRootWindow() == viewport_->GetRootWindow())
+ workspace_manager_->SetActiveWorkspaceByWindow(window);
}
} // namespace internal
diff --git a/ash/wm/workspace_controller.h b/ash/wm/workspace_controller.h
index a77863a..028ae7a 100644
--- a/ash/wm/workspace_controller.h
+++ b/ash/wm/workspace_controller.h
@@ -9,7 +9,7 @@
#include "ash/wm/workspace/workspace_types.h"
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
-#include "ui/aura/client/activation_change_observer.h"
+#include "ui/views/corewm/activation_change_shim.h"
namespace aura {
class Window;
@@ -27,7 +27,7 @@ class WorkspaceManager;
// WorkspaceController acts as a central place that ties together all the
// various workspace pieces.
class ASH_EXPORT WorkspaceController
- : public aura::client::ActivationChangeObserver {
+ : public views::corewm::ActivationChangeShim {
public:
explicit WorkspaceController(aura::Window* viewport);
virtual ~WorkspaceController();
@@ -47,8 +47,8 @@ class ASH_EXPORT WorkspaceController
void DoInitialAnimation();
// aura::client::ActivationChangeObserver overrides:
- virtual void OnWindowActivated(aura::Window* gained_active,
- aura::Window* lost_active) OVERRIDE;
+ virtual void OnWindowActivated(aura::Window* window,
+ aura::Window* old_active) OVERRIDE;
private:
friend class WorkspaceControllerTestHelper;
diff --git a/chrome/browser/ui/ash/launcher/shell_window_launcher_controller.cc b/chrome/browser/ui/ash/launcher/shell_window_launcher_controller.cc
index 55e688c..a040a42 100644
--- a/chrome/browser/ui/ash/launcher/shell_window_launcher_controller.cc
+++ b/chrome/browser/ui/ash/launcher/shell_window_launcher_controller.cc
@@ -184,7 +184,9 @@ class ShellWindowLauncherController::AppLauncherItemController
ShellWindowLauncherController::ShellWindowLauncherController(
ChromeLauncherController* owner)
- : owner_(owner),
+ : ActivationChangeShim(ash::Shell::HasInstance() ?
+ ash::Shell::GetInstance() : NULL),
+ owner_(owner),
registry_(extensions::ShellWindowRegistry::Get(owner->profile())),
activation_client_(NULL) {
registry_->AddObserver(this);
diff --git a/chrome/browser/ui/ash/launcher/shell_window_launcher_controller.h b/chrome/browser/ui/ash/launcher/shell_window_launcher_controller.h
index 9dba82a..b154bcd 100644
--- a/chrome/browser/ui/ash/launcher/shell_window_launcher_controller.h
+++ b/chrome/browser/ui/ash/launcher/shell_window_launcher_controller.h
@@ -10,8 +10,8 @@
#include <string>
#include "chrome/browser/extensions/shell_window_registry.h"
-#include "ui/aura/client/activation_change_observer.h"
#include "ui/aura/window_observer.h"
+#include "ui/views/corewm/activation_change_shim.h"
namespace aura {
@@ -33,7 +33,7 @@ class ShellWindow;
class ShellWindowLauncherController
: public extensions::ShellWindowRegistry::Observer,
public aura::WindowObserver,
- public aura::client::ActivationChangeObserver {
+ public views::corewm::ActivationChangeShim {
public:
explicit ShellWindowLauncherController(ChromeLauncherController* owner);
virtual ~ShellWindowLauncherController();
@@ -47,8 +47,8 @@ class ShellWindowLauncherController
virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
// Overriden from 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;
private:
class AppLauncherItemController;
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;