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

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

Issue 288053002: Block content scripts from executing until user grants permission (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase after ScriptInjection refactor Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 PendingRequest(); // For STL. 73 PendingRequest(); // For STL.
74 PendingRequest(const base::Closure& closure, int page_id); 74 PendingRequest(const base::Closure& closure, int page_id);
75 ~PendingRequest(); 75 ~PendingRequest();
76 76
77 base::Closure closure; 77 base::Closure closure;
78 int page_id; 78 int page_id;
79 }; 79 };
80 typedef std::vector<PendingRequest> PendingRequestList; 80 typedef std::vector<PendingRequest> PendingRequestList;
81 typedef std::map<std::string, PendingRequestList> PendingRequestMap; 81 typedef std::map<std::string, PendingRequestList> PendingRequestMap;
82 82
83 // Handles the NotifyExtensionScriptExecution message. 83 // Handle the RequestContentScriptPermission message.
84 void OnNotifyExtensionScriptExecution(const std::string& extension_id, 84 void OnRequestContentScriptPermission(const std::string& extension_id,
85 int page_id); 85 int page_id,
86 int request_id);
87
88 // Grants permission for the given request to run.
89 void GrantContentScriptPermission(int request_id);
86 90
87 // content::WebContentsObserver implementation. 91 // content::WebContentsObserver implementation.
88 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 92 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
89 93
90 // Log metrics. 94 // Log metrics.
91 void LogUMA() const; 95 void LogUMA() const;
92 96
93 // Whether or not the ActiveScriptController is enabled (corresponding to the 97 // Whether or not the ActiveScriptController is enabled (corresponding to the
94 // kActiveScriptEnforcement switch). If it is not, it acts as an empty shell, 98 // kActiveScriptEnforcement switch). If it is not, it acts as an empty shell,
95 // always allowing scripts to run and never displaying actions. 99 // always allowing scripts to run and never displaying actions.
(...skipping 13 matching lines...) Expand all
109 // that get generated for extensions that haven't declared anything. 113 // that get generated for extensions that haven't declared anything.
110 typedef std::map<std::string, linked_ptr<ExtensionAction> > ActiveScriptMap; 114 typedef std::map<std::string, linked_ptr<ExtensionAction> > ActiveScriptMap;
111 ActiveScriptMap active_script_actions_; 115 ActiveScriptMap active_script_actions_;
112 116
113 DISALLOW_COPY_AND_ASSIGN(ActiveScriptController); 117 DISALLOW_COPY_AND_ASSIGN(ActiveScriptController);
114 }; 118 };
115 119
116 } // namespace extensions 120 } // namespace extensions
117 121
118 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVE_SCRIPT_CONTROLLER_H_ 122 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVE_SCRIPT_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/active_script_controller.cc » ('j') | chrome/browser/extensions/user_script_master.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698