OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 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_EXTENSIONS_PAGE_BOX_CONTROLLER_H_ | |
6 #define CHROME_BROWSER_EXTENSIONS_PAGE_BOX_CONTROLLER_H_ | |
7 #pragma once | |
8 | |
9 #include <string> | |
10 #include <vector> | |
11 | |
12 #include "base/memory/scoped_ptr.h" | |
13 | |
14 class ExtensionAction; | |
15 | |
16 namespace extensions { | |
17 | |
18 // Controller of the "badges" (aka "page actions") in the UI. | |
19 class PageBoxController { | |
20 public: | |
21 // UI decoration on a page box item. | |
22 enum Decoration { | |
23 DECORATION_NONE, | |
24 }; | |
25 | |
26 // Data about a UI badge. | |
27 struct Data { | |
28 // The type of decoration that should be applied to the badge. | |
29 Decoration decoration; | |
30 | |
31 // The ExtensionAction that corresponds to the badge. | |
32 ExtensionAction* action; | |
33 }; | |
34 | |
35 // Mouse button type passed into OnClicked. | |
36 enum MouseButton { | |
37 MOUSE_LEFT, | |
Evan Stade
2012/05/14 19:24:07
if you make this = 1, and the next = 2, etc., then
| |
38 MOUSE_MIDDLE, | |
39 MOUSE_RIGHT, | |
40 }; | |
41 | |
42 typedef std::vector<Data> DataList; | |
43 | |
44 // The reaction that the UI should take after executing |OnClicked|. | |
45 enum Action { | |
46 ACTION_NONE, | |
47 ACTION_SHOW_POPUP, | |
48 ACTION_SHOW_CONTEXT_MENU, | |
49 }; | |
50 | |
51 virtual ~PageBoxController() {} | |
52 | |
53 // Gets the badge data for all extensions. | |
54 virtual scoped_ptr<DataList> GetAllBadgeData() = 0; | |
55 | |
56 // Notifies this that the badge for an extension has been clicked with some | |
57 // mouse button (1 for left, 2 for middle, and 3 for right click), and | |
58 // returns the action that should be taken in response (if any). | |
59 virtual Action OnClicked(const std::string& extension_id, | |
60 MouseButton button) = 0; | |
61 }; | |
62 | |
63 } // namespace extensions | |
64 | |
65 #endif // CHROME_BROWSER_EXTENSIONS_PAGE_BOX_CONTROLLER_H_ | |
OLD | NEW |