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. 4 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_ 7 8 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" 9 10 namespace content { 11 class WebContents; 12 } 13 14 namespace gfx { 15 class Image; 16 } 17 18 class Browser; 19 class ChromeLauncherControllerPerApp; 20 class Profile; 21 22 // Item controller for an browser shortcut. 23 class BrowserShortcutLauncherItemController : public LauncherItemController { 24 public: 25 BrowserShortcutLauncherItemController( 26 ChromeLauncherControllerPerApp* controller, 27 Profile* profile); 28 29 virtual ~BrowserShortcutLauncherItemController(); 30 31 // LauncherItemController overrides: 32 virtual string16 GetTitle() OVERRIDE; 33 virtual bool HasWindow(aura::Window* window) const OVERRIDE; 34 virtual bool IsOpen() const OVERRIDE; 35 virtual bool IsVisible() const OVERRIDE; 36 virtual void Launch(int event_flags) OVERRIDE; 37 virtual void Activate() OVERRIDE; 38 virtual void Close() OVERRIDE; 39 virtual void LauncherItemChanged( 40 int model_index, 41 const ash::LauncherItem& old_item) OVERRIDE; 42 virtual void Clicked(const ui::Event& event) OVERRIDE; 43 virtual void OnRemoved() OVERRIDE; 44 virtual ChromeLauncherAppMenuItems GetApplicationList( 45 int event_flags) OVERRIDE; 46 47 private: 48 // Get the favicon for the browser list entry for |web_contents|. 49 // Note that for incognito windows the incognito icon will be returned. 50 gfx::Image GetBrowserListIcon(content::WebContents* web_contents) const; 51 52 // Get the title for the browser list entry for |web_contents|. 53 // If |web_contents| has not loaded, returns "Net Tab". 54 string16 GetBrowserListTitle(content::WebContents* web_contents) const; 55 56 // Check if the given |web_contents| is in incognito mode. 57 bool IsIncognito(content::WebContents* web_contents) const; 58 59 // Activate a browser - or advance to the next one on the list. 60 void ActivateOrAdvanceToNextBrowser(); 61 62 ChromeLauncherControllerPerApp* app_controller_; 63 64 Profile* profile_; 65 66 DISALLOW_COPY_AND_ASSIGN(BrowserShortcutLauncherItemController); 67 }; 68 69 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_BROWSER_SHORTCUT_LAUNCHER_ITEM_CONTROLLER_H_ 70