| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 const Extension* extension) OVERRIDE; | 65 const Extension* extension) OVERRIDE; |
| 66 virtual LocationBarController::Action OnClicked( | 66 virtual LocationBarController::Action OnClicked( |
| 67 const Extension* extension) OVERRIDE; | 67 const Extension* extension) OVERRIDE; |
| 68 virtual void OnNavigated() OVERRIDE; | 68 virtual void OnNavigated() OVERRIDE; |
| 69 | 69 |
| 70 private: | 70 private: |
| 71 typedef std::vector<linked_ptr<const base::Closure> > PendingRequestList; | 71 typedef std::vector<linked_ptr<const base::Closure> > PendingRequestList; |
| 72 typedef std::map<std::string, PendingRequestList> PendingRequestMap; | 72 typedef std::map<std::string, PendingRequestList> PendingRequestMap; |
| 73 | 73 |
| 74 // Handles the NotifyExtensionScriptExecution message. | 74 // Handles the NotifyExtensionScriptExecution message. |
| 75 void OnNotifyExtensionScriptExecution(const std::string& extension_id, | 75 void OnRequestContentScriptPermission(const std::string& extension_id, |
| 76 int page_id); | 76 int page_id, |
| 77 int request_id); |
| 78 |
| 79 // Grant the request for permission. |
| 80 void GrantContentScriptPermission(int request_id); |
| 77 | 81 |
| 78 // Returns true if the ActiveScriptController should process the request. This | 82 // Returns true if the ActiveScriptController should process the request. This |
| 79 // can be false if, e.g., the page id does not match, the extension cannot | 83 // can be false if, e.g., the page id does not match, the extension cannot |
| 80 // be found, etc. | 84 // be found, etc. |
| 81 bool ShouldProcessRequest(const Extension* extension, int page_id); | 85 bool ShouldProcessRequest(const Extension* extension, int page_id); |
| 82 | 86 |
| 83 // Adds the |request| to the map of pending requests, or processes it | 87 // Adds the |request| to the map of pending requests, or processes it |
| 84 // immediately if no permission is needed. | 88 // immediately if no permission is needed. |
| 85 void AddOrProcessRequest(const Extension* extension, | 89 void AddOrProcessRequest(const Extension* extension, |
| 86 scoped_ptr<const base::Closure> request); | 90 scoped_ptr<const base::Closure> request); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 112 // that get generated for extensions that haven't declared anything. | 116 // that get generated for extensions that haven't declared anything. |
| 113 typedef std::map<std::string, linked_ptr<ExtensionAction> > ActiveScriptMap; | 117 typedef std::map<std::string, linked_ptr<ExtensionAction> > ActiveScriptMap; |
| 114 ActiveScriptMap active_script_actions_; | 118 ActiveScriptMap active_script_actions_; |
| 115 | 119 |
| 116 DISALLOW_COPY_AND_ASSIGN(ActiveScriptController); | 120 DISALLOW_COPY_AND_ASSIGN(ActiveScriptController); |
| 117 }; | 121 }; |
| 118 | 122 |
| 119 } // namespace extensions | 123 } // namespace extensions |
| 120 | 124 |
| 121 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVE_SCRIPT_CONTROLLER_H_ | 125 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVE_SCRIPT_CONTROLLER_H_ |
| OLD | NEW |