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

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

Issue 527963003: Uncouple ActiveScriptController from LocationBarController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
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 <map>
8 #include <vector> 9 #include <vector>
9 10
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/linked_ptr.h"
12 #include "base/scoped_observer.h" 13 #include "base/scoped_observer.h"
13 #include "extensions/browser/extension_registry_observer.h" 14 #include "extensions/browser/extension_registry_observer.h"
14 15
15 class ExtensionAction; 16 class ExtensionAction;
16 17
17 namespace content { 18 namespace content {
18 class WebContents; 19 class WebContents;
19 class BrowserContext; 20 class BrowserContext;
20 } 21 }
21 22
22 namespace extensions { 23 namespace extensions {
23
24 class ActiveScriptController;
25 class Extension; 24 class Extension;
26 class ExtensionActionManager; 25 class ExtensionActionManager;
27 class ExtensionRegistry; 26 class ExtensionRegistry;
28 27
29 // Provides the UI with the current page actions for extensions. The execution 28 // Provides the UI with the current page actions for extensions. The execution
30 // of these actions is handled in the ExtensionActionAPI. 29 // of these actions is handled in the ExtensionActionAPI.
31 class LocationBarController : public ExtensionRegistryObserver { 30 class LocationBarController : public ExtensionRegistryObserver {
32 public: 31 public:
33 explicit LocationBarController(content::WebContents* web_contents); 32 explicit LocationBarController(content::WebContents* web_contents);
34 virtual ~LocationBarController(); 33 virtual ~LocationBarController();
35 34
36 // Returns the actions which should be displayed in the location bar. 35 // Returns the actions which should be displayed in the location bar.
37 std::vector<ExtensionAction*> GetCurrentActions(); 36 std::vector<ExtensionAction*> GetCurrentActions();
38 37
39 ActiveScriptController* active_script_controller() {
40 return active_script_controller_.get();
41 }
42
43 private: 38 private:
44 // ExtensionRegistryObserver implementation. 39 // ExtensionRegistryObserver implementation.
45 virtual void OnExtensionLoaded( 40 virtual void OnExtensionLoaded(
46 content::BrowserContext* browser_context, 41 content::BrowserContext* browser_context,
47 const Extension* extnesion) OVERRIDE; 42 const Extension* extension) OVERRIDE;
Finnur 2014/09/03 09:30:05 What? You don't like exnesions now? Is that it? :)
48 virtual void OnExtensionUnloaded( 43 virtual void OnExtensionUnloaded(
49 content::BrowserContext* browser_context, 44 content::BrowserContext* browser_context,
50 const Extension* extension, 45 const Extension* extension,
51 UnloadedExtensionInfo::Reason reason) OVERRIDE; 46 UnloadedExtensionInfo::Reason reason) OVERRIDE;
52 47
53 // The associated WebContents. 48 // The associated WebContents.
54 content::WebContents* web_contents_; 49 content::WebContents* web_contents_;
55 50
56 // The associated BrowserContext. 51 // The associated BrowserContext.
57 content::BrowserContext* browser_context_; 52 content::BrowserContext* browser_context_;
58 53
59 // The ExtensionActionManager to provide page actions. 54 // The ExtensionActionManager to provide page actions.
60 ExtensionActionManager* action_manager_; 55 ExtensionActionManager* action_manager_;
61 56
62 // Whether or not to show page actions in the location bar at all. (This is 57 // Whether or not to show page actions in the location bar at all. (This is
63 // false with the toolbar redesign enabled.) 58 // false with the toolbar redesign enabled.)
64 bool should_show_page_actions_; 59 bool should_show_page_actions_;
65 60
66 // The ActiveScriptController, which could also add actions for extensions if 61 // Manufactured page actions that have been generated for extensions that want
67 // they have a pending script. 62 // to run a script, but were blocked.
68 scoped_ptr<ActiveScriptController> active_script_controller_; 63 typedef std::map<std::string, linked_ptr<ExtensionAction> >
64 ExtensionActionMap;
65 ExtensionActionMap active_script_actions_;
69 66
70 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> 67 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
71 extension_registry_observer_; 68 extension_registry_observer_;
72 69
73 DISALLOW_COPY_AND_ASSIGN(LocationBarController); 70 DISALLOW_COPY_AND_ASSIGN(LocationBarController);
74 }; 71 };
75 72
76 } // namespace extensions 73 } // namespace extensions
77 74
78 #endif // CHROME_BROWSER_EXTENSIONS_LOCATION_BAR_CONTROLLER_H_ 75 #endif // CHROME_BROWSER_EXTENSIONS_LOCATION_BAR_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_context_menu_model.cc ('k') | chrome/browser/extensions/location_bar_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698