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

Unified Diff: ui/aura/focus_manager.cc

Issue 29883002: Attempt to re-land FocusManager removal from Aura. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disable test with note. Created 7 years, 2 months 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/aura/focus_manager.h ('k') | ui/aura/remote_root_window_host_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/focus_manager.cc
diff --git a/ui/aura/focus_manager.cc b/ui/aura/focus_manager.cc
deleted file mode 100644
index 921406b4c762e3ef0ed9514f7e0c440dc0f12909..0000000000000000000000000000000000000000
--- a/ui/aura/focus_manager.cc
+++ /dev/null
@@ -1,105 +0,0 @@
-// 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/aura/focus_manager.h"
-
-#include "ui/aura/client/activation_client.h"
-#include "ui/aura/client/focus_change_observer.h"
-#include "ui/aura/root_window.h"
-#include "ui/aura/window_delegate.h"
-
-namespace aura {
-
-////////////////////////////////////////////////////////////////////////////////
-// FocusManager, public:
-
-FocusManager::FocusManager() : focused_window_(NULL) {
-}
-
-FocusManager::~FocusManager() {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// FocusManager, client::FocusClient implementation:
-
-void FocusManager::AddObserver(client::FocusChangeObserver* observer) {
- observers_.AddObserver(observer);
-}
-
-void FocusManager::RemoveObserver(client::FocusChangeObserver* observer) {
- observers_.RemoveObserver(observer);
-}
-
-void FocusManager::FocusWindow(Window* focused_window) {
- if (focused_window == focused_window_)
- return;
- if (focused_window && !focused_window->CanFocus())
- return;
- // The NULL-check of |focused_window| is essential here before asking the
- // activation client, since it is valid to clear the focus by calling
- // SetFocusedWindow() to NULL.
-
- if (focused_window) {
- RootWindow* root = focused_window->GetRootWindow();
- DCHECK(root);
- if (client::GetActivationClient(root) &&
- !client::GetActivationClient(root)->OnWillFocusWindow(
- focused_window, NULL)) {
- return;
- }
- }
-
- Window* old_focused_window = focused_window_;
- focused_window_ = focused_window;
-
- FOR_EACH_OBSERVER(client::FocusChangeObserver, observers_,
- OnWindowFocused(focused_window, old_focused_window));
- client::FocusChangeObserver* observer =
- client::GetFocusChangeObserver(old_focused_window);
- if (observer)
- observer->OnWindowFocused(focused_window_, old_focused_window);
- observer = client::GetFocusChangeObserver(focused_window_);
- if (observer)
- observer->OnWindowFocused(focused_window_, old_focused_window);
-}
-
-void FocusManager::ResetFocusWithinActiveWindow(Window* window) {
- FocusWindow(window);
-}
-
-Window* FocusManager::GetFocusedWindow() {
- return focused_window_;
-}
-
-void FocusManager::OnWindowHiddenInRootWindow(
- aura::Window* window,
- aura::RootWindow* root_window,
- bool destroyed) {
- Window* focused_window =
- client::GetFocusClient(root_window)->GetFocusedWindow();
- if (window->Contains(focused_window)) {
- Window* focus_to = window->transient_parent();
- if (focus_to) {
- // Has to be removed from the transient parent before focusing,
- // otherwise |window| will be focused again.
- if (destroyed)
- focus_to->RemoveTransientChild(window);
- } else {
- // If the invisible view has no visible transient window, focus to the
- // topmost visible parent window.
- focus_to = window->parent();
- }
- if (focus_to &&
- (!focus_to->IsVisible() ||
- !focus_to->CanFocus() ||
- (client::GetActivationClient(root_window) &&
- !client::GetActivationClient(root_window)->OnWillFocusWindow(
- focus_to, NULL)))) {
- focus_to = NULL;
- }
- client::GetFocusClient(root_window)->FocusWindow(focus_to);
- }
-}
-
-} // namespace aura
« no previous file with comments | « ui/aura/focus_manager.h ('k') | ui/aura/remote_root_window_host_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698