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

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

Issue 107083006: More v8-API-related cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/page_actions_custom_bindings.h" 5 #include "chrome/renderer/extensions/page_actions_custom_bindings.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "chrome/common/extensions/api/extension_action/action_info.h" 10 #include "chrome/common/extensions/api/extension_action/action_info.h"
(...skipping 13 matching lines...) Expand all
24 } 24 }
25 25
26 void PageActionsCustomBindings::GetCurrentPageActions( 26 void PageActionsCustomBindings::GetCurrentPageActions(
27 const v8::FunctionCallbackInfo<v8::Value>& args) { 27 const v8::FunctionCallbackInfo<v8::Value>& args) {
28 std::string extension_id = *v8::String::Utf8Value(args[0]->ToString()); 28 std::string extension_id = *v8::String::Utf8Value(args[0]->ToString());
29 CHECK(!extension_id.empty()); 29 CHECK(!extension_id.empty());
30 const Extension* extension = 30 const Extension* extension =
31 dispatcher_->extensions()->GetByID(extension_id); 31 dispatcher_->extensions()->GetByID(extension_id);
32 CHECK(extension); 32 CHECK(extension);
33 33
34 v8::Local<v8::Array> page_action_vector = v8::Array::New(args.GetIsolate()); 34 v8::Isolate* isolate = args.GetIsolate();
35 v8::Local<v8::Array> page_action_vector = v8::Array::New(isolate);
35 if (ActionInfo::GetPageActionInfo(extension)) { 36 if (ActionInfo::GetPageActionInfo(extension)) {
36 std::string id = ActionInfo::GetPageActionInfo(extension)->id; 37 std::string id = ActionInfo::GetPageActionInfo(extension)->id;
37 page_action_vector->Set(v8::Integer::New(0), 38 page_action_vector->Set(v8::Integer::New(isolate, 0),
38 v8::String::NewFromUtf8(args.GetIsolate(), 39 v8::String::NewFromUtf8(isolate,
39 id.c_str(), 40 id.c_str(),
40 v8::String::kNormalString, 41 v8::String::kNormalString,
41 id.size())); 42 id.size()));
42 } 43 }
43 44
44 args.GetReturnValue().Set(page_action_vector); 45 args.GetReturnValue().Set(page_action_vector);
45 } 46 }
46 47
47 } // namespace extensions 48 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/messaging_bindings.cc ('k') | chrome/renderer/extensions/pepper_request_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698