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

Side by Side Diff: extensions/renderer/dispatcher.h

Issue 1142993002: Don't send unnecessary ExtensionMsg_Loaded IPCs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: a test Created 5 years, 6 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
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 EXTENSIONS_RENDERER_DISPATCHER_H_ 5 #ifndef EXTENSIONS_RENDERER_DISPATCHER_H_
6 #define EXTENSIONS_RENDERER_DISPATCHER_H_ 6 #define EXTENSIONS_RENDERER_DISPATCHER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 static std::vector<std::pair<std::string, int> > GetJsResources(); 130 static std::vector<std::pair<std::string, int> > GetJsResources();
131 static void RegisterNativeHandlers(ModuleSystem* module_system, 131 static void RegisterNativeHandlers(ModuleSystem* module_system,
132 ScriptContext* context, 132 ScriptContext* context,
133 Dispatcher* dispatcher, 133 Dispatcher* dispatcher,
134 RequestSender* request_sender, 134 RequestSender* request_sender,
135 V8SchemaRegistry* v8_schema_registry); 135 V8SchemaRegistry* v8_schema_registry);
136 136
137 bool WasWebRequestUsedBySomeExtensions() const { return webrequest_used_; } 137 bool WasWebRequestUsedBySomeExtensions() const { return webrequest_used_; }
138 138
139 private: 139 private:
140 // The RendererPermissionsPolicyDelegateTest.CannotScriptWebstore test needs
141 // to call InsertExtensionForTest and the OnActivateExtension IPCs.
Devlin 2015/06/03 20:53:37 There is no InsertExtensionForTest ;)
not at google - send to devlin 2015/06/03 21:53:03 LoadExtensionForTest, oops.
140 friend class ::ChromeRenderViewTest; 142 friend class ::ChromeRenderViewTest;
141 FRIEND_TEST_ALL_PREFIXES(RendererPermissionsPolicyDelegateTest, 143 FRIEND_TEST_ALL_PREFIXES(RendererPermissionsPolicyDelegateTest,
142 CannotScriptWebstore); 144 CannotScriptWebstore);
143 145
146 // Inserts an Extension into |extensions_|. Normally the only way to do this
147 // would be through the ExtensionMsg_Loaded IPC (OnLoaded) but this can't be
148 // triggered for tests, because in the process of serializing then
149 // deserializing the IPC, Extension IDs manually set for testing are lost.
150 void LoadExtensionForTest(const Extension* extension);
151
144 // RenderProcessObserver implementation: 152 // RenderProcessObserver implementation:
145 bool OnControlMessageReceived(const IPC::Message& message) override; 153 bool OnControlMessageReceived(const IPC::Message& message) override;
146 void WebKitInitialized() override; 154 void WebKitInitialized() override;
147 void IdleNotification() override; 155 void IdleNotification() override;
148 void OnRenderProcessShutdown() override; 156 void OnRenderProcessShutdown() override;
149 157
150 void OnActivateExtension(const std::string& extension_id); 158 void OnActivateExtension(const std::string& extension_id);
151 void OnCancelSuspend(const std::string& extension_id); 159 void OnCancelSuspend(const std::string& extension_id);
152 void OnDeliverMessage(int target_port_id, const Message& message); 160 void OnDeliverMessage(int target_port_id, const Message& message);
153 void OnDispatchOnConnect(int target_port_id, 161 void OnDispatchOnConnect(int target_port_id,
154 const std::string& channel_name, 162 const std::string& channel_name,
155 const ExtensionMsg_TabConnectionInfo& source, 163 const ExtensionMsg_TabConnectionInfo& source,
156 const ExtensionMsg_ExternalConnectionInfo& info, 164 const ExtensionMsg_ExternalConnectionInfo& info,
157 const std::string& tls_channel_id); 165 const std::string& tls_channel_id);
158 void OnDispatchOnDisconnect(int port_id, const std::string& error_message); 166 void OnDispatchOnDisconnect(int port_id, const std::string& error_message);
159 void OnLoaded( 167 void OnLoaded(
160 const std::vector<ExtensionMsg_Loaded_Params>& loaded_extensions); 168 const std::vector<ExtensionMsg_Loaded_Params>& loaded_extensions);
161 void OnLoadedInternal(scoped_refptr<const Extension> extension);
162 void OnMessageInvoke(const std::string& extension_id, 169 void OnMessageInvoke(const std::string& extension_id,
163 const std::string& module_name, 170 const std::string& module_name,
164 const std::string& function_name, 171 const std::string& function_name,
165 const base::ListValue& args, 172 const base::ListValue& args,
166 bool user_gesture); 173 bool user_gesture);
167 void OnSetChannel(int channel); 174 void OnSetChannel(int channel);
168 void OnSetFunctionNames(const std::vector<std::string>& names); 175 void OnSetFunctionNames(const std::vector<std::string>& names);
169 void OnSetScriptingWhitelist( 176 void OnSetScriptingWhitelist(
170 const ExtensionsClient::ScriptingWhitelist& extension_ids); 177 const ExtensionsClient::ScriptingWhitelist& extension_ids);
171 void OnSetSystemFont(const std::string& font_family, 178 void OnSetSystemFont(const std::string& font_family,
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 312
306 // Status of webrequest usage. 313 // Status of webrequest usage.
307 bool webrequest_used_; 314 bool webrequest_used_;
308 315
309 DISALLOW_COPY_AND_ASSIGN(Dispatcher); 316 DISALLOW_COPY_AND_ASSIGN(Dispatcher);
310 }; 317 };
311 318
312 } // namespace extensions 319 } // namespace extensions
313 320
314 #endif // EXTENSIONS_RENDERER_DISPATCHER_H_ 321 #endif // EXTENSIONS_RENDERER_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698