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

Side by Side Diff: chrome/renderer/extensions/extension_process_bindings.cc

Issue 159542: Add a WebKit API that registers a V8 extension to be loaded into content (Closed)
Patch Set: final Created 11 years, 4 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 (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #include "chrome/renderer/extensions/extension_process_bindings.h" 5 #include "chrome/renderer/extensions/extension_process_bindings.h"
6 6
7 #include "base/singleton.h" 7 #include "base/singleton.h"
8 #include "chrome/common/render_messages.h" 8 #include "chrome/common/render_messages.h"
9 #include "chrome/common/url_constants.h" 9 #include "chrome/common/url_constants.h"
10 #include "chrome/renderer/extensions/bindings_utils.h" 10 #include "chrome/renderer/extensions/bindings_utils.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 198
199 renderview->SendExtensionRequest(name, json_args, request_id, has_callback); 199 renderview->SendExtensionRequest(name, json_args, request_id, has_callback);
200 200
201 return v8::Undefined(); 201 return v8::Undefined();
202 } 202 }
203 }; 203 };
204 204
205 } // namespace 205 } // namespace
206 206
207 v8::Extension* ExtensionProcessBindings::Get() { 207 v8::Extension* ExtensionProcessBindings::Get() {
208 return new ExtensionImpl(); 208 static v8::Extension* extension = new ExtensionImpl();
209 return extension;
209 } 210 }
210 211
211 void ExtensionProcessBindings::SetFunctionNames( 212 void ExtensionProcessBindings::SetFunctionNames(
212 const std::vector<std::string>& names) { 213 const std::vector<std::string>& names) {
213 ExtensionImpl::SetFunctionNames(names); 214 ExtensionImpl::SetFunctionNames(names);
214 } 215 }
215 216
216 // static 217 // static
217 void ExtensionProcessBindings::HandleResponse(int request_id, bool success, 218 void ExtensionProcessBindings::HandleResponse(int request_id, bool success,
218 const std::string& response, 219 const std::string& response,
(...skipping 20 matching lines...) Expand all
239 const std::string& extension_id, 240 const std::string& extension_id,
240 const std::vector<std::string>& page_actions) { 241 const std::vector<std::string>& page_actions) {
241 PageActionIdMap& page_action_map = *GetPageActionMap(); 242 PageActionIdMap& page_action_map = *GetPageActionMap();
242 if (!page_actions.empty()) { 243 if (!page_actions.empty()) {
243 page_action_map[extension_id] = page_actions; 244 page_action_map[extension_id] = page_actions;
244 } else { 245 } else {
245 if (page_action_map.find(extension_id) != page_action_map.end()) 246 if (page_action_map.find(extension_id) != page_action_map.end())
246 page_action_map.erase(extension_id); 247 page_action_map.erase(extension_id);
247 } 248 }
248 } 249 }
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/event_bindings.cc ('k') | chrome/renderer/extensions/renderer_extension_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698