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