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

Unified Diff: chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controller.h

Issue 2716403005: mash: Remove shelf app menu item objects. (Closed)
Patch Set: Address comments. Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controller.h
diff --git a/chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controller.h b/chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controller.h
index 8c41068c34cc7222ad319cabc923dc772aff883e..987b5407f3b368a2dd414d65eb43e3bb9c32b42f 100644
--- a/chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controller.h
+++ b/chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controller.h
@@ -8,6 +8,8 @@
#include "base/macros.h"
#include "chrome/browser/ui/ash/launcher/launcher_item_controller.h"
#include "chrome/browser/ui/browser_list.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
namespace ash {
class ShelfModel;
@@ -17,15 +19,13 @@ namespace content {
class WebContents;
}
-namespace gfx {
-class Image;
-}
-
-class Browser;
class ChromeLauncherController;
-// Item controller for an browser shortcut.
-class BrowserShortcutLauncherItemController : public LauncherItemController {
+// Shelf item delegate for a browser shortcut; only one such item should exist.
+// This item shows an application menu that lists open browser windows or tabs.
+class BrowserShortcutLauncherItemController
+ : public LauncherItemController,
+ public content::NotificationObserver {
public:
BrowserShortcutLauncherItemController(ChromeLauncherController* controller,
ash::ShelfModel* shelf_model);
@@ -48,20 +48,10 @@ class BrowserShortcutLauncherItemController : public LauncherItemController {
int64_t display_id,
ash::ShelfLaunchSource source) override;
ash::ShelfAppMenuItemList GetAppMenuItems(int event_flags) override;
+ void ExecuteCommand(uint32_t command_id, int event_flags) override;
void Close() override;
private:
- // Get the favicon for the browser list entry for |web_contents|.
- // Note that for incognito windows the incognito icon will be returned.
- gfx::Image GetBrowserListIcon(content::WebContents* web_contents) const;
-
- // Get the title for the browser list entry for |web_contents|.
- // If |web_contents| has not loaded, returns "Net Tab".
- base::string16 GetBrowserListTitle(content::WebContents* web_contents) const;
-
- // Check if the given |web_contents| is in incognito mode.
- bool IsIncognito(content::WebContents* web_contents) const;
-
// Activate a browser - or advance to the next one on the list.
// Returns the action performed. Should be one of SHELF_ACTION_NONE,
// SHELF_ACTION_WINDOW_ACTIVATED, or SHELF_ACTION_NEW_WINDOW_CREATED.
@@ -74,8 +64,19 @@ class BrowserShortcutLauncherItemController : public LauncherItemController {
// Get a list of active browsers.
BrowserList::BrowserVector GetListOfActiveBrowsers();
+ // content::NotificationObserver:
+ void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) override;
+
ash::ShelfModel* shelf_model_;
+ // The cached list of open browser windows shown in an application menu.
+ BrowserList::BrowserVector browser_menu_items_;
+
+ // Registers for notifications of closing browser windows.
+ content::NotificationRegistrar registrar_;
+
DISALLOW_COPY_AND_ASSIGN(BrowserShortcutLauncherItemController);
};

Powered by Google App Engine
This is Rietveld 408576698