| OLD | NEW |
| 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 <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 } else if (name->Equals(v8::String::New("GetCurrentPageActions"))) { | 224 } else if (name->Equals(v8::String::New("GetCurrentPageActions"))) { |
| 225 return v8::FunctionTemplate::New(GetCurrentPageActions); | 225 return v8::FunctionTemplate::New(GetCurrentPageActions); |
| 226 } else if (name->Equals(v8::String::New("StartRequest"))) { | 226 } else if (name->Equals(v8::String::New("StartRequest"))) { |
| 227 return v8::FunctionTemplate::New(StartRequest); | 227 return v8::FunctionTemplate::New(StartRequest); |
| 228 } else if (name->Equals(v8::String::New("GetRenderViewId"))) { | 228 } else if (name->Equals(v8::String::New("GetRenderViewId"))) { |
| 229 return v8::FunctionTemplate::New(GetRenderViewId); | 229 return v8::FunctionTemplate::New(GetRenderViewId); |
| 230 } else if (name->Equals(v8::String::New("GetL10nMessage"))) { | 230 } else if (name->Equals(v8::String::New("GetL10nMessage"))) { |
| 231 return v8::FunctionTemplate::New(GetL10nMessage); | 231 return v8::FunctionTemplate::New(GetL10nMessage); |
| 232 } else if (name->Equals(v8::String::New("GetPopupView"))) { | 232 } else if (name->Equals(v8::String::New("GetPopupView"))) { |
| 233 return v8::FunctionTemplate::New(GetPopupView); | 233 return v8::FunctionTemplate::New(GetPopupView); |
| 234 } else if (name->Equals(v8::String::New("GetPopupAnchorView"))) { | 234 } else if (name->Equals(v8::String::New("GetPopupParentWindow"))) { |
| 235 return v8::FunctionTemplate::New(GetPopupAnchorView); | 235 return v8::FunctionTemplate::New(GetPopupParentWindow); |
| 236 } else if (name->Equals(v8::String::New("SetExtensionActionIcon"))) { | 236 } else if (name->Equals(v8::String::New("SetExtensionActionIcon"))) { |
| 237 return v8::FunctionTemplate::New(SetExtensionActionIcon); | 237 return v8::FunctionTemplate::New(SetExtensionActionIcon); |
| 238 } | 238 } |
| 239 | 239 |
| 240 return ExtensionBase::GetNativeFunction(name); | 240 return ExtensionBase::GetNativeFunction(name); |
| 241 } | 241 } |
| 242 | 242 |
| 243 private: | 243 private: |
| 244 static v8::Handle<v8::Value> GetExtensionAPIDefinition( | 244 static v8::Handle<v8::Value> GetExtensionAPIDefinition( |
| 245 const v8::Arguments& args) { | 245 const v8::Arguments& args) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 DCHECK(popup_matcher.views()->Has(0)); | 282 DCHECK(popup_matcher.views()->Has(0)); |
| 283 | 283 |
| 284 // Return the first view found. | 284 // Return the first view found. |
| 285 return popup_matcher.views()->Get(v8::Integer::New(0)); | 285 return popup_matcher.views()->Get(v8::Integer::New(0)); |
| 286 } | 286 } |
| 287 | 287 |
| 288 static v8::Handle<v8::Value> GetPopupView(const v8::Arguments& args) { | 288 static v8::Handle<v8::Value> GetPopupView(const v8::Arguments& args) { |
| 289 return PopupViewFinder(args, ViewType::EXTENSION_POPUP); | 289 return PopupViewFinder(args, ViewType::EXTENSION_POPUP); |
| 290 } | 290 } |
| 291 | 291 |
| 292 static v8::Handle<v8::Value> GetPopupAnchorView(const v8::Arguments& args) { | 292 static v8::Handle<v8::Value> GetPopupParentWindow(const v8::Arguments& args) { |
| 293 return PopupViewFinder(args, ViewType::EXTENSION_TOOLSTRIP); | 293 return PopupViewFinder(args, ViewType::EXTENSION_TOOLSTRIP); |
| 294 } | 294 } |
| 295 | 295 |
| 296 static v8::Handle<v8::Value> GetExtensionViews(const v8::Arguments& args) { | 296 static v8::Handle<v8::Value> GetExtensionViews(const v8::Arguments& args) { |
| 297 if (args.Length() != 2) | 297 if (args.Length() != 2) |
| 298 return v8::Undefined(); | 298 return v8::Undefined(); |
| 299 | 299 |
| 300 if (!args[0]->IsInt32() || !args[1]->IsString()) | 300 if (!args[0]->IsInt32() || !args[1]->IsString()) |
| 301 return v8::Undefined(); | 301 return v8::Undefined(); |
| 302 | 302 |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 return; | 678 return; |
| 679 | 679 |
| 680 v8::HandleScope handle_scope; | 680 v8::HandleScope handle_scope; |
| 681 WebFrame* frame = view->mainFrame(); | 681 WebFrame* frame = view->mainFrame(); |
| 682 v8::Local<v8::Context> context = frame->mainWorldScriptContext(); | 682 v8::Local<v8::Context> context = frame->mainWorldScriptContext(); |
| 683 v8::Handle<v8::Value> argv[1]; | 683 v8::Handle<v8::Value> argv[1]; |
| 684 argv[0] = v8::String::New(type_str); | 684 argv[0] = v8::String::New(type_str); |
| 685 bindings_utils::CallFunctionInContext(context, "setViewType", | 685 bindings_utils::CallFunctionInContext(context, "setViewType", |
| 686 arraysize(argv), argv); | 686 arraysize(argv), argv); |
| 687 } | 687 } |
| OLD | NEW |