browser_shortcut_launcher_item_controller.h revision 1e9bf3e0803691d0a228da41fc608347b6db4340
190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// Copyright (c) 2013 The Chromium Authors. All rights reserved.
290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// found in the LICENSE file.
490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_BROWSER_SHORTCUT_LAUNCHER_ITEM_CONTROLLER_H_
690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#define CHROME_BROWSER_UI_ASH_LAUNCHER_BROWSER_SHORTCUT_LAUNCHER_ITEM_CONTROLLER_H_
790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "chrome/browser/ui/ash/launcher/launcher_item_controller.h"
990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
1090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)namespace content {
1190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)class WebContents;
1290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)}
1390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
1490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)namespace gfx {
1590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)class Image;
1690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)}
1790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
1890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)class Browser;
193551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)class ChromeLauncherController;
2090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
2190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// Item controller for an browser shortcut.
2290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)class BrowserShortcutLauncherItemController : public LauncherItemController {
2390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) public:
244e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  explicit BrowserShortcutLauncherItemController(
254e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)      ChromeLauncherController* controller);
2690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
27ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch  virtual ~BrowserShortcutLauncherItemController();
2890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
2958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  // Updates the activation state of the Broswer item.
3058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  void UpdateBrowserItemState();
3158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)
3290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // LauncherItemController overrides:
333551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  virtual bool IsCurrentlyShownInWindow(aura::Window* window) const OVERRIDE;
3490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  virtual bool IsOpen() const OVERRIDE;
3590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  virtual bool IsVisible() const OVERRIDE;
3668043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  virtual void Launch(ash::LaunchSource source, int event_flags) OVERRIDE;
3768043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  virtual void Activate(ash::LaunchSource source) OVERRIDE;
3890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  virtual void Close() OVERRIDE;
3990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  virtual ChromeLauncherAppMenuItems GetApplicationList(
4090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)      int event_flags) OVERRIDE;
414e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  virtual void ItemSelected(const ui::Event& event) OVERRIDE;
424e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  virtual base::string16 GetTitle() OVERRIDE;
434e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  virtual ui::MenuModel* CreateContextMenu(
441e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)      aura::Window* root_window) OVERRIDE;
454e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  virtual ash::LauncherMenuModel* CreateApplicationMenu(
464e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)      int event_flags) OVERRIDE;
474e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  virtual bool IsDraggable() OVERRIDE;
484e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  virtual bool ShouldShowTooltip() OVERRIDE;
4990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
5090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) private:
5190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Get the favicon for the browser list entry for |web_contents|.
5290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Note that for incognito windows the incognito icon will be returned.
5390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  gfx::Image GetBrowserListIcon(content::WebContents* web_contents) const;
5490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
5590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Get the title for the browser list entry for |web_contents|.
5690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // If |web_contents| has not loaded, returns "Net Tab".
5790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  string16 GetBrowserListTitle(content::WebContents* web_contents) const;
5890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
5990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Check if the given |web_contents| is in incognito mode.
6090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  bool IsIncognito(content::WebContents* web_contents) const;
6190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
6290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Activate a browser - or advance to the next one on the list.
6390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  void ActivateOrAdvanceToNextBrowser();
6490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
6558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  // Returns true when the given |browser| is listed in the browser application
6658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  // list.
6758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  bool IsBrowserRepresentedInBrowserList(Browser* browser);
6858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)
6990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(BrowserShortcutLauncherItemController);
7090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)};
7190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
7290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#endif  // CHROME_BROWSER_UI_ASH_LAUNCHER_BROWSER_SHORTCUT_LAUNCHER_ITEM_CONTROLLER_H_
73