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

Unified Diff: sky/engine/bindings2/builtin_sky.cc

Issue 918333002: Add the c++ code part of bindings2/ (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Updated per earlier reviews Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/engine/bindings2/builtin_sky.h ('k') | sky/engine/bindings2/dart_callback.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/bindings2/builtin_sky.cc
diff --git a/sky/engine/bindings2/builtin_sky.cc b/sky/engine/bindings2/builtin_sky.cc
new file mode 100644
index 0000000000000000000000000000000000000000..570833d53aa62b368d3251c07e6fad28e979f77f
--- /dev/null
+++ b/sky/engine/bindings2/builtin_sky.cc
@@ -0,0 +1,37 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "sky/engine/config.h"
+#include "sky/engine/bindings2/builtin_sky.h"
+
+#include "sky/engine/bindings2/builtin.h"
+#include "sky/engine/core/frame/LocalDOMWindow.h"
+#include "sky/engine/core/script/dom_dart_state.h"
+#include "sky/engine/tonic/dart_error.h"
+
+namespace blink {
+
+BuiltinSky::BuiltinSky(DOMDartState* dart_state) {
+ Builtin::SetNativeResolver(Builtin::kSkyLibrary);
+ library_.Set(dart_state, Builtin::LoadAndCheckLibrary(Builtin::kSkyLibrary));
+}
+
+BuiltinSky::~BuiltinSky() {
+}
+
+void BuiltinSky::InstallWindow(DOMDartState* dart_state) {
+ CHECK(!LogIfError(Dart_SetField(library_.value(),
+ ToDart("window"),
+ ToDart(dart_state->CurrentWindow()))));
+ // TODO(abarth): Retain the document wrapper.
+}
+
+Dart_Handle BuiltinSky::GetClassByName(const char* class_name) {
+ Dart_Handle name_handle = ToDart(class_name);
+ Dart_Handle class_handle = Dart_GetType(library_.value(), name_handle, 0, nullptr);
+ DCHECK(!Dart_IsError(class_handle)) << class_name;
+ return class_handle;
+}
+
+} // namespace blink
« no previous file with comments | « sky/engine/bindings2/builtin_sky.h ('k') | sky/engine/bindings2/dart_callback.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698