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

Side by Side Diff: chrome/browser/extensions/location_bar_controller.h

Issue 270153004: Introduce ActiveScriptController; track active extension scripts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: UMA Created 6 years, 7 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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_EXTENSIONS_LOCATION_BAR_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_LOCATION_BAR_CONTROLLER_H_
6 #define CHROME_BROWSER_EXTENSIONS_LOCATION_BAR_CONTROLLER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_LOCATION_BAR_CONTROLLER_H_
7 7
8 #include <set>
9 #include <string>
10 #include <vector> 8 #include <vector>
11 9
10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12
13 namespace content {
14 class WebContents;
15 }
16
12 class ExtensionAction; 17 class ExtensionAction;
13 18
14 namespace extensions { 19 namespace extensions {
20 class ActiveScriptController;
21 class PageActionController;
15 22
16 // Interface for a class that controls the the extension icons that show up in 23 // Interface for a class that controls the the extension icons that show up in
17 // the location bar. Depending on switches, these icons can have differing 24 // the location bar. Depending on switches, these icons can have differing
18 // behavior. 25 // behavior.
19 class LocationBarController { 26 class LocationBarController {
20 public: 27 public:
21 // The reaction that the UI should take after executing |OnClicked|. 28 // The mouse button that was pressed.
29 enum MouseButton {
30 MOUSE_BUTTON_LEFT,
31 MOUSE_BUTTON_MIDDLE,
32 MOUSE_BUTTON_RIGHT,
33 };
34
35 // The action that the UI should take after executing |OnClicked|.
22 enum Action { 36 enum Action {
23 ACTION_NONE, 37 ACTION_NONE,
24 ACTION_SHOW_POPUP, 38 ACTION_SHOW_POPUP,
25 ACTION_SHOW_CONTEXT_MENU, 39 ACTION_SHOW_CONTEXT_MENU,
26 }; 40 };
27 41
28 virtual ~LocationBarController() {} 42 explicit LocationBarController(content::WebContents* web_contents);
43 virtual ~LocationBarController();
not at google - send to devlin 2014/05/07 23:30:38 no longer virtual
Devlin 2014/05/08 18:15:46 And... virtual again. :)
29 44
30 // Gets the action data for all extensions. 45 // Returns the actions which should be displayed in the location bar.
31 virtual std::vector<ExtensionAction*> GetCurrentActions() const = 0; 46 std::vector<ExtensionAction*> GetCurrentActions();
32 47
33 // Notifies this that the badge for an extension has been clicked with some 48 // Notifies this that an ExtensionAction has been clicked, and returns the
34 // mouse button (1 for left, 2 for middle, and 3 for right click), and 49 // action which should be taken in response (if any).
35 // returns the action that should be taken in response (if any). 50 Action OnClicked(const ExtensionAction* action, MouseButton button);
36 // TODO(kalman): make mouse_button an enum.
37 virtual Action OnClicked(const std::string& extension_id,
38 int mouse_button) = 0;
39 51
40 // Notifies clients that the icons have changed. 52 // Notifies the window that the actions have changed.
41 virtual void NotifyChange() = 0; 53 void NotifyChange();
54
55 ActiveScriptController* active_script_controller() {
56 return active_script_controller_.get();
57 }
58
59 PageActionController* page_action_controller() {
60 return page_action_controller_.get();
61 }
62
63 private:
64 // The associated WebContents.
65 content::WebContents* web_contents_;
66
67 // The controller for extensions running scripts on a page.
68 scoped_ptr<ActiveScriptController> active_script_controller_;
69
70 // The controller for extensions with page actions.
71 scoped_ptr<PageActionController> page_action_controller_;
72
73 DISALLOW_COPY_AND_ASSIGN(LocationBarController);
42 }; 74 };
43 75
44 } // namespace extensions 76 } // namespace extensions
45 77
46 #endif // CHROME_BROWSER_EXTENSIONS_LOCATION_BAR_CONTROLLER_H_ 78 #endif // CHROME_BROWSER_EXTENSIONS_LOCATION_BAR_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698