OLD | NEW |
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 "chrome/browser/ui/ash/launcher/launcher_item_controller.h" | 8 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 class WebContents; | 11 class WebContents; |
12 } | 12 } |
13 | 13 |
14 namespace gfx { | 14 namespace gfx { |
15 class Image; | 15 class Image; |
16 } | 16 } |
17 | 17 |
18 class Browser; | 18 class Browser; |
19 class ChromeLauncherController; | 19 class ChromeLauncherController; |
20 | 20 |
21 // Item controller for an browser shortcut. | 21 // Item controller for an browser shortcut. |
22 class BrowserShortcutLauncherItemController : public LauncherItemController { | 22 class BrowserShortcutLauncherItemController : public LauncherItemController { |
23 public: | 23 public: |
24 explicit BrowserShortcutLauncherItemController( | 24 explicit BrowserShortcutLauncherItemController( |
25 ChromeLauncherController* controller); | 25 ChromeLauncherController* controller); |
26 | 26 |
27 virtual ~BrowserShortcutLauncherItemController(); | 27 ~BrowserShortcutLauncherItemController() override; |
28 | 28 |
29 // Updates the activation state of the Broswer item. | 29 // Updates the activation state of the Broswer item. |
30 void UpdateBrowserItemState(); | 30 void UpdateBrowserItemState(); |
31 | 31 |
32 // Sets the shelf id for the browser window if the browser is represented. | 32 // Sets the shelf id for the browser window if the browser is represented. |
33 void SetShelfIDForBrowserWindowContents(Browser* browser, | 33 void SetShelfIDForBrowserWindowContents(Browser* browser, |
34 content::WebContents* web_contents); | 34 content::WebContents* web_contents); |
35 | 35 |
36 // LauncherItemController overrides: | 36 // LauncherItemController overrides: |
37 virtual bool IsOpen() const override; | 37 bool IsOpen() const override; |
38 virtual bool IsVisible() const override; | 38 bool IsVisible() const override; |
39 virtual void Launch(ash::LaunchSource source, int event_flags) override; | 39 void Launch(ash::LaunchSource source, int event_flags) override; |
40 virtual bool Activate(ash::LaunchSource source) override; | 40 bool Activate(ash::LaunchSource source) override; |
41 virtual ChromeLauncherAppMenuItems GetApplicationList( | 41 ChromeLauncherAppMenuItems GetApplicationList(int event_flags) override; |
42 int event_flags) override; | 42 bool ItemSelected(const ui::Event& event) override; |
43 virtual bool ItemSelected(const ui::Event& event) override; | 43 base::string16 GetTitle() override; |
44 virtual base::string16 GetTitle() override; | 44 ui::MenuModel* CreateContextMenu(aura::Window* root_window) override; |
45 virtual ui::MenuModel* CreateContextMenu( | 45 ash::ShelfMenuModel* CreateApplicationMenu(int event_flags) override; |
46 aura::Window* root_window) override; | 46 bool IsDraggable() override; |
47 virtual ash::ShelfMenuModel* CreateApplicationMenu(int event_flags) override; | 47 bool ShouldShowTooltip() override; |
48 virtual bool IsDraggable() override; | 48 void Close() override; |
49 virtual bool ShouldShowTooltip() override; | |
50 virtual void Close() override; | |
51 | 49 |
52 private: | 50 private: |
53 // Get the favicon for the browser list entry for |web_contents|. | 51 // Get the favicon for the browser list entry for |web_contents|. |
54 // Note that for incognito windows the incognito icon will be returned. | 52 // Note that for incognito windows the incognito icon will be returned. |
55 gfx::Image GetBrowserListIcon(content::WebContents* web_contents) const; | 53 gfx::Image GetBrowserListIcon(content::WebContents* web_contents) const; |
56 | 54 |
57 // Get the title for the browser list entry for |web_contents|. | 55 // Get the title for the browser list entry for |web_contents|. |
58 // If |web_contents| has not loaded, returns "Net Tab". | 56 // If |web_contents| has not loaded, returns "Net Tab". |
59 base::string16 GetBrowserListTitle(content::WebContents* web_contents) const; | 57 base::string16 GetBrowserListTitle(content::WebContents* web_contents) const; |
60 | 58 |
61 // Check if the given |web_contents| is in incognito mode. | 59 // Check if the given |web_contents| is in incognito mode. |
62 bool IsIncognito(content::WebContents* web_contents) const; | 60 bool IsIncognito(content::WebContents* web_contents) const; |
63 | 61 |
64 // Activate a browser - or advance to the next one on the list. | 62 // Activate a browser - or advance to the next one on the list. |
65 void ActivateOrAdvanceToNextBrowser(); | 63 void ActivateOrAdvanceToNextBrowser(); |
66 | 64 |
67 // Returns true when the given |browser| is listed in the browser application | 65 // Returns true when the given |browser| is listed in the browser application |
68 // list. | 66 // list. |
69 bool IsBrowserRepresentedInBrowserList(Browser* browser); | 67 bool IsBrowserRepresentedInBrowserList(Browser* browser); |
70 | 68 |
71 DISALLOW_COPY_AND_ASSIGN(BrowserShortcutLauncherItemController); | 69 DISALLOW_COPY_AND_ASSIGN(BrowserShortcutLauncherItemController); |
72 }; | 70 }; |
73 | 71 |
74 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_BROWSER_SHORTCUT_LAUNCHER_ITEM_CONTROL
LER_H_ | 72 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_BROWSER_SHORTCUT_LAUNCHER_ITEM_CONTROL
LER_H_ |
OLD | NEW |