Home | History | Annotate | Download | only in aura
      1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef UI_AURA_FOCUS_MANAGER_H_
      6 #define UI_AURA_FOCUS_MANAGER_H_
      7 
      8 #include "base/basictypes.h"
      9 #include "base/observer_list.h"
     10 #include "ui/aura/aura_export.h"
     11 #include "ui/aura/client/focus_client.h"
     12 
     13 namespace ui {
     14 class Event;
     15 }
     16 
     17 namespace aura {
     18 
     19 class Window;
     20 
     21 // An interface implemented by the Desktop to expose the focused window and
     22 // allow for it to be changed.
     23 class AURA_EXPORT FocusManager : public client::FocusClient {
     24  public:
     25   FocusManager();
     26   virtual ~FocusManager();
     27 
     28  private:
     29   // Overridden from client::FocusClient:
     30   virtual void AddObserver(client::FocusChangeObserver* observer) OVERRIDE;
     31   virtual void RemoveObserver(client::FocusChangeObserver* observer) OVERRIDE;
     32   virtual void FocusWindow(Window* window) OVERRIDE;
     33   virtual void ResetFocusWithinActiveWindow(Window* window) OVERRIDE;
     34   virtual Window* GetFocusedWindow() OVERRIDE;
     35   virtual void OnWindowHiddenInRootWindow(aura::Window* window,
     36                                           aura::RootWindow* root_window,
     37                                           bool destroyed) OVERRIDE;
     38 
     39  protected:
     40   aura::Window* focused_window_;
     41 
     42   ObserverList<client::FocusChangeObserver> observers_;
     43 
     44   DISALLOW_COPY_AND_ASSIGN(FocusManager);
     45 };
     46 
     47 }  // namespace aura
     48 
     49 #endif  // UI_AURA_FOCUS_MANAGER_H_
     50