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

Unified Diff: ui/aura_shell/activation_controller.h

Issue 8894018: Move the concept of Activation to the Shell. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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/aura/window_unittest.cc ('k') | ui/aura_shell/activation_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura_shell/activation_controller.h
===================================================================
--- ui/aura_shell/activation_controller.h (revision 0)
+++ ui/aura_shell/activation_controller.h (revision 0)
@@ -0,0 +1,74 @@
+// Copyright (c) 2011 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_AURA_SHELL_ACTIVATION_CONTROLLER_H_
+#define UI_AURA_SHELL_ACTIVATION_CONTROLLER_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
+#include "ui/aura/client/activation_client.h"
+#include "ui/aura/root_window_observer.h"
+#include "ui/aura/window_observer.h"
+
+namespace aura_shell {
+namespace internal {
+
+class ActivationController : public aura::ActivationClient,
+ public aura::WindowObserver,
+ public aura::RootWindowObserver {
+ public:
+ ActivationController();
+ virtual ~ActivationController();
+
+ // Returns true if |window| exists within a container that supports
+ // activation.
+ static aura::Window* GetActivatableWindow(aura::Window* window);
+
+ // Overridden from aura::ActivationClient:
+ virtual void ActivateWindow(aura::Window* window) OVERRIDE;
+ virtual void DeactivateWindow(aura::Window* window) OVERRIDE;
+ virtual aura::Window* GetActiveWindow() OVERRIDE;
+ virtual bool CanFocusWindow(aura::Window* window) const OVERRIDE;
+
+ // Overridden from aura::WindowObserver:
+ virtual void OnWindowVisibilityChanged(aura::Window* window,
+ bool visible) OVERRIDE;
+ virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE;
+
+ // Overridden from aura::RootWindowObserver:
+ virtual void OnWindowInitialized(aura::Window* window) OVERRIDE;
+ virtual void OnWindowFocused(aura::Window* window) OVERRIDE;
+
+#if defined(UNIT_TEST)
+ void set_default_container_for_test(aura::Window* window) {
+ default_container_for_test_ = window;
+ }
+#endif
+
+ private:
+ // Shifts activation to the next window, ignoring |window|.
+ void ActivateNextWindow(aura::Window* window);
+
+ // Returns the next window that should be activated, ignoring |ignore|.
+ aura::Window* GetTopmostWindowToActivate(aura::Window* ignore) const;
+
+ // True inside ActivateWindow(). Used to prevent recursion of focus
+ // change notifications causing activation.
+ bool updating_activation_;
+
+ // For tests that are not running with a Shell instance,
+ // ActivationController's attempts to locate the next active window in
+ // GetTopmostWindowToActivate() will crash, so we provide this way for such
+ // tests to specify a default container.
+ aura::Window* default_container_for_test_;
+
+ DISALLOW_COPY_AND_ASSIGN(ActivationController);
+};
+
+} // namespace internal
+} // namespace aura_shell
+
+#endif // UI_AURA_SHELL_ACTIVATION_CONTROLLER_H_
Property changes on: ui\aura_shell\activation_controller.h
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « ui/aura/window_unittest.cc ('k') | ui/aura_shell/activation_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698