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

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

Issue 11571014: Lazy load chrome.* APIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: android compilation Created 7 years, 9 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 | 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 "chrome/common/extensions/api/extension_action/action_info.h" 9 #include "chrome/common/extensions/api/extension_action/action_info.h"
10 #include "chrome/common/extensions/extension.h" 10 #include "chrome/common/extensions/extension.h"
11 #include "chrome/renderer/extensions/dispatcher.h" 11 #include "chrome/renderer/extensions/dispatcher.h"
12 #include "grit/renderer_resources.h" 12 #include "grit/renderer_resources.h"
13 #include "v8/include/v8.h" 13 #include "v8/include/v8.h"
14 14
15 namespace extensions { 15 namespace extensions {
16 16
17 PageActionsCustomBindings::PageActionsCustomBindings( 17 PageActionsCustomBindings::PageActionsCustomBindings(
18 Dispatcher* dispatcher) 18 Dispatcher* dispatcher, v8::Handle<v8::Context> v8_context)
19 : ChromeV8Extension(dispatcher) { 19 : ChromeV8Extension(dispatcher, v8_context) {
20 RouteStaticFunction("GetCurrentPageActions", &GetCurrentPageActions); 20 RouteStaticFunction("GetCurrentPageActions", &GetCurrentPageActions);
21 } 21 }
22 22
23 // static 23 // static
24 v8::Handle<v8::Value> PageActionsCustomBindings::GetCurrentPageActions( 24 v8::Handle<v8::Value> PageActionsCustomBindings::GetCurrentPageActions(
25 const v8::Arguments& args) { 25 const v8::Arguments& args) {
26 PageActionsCustomBindings* self = 26 PageActionsCustomBindings* self =
27 GetFromArguments<PageActionsCustomBindings>(args); 27 GetFromArguments<PageActionsCustomBindings>(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 self->dispatcher_->extensions()->GetByID(extension_id); 31 self->dispatcher_->extensions()->GetByID(extension_id);
32 CHECK(extension); 32 CHECK(extension);
33 33
34 v8::Local<v8::Array> page_action_vector = v8::Array::New(); 34 v8::Local<v8::Array> page_action_vector = v8::Array::New();
35 if (ActionInfo::GetPageActionInfo(extension)) { 35 if (ActionInfo::GetPageActionInfo(extension)) {
36 std::string id = ActionInfo::GetPageActionInfo(extension)->id; 36 std::string id = ActionInfo::GetPageActionInfo(extension)->id;
37 page_action_vector->Set(v8::Integer::New(0), 37 page_action_vector->Set(v8::Integer::New(0),
38 v8::String::New(id.c_str(), id.size())); 38 v8::String::New(id.c_str(), id.size()));
39 } 39 }
40 40
41 return page_action_vector; 41 return page_action_vector;
42 } 42 }
43 43
44 } // extensions 44 } // extensions
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/page_actions_custom_bindings.h ('k') | chrome/renderer/extensions/page_capture_custom_bindings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698