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

Unified Diff: ui/views/corewm/focus_controller.cc

Issue 11421194: Hook up the FocusController behind a flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years 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 | « ui/views/corewm/focus_controller.h ('k') | ui/views/corewm/focus_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/corewm/focus_controller.cc
===================================================================
--- ui/views/corewm/focus_controller.cc (revision 170746)
+++ ui/views/corewm/focus_controller.cc (working copy)
@@ -45,6 +45,7 @@
DCHECK(!(result & ui::ER_CONSUMED))
<< "Focus and Activation events cannot be consumed";
+ aura::Window* lost_active = *state;
*state = new_state;
if (restack && new_state) {
@@ -55,6 +56,7 @@
{
base::AutoReset<ui::EventTarget*> reset(event_dispatch_target, *state);
FocusChangeEvent changed_event(changed_event_type);
+ FocusChangeEvent::DispatcherApi(&changed_event).set_last_focus(lost_active);
dispatcher->ProcessEvent(*state, &changed_event);
}
}
@@ -78,34 +80,25 @@
aura::Env::GetInstance()->RemoveObserver(this);
}
-void FocusController::FocusWindow(aura::Window* window) {
- // Focusing a window also activates its containing activatable window. Note
- // that the rules could redirect activation activation and/or focus.
- aura::Window* focusable = rules_->GetFocusableWindow(window);
- SetActiveWindow(rules_->GetActivatableWindow(focusable));
- DCHECK(GetActiveWindow()->Contains(focusable));
- SetFocusedWindow(focusable);
-}
-
////////////////////////////////////////////////////////////////////////////////
// FocusController, aura::client::ActivationClient implementation:
void FocusController::AddObserver(
aura::client::ActivationChangeObserver* observer) {
- NOTREACHED();
+ //NOTREACHED();
}
void FocusController::RemoveObserver(
aura::client::ActivationChangeObserver* observer) {
- NOTREACHED();
+ //NOTREACHED();
}
void FocusController::ActivateWindow(aura::Window* window) {
- FocusWindow(window);
+ FocusWindow(window, NULL);
}
void FocusController::DeactivateWindow(aura::Window* window) {
- FocusWindow(rules_->GetNextActivatableWindow(window));
+ FocusWindow(rules_->GetNextActivatableWindow(window), NULL);
}
aura::Window* FocusController::GetActiveWindow() {
@@ -127,6 +120,33 @@
}
////////////////////////////////////////////////////////////////////////////////
+// FocusController, aura::client::FocusClient implementation:
+
+void FocusController::AddObserver(
+ aura::client::FocusChangeObserver* observer) {
+ //NOTREACHED();
+}
+
+void FocusController::RemoveObserver(
+ aura::client::FocusChangeObserver* observer) {
+ //NOTREACHED();
+}
+
+void FocusController::FocusWindow(aura::Window* window,
+ const ui::Event* event) {
+ // Focusing a window also activates its containing activatable window. Note
+ // that the rules could redirect activation activation and/or focus.
+ aura::Window* focusable = rules_->GetFocusableWindow(window);
+ SetActiveWindow(rules_->GetActivatableWindow(focusable));
+ DCHECK(GetActiveWindow()->Contains(focusable));
+ SetFocusedWindow(focusable);
+}
+
+aura::Window* FocusController::GetFocusedWindow() {
+ return focused_window_;
+}
+
+////////////////////////////////////////////////////////////////////////////////
// FocusController, ui::EventHandler implementation:
ui::EventResult FocusController::OnKeyEvent(ui::KeyEvent* event) {
return ui::ER_UNHANDLED;
@@ -242,7 +262,7 @@
}
void FocusController::WindowFocusedFromInputEvent(aura::Window* window) {
- FocusWindow(window);
+ FocusWindow(window, NULL);
}
} // namespace corewm
« no previous file with comments | « ui/views/corewm/focus_controller.h ('k') | ui/views/corewm/focus_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698