Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(499)

Side by Side Diff: chrome/browser/ui/views/toolbar/toolbar_action_view_delegate.h

Issue 670463004: Make a platform-independent ToolbarActionViewController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_DELEGATE_H_
6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_DELEGATE_H_
7
8 namespace content {
9 class WebContents;
10 }
11
12 namespace views {
13 class FocusManager;
14 class MenuButton;
15 class View;
16 class Widget;
17 }
18
19 class ToolbarActionViewController;
20
21 // The view that surrounds an ToolbarAction and owns the
22 // ToolbarActionViewController. Since different actions can subclass
23 // different views, we don't derive views::View directly here.
24 class ToolbarActionViewDelegate {
25 public:
26 // Returns |this| as a view. We need this because our subclasses implement
27 // different kinds of views, and inheriting View here is a really bad idea.
28 virtual views::View* GetAsView() = 0;
29
30 // Returns true if this view is being shown inside a menu.
31 virtual bool IsShownInMenu() = 0;
32
33 // Returns the FocusManager to use when registering accelerators.
34 virtual views::FocusManager* GetFocusManagerForAccelerator() = 0;
35
36 // Returns the parent for the associated context menu.
37 virtual views::Widget* GetParentForContextMenu() = 0;
38
39 // In some cases (such as when an action is shown in a menu), a substitute
40 // ToolbarActionViewController should be used for showing popups. This
41 // returns the preferred control.
42 virtual ToolbarActionViewController* GetPreferredPopupViewController() = 0;
43
44 // Returns the reference view for the extension action's popup.
45 virtual views::View* GetReferenceViewForPopup() = 0;
46
47 // Returns the MenuButton (if any) to use in showing the context menu (this
48 // allows views code to update the pressed state of the button).
49 virtual views::MenuButton* GetContextMenuButton() = 0;
50
51 // Returns the current web contents.
52 virtual content::WebContents* GetCurrentWebContents() const = 0;
53
54 // Hides whatever popup is active (even if it's not this one).
55 virtual void HideActivePopup() = 0;
56
57 // Called when the icon is updated; this is forwarded from the icon factory.
58 virtual void OnIconUpdated() = 0;
59
60 // Called when a popup is shown. See ExecuteAction() for the definition of
61 // |grant_tab_permissions|.
62 virtual void OnPopupShown(bool grant_tab_permissions) {}
63
64 // Does any additional cleanup after the popup is closed.
65 virtual void CleanupPopup() {}
66
67 protected:
68 virtual ~ToolbarActionViewDelegate() {}
69 };
70
71 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698