diff options
Diffstat (limited to 'ui/aura/env.h')
-rw-r--r-- | ui/aura/env.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/ui/aura/env.h b/ui/aura/env.h new file mode 100644 index 0000000..12cb2ef --- /dev/null +++ b/ui/aura/env.h @@ -0,0 +1,45 @@ +// 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_AURA_ENV_H_ +#define UI_AURA_ENV_H_ +#pragma once + +#include "base/observer_list.h" +#include "ui/aura/aura_export.h" + +namespace aura { + +class EnvObserver; +class Window; + +// A singleton object that tracks general state within Aura. +// TODO(beng): manage RootWindows. +class AURA_EXPORT Env { + public: + Env(); + ~Env(); + + static Env* GetInstance(); + static void DeleteInstance(); + + void AddObserver(EnvObserver* observer); + void RemoveObserver(EnvObserver* observer); + + private: + friend class Window; + + // Called by the Window when it is initialized. Notifies observers. + void NotifyWindowInitialized(Window* window); + + ObserverList<EnvObserver> observers_; + + static Env* instance_; + + DISALLOW_COPY_AND_ASSIGN(Env); +}; + +} // namespace aura + +#endif // UI_AURA_ENV_H_ |