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

Unified Diff: chrome/browser/extensions/api/wm/wm_utils.h

Issue 10824364: [NOT FOR REVIEW] ash: Add some implementation for the window management extension API. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 4 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 | « ash/wm/window_util.cc ('k') | chrome/browser/extensions/api/wm/wm_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « ash/wm/window_util.cc ('k') | chrome/browser/extensions/api/wm/wm_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698