| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_BROWSER_SHORTCUT_LAUNCHER_ITEM_CONTROLLER
_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_BROWSER_SHORTCUT_LAUNCHER_ITEM_CONTROLLER
_H_ |
| 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_BROWSER_SHORTCUT_LAUNCHER_ITEM_CONTROLLER
_H_ | 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_BROWSER_SHORTCUT_LAUNCHER_ITEM_CONTROLLER
_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" | 9 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" |
| 10 #include "chrome/browser/ui/browser_list.h" | 10 #include "chrome/browser/ui/browser_list.h" |
| 11 #include "content/public/browser/notification_observer.h" | 11 #include "chrome/browser/ui/browser_list_observer.h" |
| 12 #include "content/public/browser/notification_registrar.h" | |
| 13 | 12 |
| 14 namespace ash { | 13 namespace ash { |
| 15 class ShelfModel; | 14 class ShelfModel; |
| 16 } | 15 } |
| 17 | 16 |
| 18 namespace content { | 17 namespace content { |
| 19 class WebContents; | 18 class WebContents; |
| 20 } | 19 } |
| 21 | 20 |
| 22 class ChromeLauncherController; | 21 class ChromeLauncherController; |
| 23 | 22 |
| 24 // Shelf item delegate for a browser shortcut; only one such item should exist. | 23 // Shelf item delegate for a browser shortcut; only one such item should exist. |
| 25 // This item shows an application menu that lists open browser windows or tabs. | 24 // This item shows an application menu that lists open browser windows or tabs. |
| 26 class BrowserShortcutLauncherItemController | 25 class BrowserShortcutLauncherItemController |
| 27 : public LauncherItemController, | 26 : public LauncherItemController, |
| 28 public content::NotificationObserver { | 27 public chrome::BrowserListObserver { |
| 29 public: | 28 public: |
| 30 BrowserShortcutLauncherItemController(ChromeLauncherController* controller, | 29 BrowserShortcutLauncherItemController(ChromeLauncherController* controller, |
| 31 ash::ShelfModel* shelf_model); | 30 ash::ShelfModel* shelf_model); |
| 32 | 31 |
| 33 ~BrowserShortcutLauncherItemController() override; | 32 ~BrowserShortcutLauncherItemController() override; |
| 34 | 33 |
| 35 // Updates the activation state of the Broswer item. | 34 // Updates the activation state of the Broswer item. |
| 36 void UpdateBrowserItemState(); | 35 void UpdateBrowserItemState(); |
| 37 | 36 |
| 38 // Sets the shelf id for the browser window if the browser is represented. | 37 // Sets the shelf id for the browser window if the browser is represented. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 57 // SHELF_ACTION_WINDOW_ACTIVATED, or SHELF_ACTION_NEW_WINDOW_CREATED. | 56 // SHELF_ACTION_WINDOW_ACTIVATED, or SHELF_ACTION_NEW_WINDOW_CREATED. |
| 58 ash::ShelfAction ActivateOrAdvanceToNextBrowser(); | 57 ash::ShelfAction ActivateOrAdvanceToNextBrowser(); |
| 59 | 58 |
| 60 // Returns true when the given |browser| is listed in the browser application | 59 // Returns true when the given |browser| is listed in the browser application |
| 61 // list. | 60 // list. |
| 62 bool IsBrowserRepresentedInBrowserList(Browser* browser); | 61 bool IsBrowserRepresentedInBrowserList(Browser* browser); |
| 63 | 62 |
| 64 // Get a list of active browsers. | 63 // Get a list of active browsers. |
| 65 BrowserList::BrowserVector GetListOfActiveBrowsers(); | 64 BrowserList::BrowserVector GetListOfActiveBrowsers(); |
| 66 | 65 |
| 67 // content::NotificationObserver: | 66 // chrome::BrowserListObserver: |
| 68 void Observe(int type, | 67 void OnBrowserCloseStarted(Browser* browser) override; |
| 69 const content::NotificationSource& source, | |
| 70 const content::NotificationDetails& details) override; | |
| 71 | 68 |
| 72 ash::ShelfModel* shelf_model_; | 69 ash::ShelfModel* shelf_model_; |
| 73 | 70 |
| 74 // The cached list of open browser windows shown in an application menu. | 71 // The cached list of open browser windows shown in an application menu. |
| 75 BrowserList::BrowserVector browser_menu_items_; | 72 BrowserList::BrowserVector browser_menu_items_; |
| 76 | 73 |
| 77 // Registers for notifications of closing browser windows. | |
| 78 content::NotificationRegistrar registrar_; | |
| 79 | |
| 80 DISALLOW_COPY_AND_ASSIGN(BrowserShortcutLauncherItemController); | 74 DISALLOW_COPY_AND_ASSIGN(BrowserShortcutLauncherItemController); |
| 81 }; | 75 }; |
| 82 | 76 |
| 83 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_BROWSER_SHORTCUT_LAUNCHER_ITEM_CONTROL
LER_H_ | 77 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_BROWSER_SHORTCUT_LAUNCHER_ITEM_CONTROL
LER_H_ |
| OLD | NEW |