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

Side by Side Diff: chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controller.h

Issue 2791803002: mash: Move LauncherItemController to ash, rename ShelfItemDelegate. (Closed)
Patch Set: Sync and rebase. Created 3 years, 8 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 unified diff | Download patch
OLDNEW
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 "ash/public/cpp/shelf_item_delegate.h"
8 #include "base/macros.h" 9 #include "base/macros.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 "content/public/browser/notification_observer.h"
12 #include "content/public/browser/notification_registrar.h" 12 #include "content/public/browser/notification_registrar.h"
13 13
14 namespace ash { 14 namespace ash {
15 class ShelfModel; 15 class ShelfModel;
16 } 16 }
17 17
18 namespace content { 18 namespace content {
19 class WebContents; 19 class WebContents;
20 } 20 }
21 21
22 class ChromeLauncherController;
23
24 // Shelf item delegate for a browser shortcut; only one such item should exist. 22 // 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. 23 // This item shows an application menu that lists open browser windows or tabs.
26 class BrowserShortcutLauncherItemController 24 class BrowserShortcutLauncherItemController
27 : public LauncherItemController, 25 : public ash::ShelfItemDelegate,
28 public content::NotificationObserver { 26 public content::NotificationObserver {
29 public: 27 public:
30 BrowserShortcutLauncherItemController(ChromeLauncherController* controller, 28 explicit BrowserShortcutLauncherItemController(ash::ShelfModel* shelf_model);
31 ash::ShelfModel* shelf_model);
32 29
33 ~BrowserShortcutLauncherItemController() override; 30 ~BrowserShortcutLauncherItemController() override;
34 31
35 // Updates the activation state of the Broswer item. 32 // Updates the activation state of the Broswer item.
36 void UpdateBrowserItemState(); 33 void UpdateBrowserItemState();
37 34
38 // Sets the shelf id for the browser window if the browser is represented. 35 // Sets the shelf id for the browser window if the browser is represented.
39 void SetShelfIDForBrowserWindowContents(Browser* browser, 36 void SetShelfIDForBrowserWindowContents(Browser* browser,
40 content::WebContents* web_contents); 37 content::WebContents* web_contents);
41 38
42 // Check if there is any active browsers windows. 39 // Check if there is any active browsers windows.
43 bool IsListOfActiveBrowserEmpty(); 40 bool IsListOfActiveBrowserEmpty();
44 41
45 // LauncherItemController overrides: 42 // ash::ShelfItemDelegate overrides:
46 void ItemSelected(std::unique_ptr<ui::Event> event, 43 void ItemSelected(std::unique_ptr<ui::Event> event,
47 int64_t display_id, 44 int64_t display_id,
48 ash::ShelfLaunchSource source, 45 ash::ShelfLaunchSource source,
49 const ItemSelectedCallback& callback) override; 46 const ItemSelectedCallback& callback) override;
50 MenuItemList GetAppMenuItems(int event_flags) override; 47 ash::MenuItemList GetAppMenuItems(int event_flags) override;
51 void ExecuteCommand(uint32_t command_id, int32_t event_flags) override; 48 void ExecuteCommand(uint32_t command_id, int32_t event_flags) override;
52 void Close() override; 49 void Close() override;
53 50
54 private: 51 private:
55 // Activate a browser - or advance to the next one on the list. 52 // Activate a browser - or advance to the next one on the list.
56 // Returns the action performed. Should be one of SHELF_ACTION_NONE, 53 // Returns the action performed. Should be one of SHELF_ACTION_NONE,
57 // SHELF_ACTION_WINDOW_ACTIVATED, or SHELF_ACTION_NEW_WINDOW_CREATED. 54 // SHELF_ACTION_WINDOW_ACTIVATED, or SHELF_ACTION_NEW_WINDOW_CREATED.
58 ash::ShelfAction ActivateOrAdvanceToNextBrowser(); 55 ash::ShelfAction ActivateOrAdvanceToNextBrowser();
59 56
60 // Returns true when the given |browser| is listed in the browser application 57 // Returns true when the given |browser| is listed in the browser application
(...skipping 13 matching lines...) Expand all
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. 74 // Registers for notifications of closing browser windows.
78 content::NotificationRegistrar registrar_; 75 content::NotificationRegistrar registrar_;
79 76
80 DISALLOW_COPY_AND_ASSIGN(BrowserShortcutLauncherItemController); 77 DISALLOW_COPY_AND_ASSIGN(BrowserShortcutLauncherItemController);
81 }; 78 };
82 79
83 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_BROWSER_SHORTCUT_LAUNCHER_ITEM_CONTROL LER_H_ 80 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_BROWSER_SHORTCUT_LAUNCHER_ITEM_CONTROL LER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698