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

Side by Side Diff: mojo/apps/js/bindings/core.cc

Issue 100573003: [Mojo] Move JS bindings out of public (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix header guards 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
« no previous file with comments | « mojo/apps/js/bindings/core.h ('k') | mojo/apps/js/bindings/core_unittests.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "mojo/public/bindings/js/core.h" 5 #include "mojo/apps/js/bindings/core.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "gin/arguments.h" 9 #include "gin/arguments.h"
10 #include "gin/array_buffer.h" 10 #include "gin/array_buffer.h"
11 #include "gin/converter.h" 11 #include "gin/converter.h"
12 #include "gin/dictionary.h" 12 #include "gin/dictionary.h"
13 #include "gin/function_template.h" 13 #include "gin/function_template.h"
14 #include "gin/object_template_builder.h" 14 #include "gin/object_template_builder.h"
15 #include "gin/per_isolate_data.h" 15 #include "gin/per_isolate_data.h"
16 #include "gin/public/wrapper_info.h" 16 #include "gin/public/wrapper_info.h"
17 #include "mojo/public/bindings/js/handle.h" 17 #include "mojo/apps/js/bindings/handle.h"
18 18
19 namespace mojo { 19 namespace mojo {
20 namespace js { 20 namespace js {
21 21
22 namespace { 22 namespace {
23 23
24 gin::Dictionary CreateMessagePipe(const gin::Arguments& args) { 24 gin::Dictionary CreateMessagePipe(const gin::Arguments& args) {
25 MojoHandle handle_0 = MOJO_HANDLE_INVALID; 25 MojoHandle handle_0 = MOJO_HANDLE_INVALID;
26 MojoHandle handle_1 = MOJO_HANDLE_INVALID; 26 MojoHandle handle_1 = MOJO_HANDLE_INVALID;
27 MojoResult result = MojoCreateMessagePipe(&handle_0, &handle_1); 27 MojoResult result = MojoCreateMessagePipe(&handle_0, &handle_1);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 dictionary.Set("result", result); 79 dictionary.Set("result", result);
80 dictionary.Set("buffer", array_buffer); 80 dictionary.Set("buffer", array_buffer);
81 dictionary.Set("handles", handles); 81 dictionary.Set("handles", handles);
82 return dictionary; 82 return dictionary;
83 } 83 }
84 84
85 gin::WrapperInfo g_wrapper_info = { gin::kEmbedderNativeGin }; 85 gin::WrapperInfo g_wrapper_info = { gin::kEmbedderNativeGin };
86 86
87 } // namespace 87 } // namespace
88 88
89 const char Core::kModuleName[] = "mojo/public/bindings/js/core"; 89 const char Core::kModuleName[] = "mojo/apps/js/bindings/core";
90 90
91 v8::Local<v8::ObjectTemplate> Core::GetTemplate(v8::Isolate* isolate) { 91 v8::Local<v8::ObjectTemplate> Core::GetTemplate(v8::Isolate* isolate) {
92 gin::PerIsolateData* data = gin::PerIsolateData::From(isolate); 92 gin::PerIsolateData* data = gin::PerIsolateData::From(isolate);
93 v8::Local<v8::ObjectTemplate> templ = data->GetObjectTemplate( 93 v8::Local<v8::ObjectTemplate> templ = data->GetObjectTemplate(
94 &g_wrapper_info); 94 &g_wrapper_info);
95 95
96 if (templ.IsEmpty()) { 96 if (templ.IsEmpty()) {
97 templ = gin::ObjectTemplateBuilder(isolate) 97 templ = gin::ObjectTemplateBuilder(isolate)
98 .SetMethod("close", mojo::CloseRaw) 98 .SetMethod("close", mojo::CloseRaw)
99 .SetMethod("wait", mojo::Wait) 99 .SetMethod("wait", mojo::Wait)
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 .Build(); 139 .Build();
140 140
141 data->SetObjectTemplate(&g_wrapper_info, templ); 141 data->SetObjectTemplate(&g_wrapper_info, templ);
142 } 142 }
143 143
144 return templ; 144 return templ;
145 } 145 }
146 146
147 } // namespace js 147 } // namespace js
148 } // namespace mojo 148 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/apps/js/bindings/core.h ('k') | mojo/apps/js/bindings/core_unittests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698