| OLD | NEW |
| (Empty) | |
| 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 CHROME_BROWSER_EXTENSIONS_API_WM_WM_UTILS_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_WM_WM_UTILS_H_ |
| 7 |
| 8 #include <list> |
| 9 #include <map> |
| 10 #include <vector> |
| 11 |
| 12 #include "base/memory/singleton.h" |
| 13 |
| 14 namespace aura { |
| 15 class Window; |
| 16 } |
| 17 |
| 18 namespace extensions { |
| 19 namespace api { |
| 20 |
| 21 namespace experimental_wm { |
| 22 class AshWindow; |
| 23 } |
| 24 |
| 25 namespace wm { |
| 26 |
| 27 class WindowIdTracker { |
| 28 private: |
| 29 WindowIdTracker(); |
| 30 ~WindowIdTracker(); |
| 31 |
| 32 public: |
| 33 static WindowIdTracker* GetInstance(); |
| 34 |
| 35 int WindowExtensionId(const aura::Window* window); |
| 36 |
| 37 const aura::Window* ExtensionIdWindow(int extension_id); |
| 38 |
| 39 int TrackWindow(const aura::Window* window); |
| 40 |
| 41 void UntrackWindow(const aura::Window* window); |
| 42 |
| 43 void ActivateWindow(const aura::Window* window); |
| 44 |
| 45 std::vector<const aura::Window*> AllWindows(bool activation); |
| 46 |
| 47 private: |
| 48 // Requirement for Signleton |
| 49 friend struct DefaultSingletonTraits<WindowIdTracker>; |
| 50 |
| 51 std::list<const aura::Window*> activation_order_; |
| 52 std::list<const aura::Window*> creation_order_; |
| 53 std::map<int, const aura::Window*> reverse_lookup_; |
| 54 std::map<const aura::Window*, int> lookup_; |
| 55 int next_window_id_; |
| 56 |
| 57 DISALLOW_COPY_AND_ASSIGN(WindowIdTracker); |
| 58 }; |
| 59 |
| 60 namespace utils { |
| 61 |
| 62 void AuraWindowToExtensionWindow(const aura::Window* window, |
| 63 experimental_wm::AshWindow* extension_window); |
| 64 |
| 65 } // namespace utils |
| 66 } // namespace wm |
| 67 } // namespace api |
| 68 } // namespace extensions |
| 69 |
| 70 #endif // CHROME_BROWSER_EXTENSIONS_API_WM_WM_UTILS_H_ |
| OLD | NEW |