OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_ACTIVE_SCRIPT_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_ACTIVE_SCRIPT_CONTROLLER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_ACTIVE_SCRIPT_CONTROLLER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_ACTIVE_SCRIPT_CONTROLLER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 void PermitScriptInjection(int64 request_id); | 110 void PermitScriptInjection(int64 request_id); |
111 | 111 |
112 // Notifies the ExtensionActionAPI of a change (either that an extension now | 112 // Notifies the ExtensionActionAPI of a change (either that an extension now |
113 // wants permission to run, or that it has been run). | 113 // wants permission to run, or that it has been run). |
114 void NotifyChange(const Extension* extension); | 114 void NotifyChange(const Extension* extension); |
115 | 115 |
116 // Log metrics. | 116 // Log metrics. |
117 void LogUMA() const; | 117 void LogUMA() const; |
118 | 118 |
119 // content::WebContentsObserver implementation. | 119 // content::WebContentsObserver implementation. |
120 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 120 virtual bool OnMessageReceived(const IPC::Message& message) override; |
121 virtual void DidNavigateMainFrame( | 121 virtual void DidNavigateMainFrame( |
122 const content::LoadCommittedDetails& details, | 122 const content::LoadCommittedDetails& details, |
123 const content::FrameNavigateParams& params) OVERRIDE; | 123 const content::FrameNavigateParams& params) override; |
124 | 124 |
125 // ExtensionRegistryObserver: | 125 // ExtensionRegistryObserver: |
126 virtual void OnExtensionUnloaded( | 126 virtual void OnExtensionUnloaded( |
127 content::BrowserContext* browser_context, | 127 content::BrowserContext* browser_context, |
128 const Extension* extension, | 128 const Extension* extension, |
129 UnloadedExtensionInfo::Reason reason) OVERRIDE; | 129 UnloadedExtensionInfo::Reason reason) override; |
130 | 130 |
131 // The associated browser context. | 131 // The associated browser context. |
132 content::BrowserContext* browser_context_; | 132 content::BrowserContext* browser_context_; |
133 | 133 |
134 // Whether or not the ActiveScriptController is enabled (corresponding to the | 134 // Whether or not the ActiveScriptController is enabled (corresponding to the |
135 // kActiveScriptEnforcement switch). If it is not, it acts as an empty shell, | 135 // kActiveScriptEnforcement switch). If it is not, it acts as an empty shell, |
136 // always allowing scripts to run and never displaying actions. | 136 // always allowing scripts to run and never displaying actions. |
137 bool enabled_; | 137 bool enabled_; |
138 | 138 |
139 // The map of extension_id:pending_request of all pending requests. | 139 // The map of extension_id:pending_request of all pending requests. |
140 PendingRequestMap pending_requests_; | 140 PendingRequestMap pending_requests_; |
141 | 141 |
142 // The extensions which have been granted permission to run on the given page. | 142 // The extensions which have been granted permission to run on the given page. |
143 // TODO(rdevlin.cronin): Right now, this just keeps track of extensions that | 143 // TODO(rdevlin.cronin): Right now, this just keeps track of extensions that |
144 // have been permitted to run on the page via this interface. Instead, it | 144 // have been permitted to run on the page via this interface. Instead, it |
145 // should incorporate more fully with ActiveTab. | 145 // should incorporate more fully with ActiveTab. |
146 std::set<std::string> permitted_extensions_; | 146 std::set<std::string> permitted_extensions_; |
147 | 147 |
148 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 148 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
149 extension_registry_observer_; | 149 extension_registry_observer_; |
150 | 150 |
151 DISALLOW_COPY_AND_ASSIGN(ActiveScriptController); | 151 DISALLOW_COPY_AND_ASSIGN(ActiveScriptController); |
152 }; | 152 }; |
153 | 153 |
154 } // namespace extensions | 154 } // namespace extensions |
155 | 155 |
156 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVE_SCRIPT_CONTROLLER_H_ | 156 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVE_SCRIPT_CONTROLLER_H_ |
OLD | NEW |