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

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

Issue 10911300: Move ExtensionAction from common/ to browser/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: proof of concept Created 8 years, 3 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/extension_action.h"
10 #include "chrome/renderer/extensions/dispatcher.h" 9 #include "chrome/renderer/extensions/dispatcher.h"
11 #include "grit/renderer_resources.h" 10 #include "grit/renderer_resources.h"
12 #include "v8/include/v8.h" 11 #include "v8/include/v8.h"
13 12
14 namespace extensions { 13 namespace extensions {
15 14
16 PageActionsCustomBindings::PageActionsCustomBindings( 15 PageActionsCustomBindings::PageActionsCustomBindings(
17 Dispatcher* dispatcher) 16 Dispatcher* dispatcher)
18 : ChromeV8Extension(dispatcher) { 17 : ChromeV8Extension(dispatcher) {
19 RouteStaticFunction("GetCurrentPageActions", &GetCurrentPageActions); 18 RouteStaticFunction("GetCurrentPageActions", &GetCurrentPageActions);
20 } 19 }
21 20
22 // static 21 // static
23 v8::Handle<v8::Value> PageActionsCustomBindings::GetCurrentPageActions( 22 v8::Handle<v8::Value> PageActionsCustomBindings::GetCurrentPageActions(
24 const v8::Arguments& args) { 23 const v8::Arguments& args) {
25 PageActionsCustomBindings* self = 24 PageActionsCustomBindings* self =
26 GetFromArguments<PageActionsCustomBindings>(args); 25 GetFromArguments<PageActionsCustomBindings>(args);
27 std::string extension_id = *v8::String::Utf8Value(args[0]->ToString()); 26 std::string extension_id = *v8::String::Utf8Value(args[0]->ToString());
28 CHECK(!extension_id.empty()); 27 CHECK(!extension_id.empty());
29 const Extension* extension = 28 const Extension* extension =
30 self->dispatcher_->extensions()->GetByID(extension_id); 29 self->dispatcher_->extensions()->GetByID(extension_id);
31 CHECK(extension); 30 CHECK(extension);
32 31
33 v8::Local<v8::Array> page_action_vector = v8::Array::New(); 32 v8::Local<v8::Array> page_action_vector = v8::Array::New();
34 if (extension->page_action()) { 33 if (extension->page_action()) {
35 std::string id = extension->page_action()->id(); 34 std::string id = extension->page_action()->id;
36 page_action_vector->Set(v8::Integer::New(0), 35 page_action_vector->Set(v8::Integer::New(0),
37 v8::String::New(id.c_str(), id.size())); 36 v8::String::New(id.c_str(), id.size()));
38 } 37 }
39 38
40 return page_action_vector; 39 return page_action_vector;
41 } 40 }
42 41
43 } // extensions 42 } // extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698