OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 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_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_CONTROLLER_H_ | |
6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_CONTROLLER_H_ | |
7 | |
8 #include "base/strings/string16.h" | |
9 #include "ui/gfx/image/image.h" | |
10 | |
11 namespace gfx { | |
12 class Canvas; | |
13 class Rect; | |
14 } | |
15 | |
16 class ToolbarActionViewDelegate; | |
17 | |
18 // The basic controller class for actions that are shown on the toolbar, | |
19 // extension actions (like browser actions) and chrome actions (like | |
20 // chromecast). | |
21 class ToolbarActionViewController { | |
sky
2014/10/15 23:52:30
I'm surprised this class doesn't know about the nu
Devlin
2014/10/16 16:46:39
There's one controller per action per view.
| |
22 public: | |
23 virtual ~ToolbarActionViewController() {} | |
24 | |
25 // Sets the view delegate, which can handle most of the front-end logic. | |
26 virtual void SetDelegate(ToolbarActionViewDelegate* delegate) = 0; | |
27 | |
28 // Returns the icon to use for the given |tab_id|. | |
29 virtual gfx::Image GetIcon(int tab_id) = 0; | |
sky
2014/10/15 23:52:30
It's not clear at all what |tab_id| is, not why th
Devlin
2014/10/16 16:46:39
There is currently one ToolbarActionViewController
sky
2014/10/16 18:13:39
I'm ok with what you have. What isn't all clear th
Devlin
2014/10/16 22:05:27
Ah, I see. I didn't realize that tab ids weren't
| |
30 | |
31 // Returns the accessible name to use for the given |tab_id|. | |
32 virtual base::string16 GetAccessibleName(int tab_id) const = 0; | |
33 | |
34 // Returns the tooltip to use for the given |tab_id|. | |
35 virtual base::string16 GetTooltip(int tab_id) const = 0; | |
36 | |
37 // Returns true if the action should be enabled on the given |tab_id|. | |
38 virtual bool IsEnabled(int tab_id) const = 0; | |
39 | |
40 // Returns true if the action has a popup for the given |tab_id|. | |
41 virtual bool HasPopup(int tab_id) const = 0; | |
42 | |
43 // Hides the current popup, if one is visible. | |
44 virtual void HidePopup() = 0; | |
45 | |
46 // Returns true if a menu is currently running for the action. | |
47 virtual bool IsMenuRunning() const = 0; | |
48 | |
49 // Executes the default action (typically showing the popup), and attributes | |
50 // the action to a user (thus, only use this for actions that *were* done by | |
51 // the user). | |
52 virtual void ExecuteActionByUser() = 0; | |
53 | |
54 // Paints any extra parts of the image (e.g., a badge). | |
55 virtual void PaintExtra(gfx::Canvas* canvas, | |
56 const gfx::Rect& bounds, | |
57 int tab_id) const { | |
58 } | |
59 | |
60 // Registers an accelerator. Called when the view is added to the hierarchy. | |
61 // Unregistering any commands is the responsibility of the controller. | |
62 virtual void RegisterCommand() { | |
63 } | |
64 }; | |
65 | |
66 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_CONTROLLER_H_ | |
OLD | NEW |