OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_APP_WINDOW_LAUNCHER_ITEM_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_APP_WINDOW_LAUNCHER_ITEM_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_APP_WINDOW_LAUNCHER_ITEM_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_APP_WINDOW_LAUNCHER_ITEM_CONTROLLER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 size_t window_count() const { return windows_.size(); } | 58 size_t window_count() const { return windows_.size(); } |
59 | 59 |
60 // Activates the window at position |index|. | 60 // Activates the window at position |index|. |
61 void ActivateIndexedApp(size_t index); | 61 void ActivateIndexedApp(size_t index); |
62 | 62 |
63 const WindowList& windows() const { return windows_; } | 63 const WindowList& windows() const { return windows_; } |
64 | 64 |
65 protected: | 65 protected: |
66 explicit AppWindowLauncherItemController(const ash::ShelfID& shelf_id); | 66 explicit AppWindowLauncherItemController(const ash::ShelfID& shelf_id); |
67 | 67 |
68 // Called when app window is removed from controller. | 68 // Called when active app window is changed. |
69 virtual void OnWindowRemoved(ui::BaseWindow* window) {} | 69 virtual void OnActiveWindowChanged(ui::BaseWindow* active_window) {} |
70 | 70 |
71 // Returns the action performed. Should be one of SHELF_ACTION_NONE, | 71 // Returns the action performed. Should be one of SHELF_ACTION_NONE, |
72 // SHELF_ACTION_WINDOW_ACTIVATED, or SHELF_ACTION_WINDOW_MINIMIZED. | 72 // SHELF_ACTION_WINDOW_ACTIVATED, or SHELF_ACTION_WINDOW_MINIMIZED. |
73 ash::ShelfAction ShowAndActivateOrMinimize(ui::BaseWindow* window); | 73 ash::ShelfAction ShowAndActivateOrMinimize(ui::BaseWindow* window); |
74 | 74 |
75 // Activate the given |window_to_show|, or - if already selected - advance to | 75 // Activate the given |window_to_show|, or - if already selected - advance to |
76 // the next window of similar type. | 76 // the next window of similar type. |
77 // Returns the action performed. Should be one of SHELF_ACTION_NONE, | 77 // Returns the action performed. Should be one of SHELF_ACTION_NONE, |
78 // SHELF_ACTION_WINDOW_ACTIVATED, or SHELF_ACTION_WINDOW_MINIMIZED. | 78 // SHELF_ACTION_WINDOW_ACTIVATED, or SHELF_ACTION_WINDOW_MINIMIZED. |
79 ash::ShelfAction ActivateOrAdvanceToNextAppWindow( | 79 ash::ShelfAction ActivateOrAdvanceToNextAppWindow( |
80 ui::BaseWindow* window_to_show); | 80 ui::BaseWindow* window_to_show); |
81 | 81 |
| 82 // Returns last active window in the controller or top window. |
| 83 ui::BaseWindow* GetLastActiveWindow(); |
| 84 |
82 private: | 85 private: |
83 WindowList::iterator GetFromNativeWindow(aura::Window* window); | 86 WindowList::iterator GetFromNativeWindow(aura::Window* window); |
84 | 87 |
85 // List of associated app windows | 88 // List of associated app windows |
86 WindowList windows_; | 89 WindowList windows_; |
87 | 90 |
88 // Pointer to the most recently active app window | 91 // Pointer to the most recently active app window |
89 ui::BaseWindow* last_active_window_ = nullptr; | 92 ui::BaseWindow* last_active_window_ = nullptr; |
90 | 93 |
91 // Scoped list of observed windows (for removal on destruction) | 94 // Scoped list of observed windows (for removal on destruction) |
92 ScopedObserver<aura::Window, aura::WindowObserver> observed_windows_; | 95 ScopedObserver<aura::Window, aura::WindowObserver> observed_windows_; |
93 | 96 |
94 DISALLOW_COPY_AND_ASSIGN(AppWindowLauncherItemController); | 97 DISALLOW_COPY_AND_ASSIGN(AppWindowLauncherItemController); |
95 }; | 98 }; |
96 | 99 |
97 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_APP_WINDOW_LAUNCHER_ITEM_CONTROLLER_H_ | 100 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_APP_WINDOW_LAUNCHER_ITEM_CONTROLLER_H_ |
OLD | NEW |