| 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 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 ~AppWindowLauncherItemController() override; | 37 ~AppWindowLauncherItemController() override; |
| 38 | 38 |
| 39 void AddWindow(ui::BaseWindow* window); | 39 void AddWindow(ui::BaseWindow* window); |
| 40 void RemoveWindow(ui::BaseWindow* window); | 40 void RemoveWindow(ui::BaseWindow* window); |
| 41 | 41 |
| 42 void SetActiveWindow(aura::Window* window); | 42 void SetActiveWindow(aura::Window* window); |
| 43 ui::BaseWindow* GetAppWindow(aura::Window* window); | 43 ui::BaseWindow* GetAppWindow(aura::Window* window); |
| 44 | 44 |
| 45 // LauncherItemController overrides: | 45 // LauncherItemController overrides: |
| 46 ash::ShelfItemDelegate::PerformedAction Activate( | |
| 47 ash::LaunchSource source) override; | |
| 48 AppWindowLauncherItemController* AsAppWindowLauncherItemController() override; | 46 AppWindowLauncherItemController* AsAppWindowLauncherItemController() override; |
| 49 ash::ShelfItemDelegate::PerformedAction ItemSelected( | 47 ash::ShelfAction ItemSelected(ui::EventType event_type, |
| 50 const ui::Event& event) override; | 48 int event_flags, |
| 49 int64_t display_id, |
| 50 ash::ShelfLaunchSource source) override; |
| 51 ash::ShelfAppMenuItemList GetAppMenuItems(int event_flags) override; | 51 ash::ShelfAppMenuItemList GetAppMenuItems(int event_flags) override; |
| 52 void Close() override; | 52 void Close() override; |
| 53 | 53 |
| 54 // aura::WindowObserver overrides: | 54 // aura::WindowObserver overrides: |
| 55 void OnWindowPropertyChanged(aura::Window* window, | 55 void OnWindowPropertyChanged(aura::Window* window, |
| 56 const void* key, | 56 const void* key, |
| 57 intptr_t old) override; | 57 intptr_t old) override; |
| 58 | 58 |
| 59 // Get the number of running applications/incarnations of this. | 59 // Get the number of running applications/incarnations of this. |
| 60 size_t window_count() const { return windows_.size(); } | 60 size_t window_count() const { return windows_.size(); } |
| 61 | 61 |
| 62 // Activates the window at position |index|. | 62 // Activates the window at position |index|. |
| 63 void ActivateIndexedApp(size_t index); | 63 void ActivateIndexedApp(size_t index); |
| 64 | 64 |
| 65 const WindowList& windows() const { return windows_; } | 65 const WindowList& windows() const { return windows_; } |
| 66 | 66 |
| 67 protected: | 67 protected: |
| 68 AppWindowLauncherItemController(const std::string& app_id, | 68 AppWindowLauncherItemController(const std::string& app_id, |
| 69 const std::string& launch_id, | 69 const std::string& launch_id, |
| 70 ChromeLauncherController* controller); | 70 ChromeLauncherController* controller); |
| 71 | 71 |
| 72 // Called when app window is removed from controller. | 72 // Called when app window is removed from controller. |
| 73 virtual void OnWindowRemoved(ui::BaseWindow* window) {} | 73 virtual void OnWindowRemoved(ui::BaseWindow* window) {} |
| 74 | 74 |
| 75 // Returns the action performed. Should be one of kNoAction, | 75 // Returns the action performed. Should be one of SHELF_ACTION_NONE, |
| 76 // kExistingWindowActivated, or kExistingWindowMinimized. | 76 // SHELF_ACTION_WINDOW_ACTIVATED, or SHELF_ACTION_WINDOW_MINIMIZED. |
| 77 ash::ShelfItemDelegate::PerformedAction ShowAndActivateOrMinimize( | 77 ash::ShelfAction ShowAndActivateOrMinimize(ui::BaseWindow* window); |
| 78 ui::BaseWindow* window); | |
| 79 | 78 |
| 80 // Activate the given |window_to_show|, or - if already selected - advance to | 79 // Activate the given |window_to_show|, or - if already selected - advance to |
| 81 // the next window of similar type. | 80 // the next window of similar type. |
| 82 // Returns the action performed. Should be one of kNoAction, | 81 // Returns the action performed. Should be one of SHELF_ACTION_NONE, |
| 83 // kExistingWindowActivated, or kExistingWindowMinimized. | 82 // SHELF_ACTION_WINDOW_ACTIVATED, or SHELF_ACTION_WINDOW_MINIMIZED. |
| 84 ash::ShelfItemDelegate::PerformedAction ActivateOrAdvanceToNextAppWindow( | 83 ash::ShelfAction ActivateOrAdvanceToNextAppWindow( |
| 85 ui::BaseWindow* window_to_show); | 84 ui::BaseWindow* window_to_show); |
| 86 | 85 |
| 87 private: | 86 private: |
| 88 WindowList::iterator GetFromNativeWindow(aura::Window* window); | 87 WindowList::iterator GetFromNativeWindow(aura::Window* window); |
| 89 | 88 |
| 90 // List of associated app windows | 89 // List of associated app windows |
| 91 WindowList windows_; | 90 WindowList windows_; |
| 92 | 91 |
| 93 // Pointer to the most recently active app window | 92 // Pointer to the most recently active app window |
| 94 ui::BaseWindow* last_active_window_ = nullptr; | 93 ui::BaseWindow* last_active_window_ = nullptr; |
| 95 | 94 |
| 96 // Scoped list of observed windows (for removal on destruction) | 95 // Scoped list of observed windows (for removal on destruction) |
| 97 ScopedObserver<aura::Window, aura::WindowObserver> observed_windows_; | 96 ScopedObserver<aura::Window, aura::WindowObserver> observed_windows_; |
| 98 | 97 |
| 99 DISALLOW_COPY_AND_ASSIGN(AppWindowLauncherItemController); | 98 DISALLOW_COPY_AND_ASSIGN(AppWindowLauncherItemController); |
| 100 }; | 99 }; |
| 101 | 100 |
| 102 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_APP_WINDOW_LAUNCHER_ITEM_CONTROLLER_H_ | 101 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_APP_WINDOW_LAUNCHER_ITEM_CONTROLLER_H_ |
| OLD | NEW |