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

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

Issue 8896013: Implement onEvent callback framework for UDP (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Put back the bracket. Created 9 years 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/schema_generated_bindings.h" 5 #include "chrome/renderer/extensions/schema_generated_bindings.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 v8::External::New(this)); 187 v8::External::New(this));
188 } else if (name->Equals(v8::String::New("GetExtensionViews"))) { 188 } else if (name->Equals(v8::String::New("GetExtensionViews"))) {
189 return v8::FunctionTemplate::New(GetExtensionViews, 189 return v8::FunctionTemplate::New(GetExtensionViews,
190 v8::External::New(this)); 190 v8::External::New(this));
191 } else if (name->Equals(v8::String::New("GetNextRequestId"))) { 191 } else if (name->Equals(v8::String::New("GetNextRequestId"))) {
192 return v8::FunctionTemplate::New(GetNextRequestId); 192 return v8::FunctionTemplate::New(GetNextRequestId);
193 } else if (name->Equals(v8::String::New("OpenChannelToTab"))) { 193 } else if (name->Equals(v8::String::New("OpenChannelToTab"))) {
194 return v8::FunctionTemplate::New(OpenChannelToTab); 194 return v8::FunctionTemplate::New(OpenChannelToTab);
195 } else if (name->Equals(v8::String::New("GetNextContextMenuId"))) { 195 } else if (name->Equals(v8::String::New("GetNextContextMenuId"))) {
196 return v8::FunctionTemplate::New(GetNextContextMenuId); 196 return v8::FunctionTemplate::New(GetNextContextMenuId);
197 } else if (name->Equals(v8::String::New("GetNextSocketEventId"))) {
198 return v8::FunctionTemplate::New(GetNextSocketEventId);
197 } else if (name->Equals(v8::String::New("GetNextTtsEventId"))) { 199 } else if (name->Equals(v8::String::New("GetNextTtsEventId"))) {
198 return v8::FunctionTemplate::New(GetNextTtsEventId); 200 return v8::FunctionTemplate::New(GetNextTtsEventId);
199 } else if (name->Equals(v8::String::New("GetCurrentPageActions"))) { 201 } else if (name->Equals(v8::String::New("GetCurrentPageActions"))) {
200 return v8::FunctionTemplate::New(GetCurrentPageActions, 202 return v8::FunctionTemplate::New(GetCurrentPageActions,
201 v8::External::New(this)); 203 v8::External::New(this));
202 } else if (name->Equals(v8::String::New("StartRequest"))) { 204 } else if (name->Equals(v8::String::New("StartRequest"))) {
203 return v8::FunctionTemplate::New(StartRequest, 205 return v8::FunctionTemplate::New(StartRequest,
204 v8::External::New(this)); 206 v8::External::New(this));
205 } else if (name->Equals(v8::String::New("GetRenderViewId"))) { 207 } else if (name->Equals(v8::String::New("GetRenderViewId"))) {
206 return v8::FunctionTemplate::New(GetRenderViewId); 208 return v8::FunctionTemplate::New(GetRenderViewId);
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 return v8::Integer::New(next_context_menu_id++); 446 return v8::Integer::New(next_context_menu_id++);
445 } 447 }
446 448
447 static v8::Handle<v8::Value> GetNextTtsEventId(const v8::Arguments& args) { 449 static v8::Handle<v8::Value> GetNextTtsEventId(const v8::Arguments& args) {
448 // Note: this works because the TTS API only works in the 450 // Note: this works because the TTS API only works in the
449 // extension process, not content scripts. 451 // extension process, not content scripts.
450 static int next_tts_event_id = 1; 452 static int next_tts_event_id = 1;
451 return v8::Integer::New(next_tts_event_id++); 453 return v8::Integer::New(next_tts_event_id++);
452 } 454 }
453 455
456 static v8::Handle<v8::Value> GetNextSocketEventId(
457 const v8::Arguments& args) {
458 // Same comment as GetNextTtsEventId.
459 static int next_event_id = 1;
460 return v8::Integer::New(next_event_id++);
461 }
462
454 static v8::Handle<v8::Value> GetCurrentPageActions( 463 static v8::Handle<v8::Value> GetCurrentPageActions(
455 const v8::Arguments& args) { 464 const v8::Arguments& args) {
456 ExtensionImpl* v8_extension = GetFromArguments<ExtensionImpl>(args); 465 ExtensionImpl* v8_extension = GetFromArguments<ExtensionImpl>(args);
457 std::string extension_id = *v8::String::Utf8Value(args[0]->ToString()); 466 std::string extension_id = *v8::String::Utf8Value(args[0]->ToString());
458 const ::Extension* extension = 467 const ::Extension* extension =
459 v8_extension->extension_dispatcher_->extensions()->GetByID( 468 v8_extension->extension_dispatcher_->extensions()->GetByID(
460 extension_id); 469 extension_id);
461 CHECK(!extension_id.empty()); 470 CHECK(!extension_id.empty());
462 if (!extension) 471 if (!extension)
463 return v8::Undefined(); 472 return v8::Undefined();
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 const std::string& extension_id) { 718 const std::string& extension_id) {
710 for (PendingRequestMap::const_iterator it = g_pending_requests.Get().begin(); 719 for (PendingRequestMap::const_iterator it = g_pending_requests.Get().begin();
711 it != g_pending_requests.Get().end(); ++it) { 720 it != g_pending_requests.Get().end(); ++it) {
712 if (it->second->extension_id == extension_id) 721 if (it->second->extension_id == extension_id)
713 return true; 722 return true;
714 } 723 }
715 return false; 724 return false;
716 } 725 }
717 726
718 } // namespace 727 } // namespace
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/extension_api.json ('k') | chrome/renderer/resources/extensions/schema_generated_bindings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698