| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 82 |
| 83 base::Closure closure; | 83 base::Closure closure; |
| 84 int page_id; | 84 int page_id; |
| 85 }; | 85 }; |
| 86 typedef std::vector<PendingRequest> PendingRequestList; | 86 typedef std::vector<PendingRequest> PendingRequestList; |
| 87 typedef std::map<std::string, PendingRequestList> PendingRequestMap; | 87 typedef std::map<std::string, PendingRequestList> PendingRequestMap; |
| 88 | 88 |
| 89 // Runs any pending injections for the corresponding extension. | 89 // Runs any pending injections for the corresponding extension. |
| 90 void RunPendingForExtension(const Extension* extension); | 90 void RunPendingForExtension(const Extension* extension); |
| 91 | 91 |
| 92 // Handle the RequestContentScriptPermission message. | 92 // Handle the RequestScriptInjectionPermission message. |
| 93 void OnRequestContentScriptPermission(const std::string& extension_id, | 93 void OnRequestScriptInjectionPermission(const std::string& extension_id, |
| 94 int page_id, | 94 int page_id, |
| 95 int request_id); | 95 int request_id); |
| 96 | 96 |
| 97 // Grants permission for the given request to run. | 97 // Grants permission for the given request to run. |
| 98 void GrantContentScriptPermission(int request_id); | 98 void PermitScriptInjection(int request_id); |
| 99 | 99 |
| 100 // content::WebContentsObserver implementation. | 100 // content::WebContentsObserver implementation. |
| 101 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 101 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 102 | 102 |
| 103 // Log metrics. | 103 // Log metrics. |
| 104 void LogUMA() const; | 104 void LogUMA() const; |
| 105 | 105 |
| 106 // Whether or not the ActiveScriptController is enabled (corresponding to the | 106 // Whether or not the ActiveScriptController is enabled (corresponding to the |
| 107 // kActiveScriptEnforcement switch). If it is not, it acts as an empty shell, | 107 // kActiveScriptEnforcement switch). If it is not, it acts as an empty shell, |
| 108 // always allowing scripts to run and never displaying actions. | 108 // always allowing scripts to run and never displaying actions. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 122 // that get generated for extensions that haven't declared anything. | 122 // that get generated for extensions that haven't declared anything. |
| 123 typedef std::map<std::string, linked_ptr<ExtensionAction> > ActiveScriptMap; | 123 typedef std::map<std::string, linked_ptr<ExtensionAction> > ActiveScriptMap; |
| 124 ActiveScriptMap active_script_actions_; | 124 ActiveScriptMap active_script_actions_; |
| 125 | 125 |
| 126 DISALLOW_COPY_AND_ASSIGN(ActiveScriptController); | 126 DISALLOW_COPY_AND_ASSIGN(ActiveScriptController); |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 } // namespace extensions | 129 } // namespace extensions |
| 130 | 130 |
| 131 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVE_SCRIPT_CONTROLLER_H_ | 131 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVE_SCRIPT_CONTROLLER_H_ |
| OLD | NEW |