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
3 // found in the LICENSE file.
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_
8 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h"
19 class ChromeLauncherController
;
21 // Item controller for an browser shortcut.
22 class BrowserShortcutLauncherItemController
: public LauncherItemController
{
24 explicit BrowserShortcutLauncherItemController(
25 ChromeLauncherController
* controller
);
27 ~BrowserShortcutLauncherItemController() override
;
29 // Updates the activation state of the Broswer item.
30 void UpdateBrowserItemState();
32 // Sets the shelf id for the browser window if the browser is represented.
33 void SetShelfIDForBrowserWindowContents(Browser
* browser
,
34 content::WebContents
* web_contents
);
36 // LauncherItemController overrides:
37 bool IsOpen() const override
;
38 bool IsVisible() const override
;
39 void Launch(ash::LaunchSource source
, int event_flags
) override
;
40 ShelfItemDelegate::PerformedAction
Activate(
41 ash::LaunchSource source
) override
;
42 ChromeLauncherAppMenuItems
GetApplicationList(int event_flags
) override
;
43 ash::ShelfItemDelegate::PerformedAction
ItemSelected(
44 const ui::Event
& event
) override
;
45 base::string16
GetTitle() override
;
46 ui::MenuModel
* CreateContextMenu(aura::Window
* root_window
) override
;
47 ash::ShelfMenuModel
* CreateApplicationMenu(int event_flags
) override
;
48 bool IsDraggable() override
;
49 bool ShouldShowTooltip() override
;
50 void Close() override
;
53 // Get the favicon for the browser list entry for |web_contents|.
54 // Note that for incognito windows the incognito icon will be returned.
55 gfx::Image
GetBrowserListIcon(content::WebContents
* web_contents
) const;
57 // Get the title for the browser list entry for |web_contents|.
58 // If |web_contents| has not loaded, returns "Net Tab".
59 base::string16
GetBrowserListTitle(content::WebContents
* web_contents
) const;
61 // Check if the given |web_contents| is in incognito mode.
62 bool IsIncognito(content::WebContents
* web_contents
) const;
64 // Activate a browser - or advance to the next one on the list.
65 // Returns the action performed. Should be one of kNoAction,
66 // kExistingWindowActivated, or kNewWindowCreated.
67 PerformedAction
ActivateOrAdvanceToNextBrowser();
69 // Returns true when the given |browser| is listed in the browser application
71 bool IsBrowserRepresentedInBrowserList(Browser
* browser
);
73 DISALLOW_COPY_AND_ASSIGN(BrowserShortcutLauncherItemController
);
76 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_BROWSER_SHORTCUT_LAUNCHER_ITEM_CONTROLLER_H_