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_BADGE_CONTROLLER_H_ | |
6 #define CHROME_BROWSER_EXTENSIONS_BADGE_CONTROLLER_H_ | |
7 #pragma once | |
8 | |
9 #include <string> | |
10 #include <vector> | |
11 | |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "chrome/browser/extensions/badge_decoration.h" | |
14 | |
15 class ExtensionAction; | |
16 | |
17 namespace extensions { | |
18 | |
19 // Controller of the "badges" (aka "page actions") in the UI. | |
Evan Stade
2012/05/11 21:52:08
confused about the terminology. I thought "badge"
Matt Perry
2012/05/11 22:01:17
Good point. This should be named ExtensionActionCo
not at google - send to devlin
2012/05/14 03:59:01
Cool. "Badge" was an attempt to make an agnostic n
Matt Perry
2012/05/14 18:48:57
I'm not a fan of PageBox. The generic name for Pag
not at google - send to devlin
2012/05/15 01:23:56
As discussed on IRC, made it ActionBoxController.
| |
20 class BadgeController { | |
21 public: | |
22 // Data about a UI badge. | |
23 struct Data { | |
24 // The type of decoration that should be applied to the badge. | |
25 badge_decoration::Decoration decoration; | |
26 | |
27 // The ExtensionAction that corresponds to the badge. | |
28 ExtensionAction* action; | |
29 }; | |
30 | |
31 typedef std::vector<Data> DataList; | |
32 | |
33 // The reaction that the UI should take after executing |OnClicked|. | |
34 enum Reaction { | |
Matt Perry
2012/05/11 21:15:12
Just "Action" ?
not at google - send to devlin
2012/05/14 03:59:01
Done.
| |
35 NONE, | |
36 SHOW_POPUP, | |
37 SHOW_CONTEXT_MENU, | |
38 }; | |
39 | |
40 virtual ~BadgeController() {} | |
41 | |
42 // Gets the badge data for all extensions. | |
43 virtual scoped_ptr<DataList> GetAllBadgeData() = 0; | |
44 | |
45 // Notifies this that the badge for an extension has been clicked with some | |
46 // mouse button (1 for left, 2 for middle, and 3 for right click), and | |
47 // returns the action that should be taken in response (if any). | |
48 virtual Reaction OnClicked(const std::string& extension_id, | |
49 int button_type) = 0; | |
50 }; | |
51 | |
52 } // namespace extensions | |
53 | |
54 #endif // CHROME_BROWSER_EXTENSIONS_BADGE_CONTROLLER_H_ | |
OLD | NEW |