| Index: chrome/browser/extensions/api/wm/wm_utils.h
|
| diff --git a/chrome/browser/extensions/api/wm/wm_utils.h b/chrome/browser/extensions/api/wm/wm_utils.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f3e115f2aa035fa4797ac05aec2956357e0fc47f
|
| --- /dev/null
|
| +++ b/chrome/browser/extensions/api/wm/wm_utils.h
|
| @@ -0,0 +1,64 @@
|
| +// 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 CHROME_BROWSER_EXTENSIONS_API_WM_WM_UTILS_H_
|
| +#define CHROME_BROWSER_EXTENSIONS_API_WM_WM_UTILS_H_
|
| +
|
| +#include <list>
|
| +#include <map>
|
| +#include <vector>
|
| +
|
| +#include "base/memory/singleton.h"
|
| +#include "ui/gfx/native_widget_types.h"
|
| +
|
| +namespace extensions {
|
| +namespace api {
|
| +
|
| +namespace experimental_wm {
|
| +class WmWindow;
|
| +}
|
| +
|
| +namespace wm {
|
| +
|
| +// WindowIdTracker manages the extension-visible IDs of the native Windows.
|
| +class WindowIdTracker {
|
| + private:
|
| + WindowIdTracker();
|
| + ~WindowIdTracker();
|
| +
|
| + public:
|
| + static WindowIdTracker* GetInstance();
|
| +
|
| + // Returns the extension-visible ID for the window. This generates a new
|
| + // unique ID for the window if it didn't have one already (or if it was
|
| + // invalidated by calling UntrackWindow().
|
| + int GetWindowExtensionId(gfx::NativeWindow window);
|
| +
|
| + // Invalidates the extension-visible ID for the window.
|
| + void UntrackWindow(gfx::NativeWindow window);
|
| +
|
| + private:
|
| + // Requirement for Signleton
|
| + friend struct DefaultSingletonTraits<WindowIdTracker>;
|
| +
|
| + std::list<gfx::NativeWindow> activation_order_;
|
| + std::list<gfx::NativeWindow> creation_order_;
|
| + std::map<int, gfx::NativeWindow> reverse_lookup_;
|
| + std::map<gfx::NativeWindow, int> lookup_;
|
| + int next_window_id_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(WindowIdTracker);
|
| +};
|
| +
|
| +namespace utils {
|
| +
|
| +void NativeWindowToExtensionWindow(gfx::NativeWindow window,
|
| + experimental_wm::WmWindow* extension_window);
|
| +
|
| +} // namespace utils
|
| +} // namespace wm
|
| +} // namespace api
|
| +} // namespace extensions
|
| +
|
| +#endif // CHROME_BROWSER_EXTENSIONS_API_WM_WM_UTILS_H_
|
|
|