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

Side by Side Diff: sky/shell/ui/internals.cc

Issue 1199243003: SkyShell should implement the rest of dart:sky.internals (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "sky/engine/config.h" 5 #include "sky/engine/config.h"
6 #include "sky/shell/ui/internals.h" 6 #include "sky/shell/ui/internals.h"
7 7
8 #include "mojo/public/cpp/application/connect.h" 8 #include "mojo/public/cpp/application/connect.h"
9 #include "mojo/public/cpp/bindings/array.h" 9 #include "mojo/public/cpp/bindings/array.h"
10 #include "services/asset_bundle/asset_unpacker_impl.h" 10 #include "services/asset_bundle/asset_unpacker_impl.h"
11 #include "sky/engine/tonic/dart_builtin.h" 11 #include "sky/engine/tonic/dart_builtin.h"
12 #include "sky/engine/tonic/dart_converter.h" 12 #include "sky/engine/tonic/dart_converter.h"
13 #include "sky/engine/tonic/dart_error.h" 13 #include "sky/engine/tonic/dart_error.h"
14 #include "sky/engine/tonic/dart_state.h" 14 #include "sky/engine/tonic/dart_state.h"
15 15
16 using namespace blink; 16 using namespace blink;
17 17
18 namespace sky { 18 namespace sky {
19 namespace shell { 19 namespace shell {
20 namespace { 20 namespace {
21 21
22 int kInternalsKey = 0; 22 int kInternalsKey = 0;
23 23
24 Internals* GetInternals() { 24 Internals* GetInternals() {
25 DartState* state = DartState::Current(); 25 DartState* state = DartState::Current();
26 return static_cast<Internals*>(state->GetUserData(&kInternalsKey)); 26 return static_cast<Internals*>(state->GetUserData(&kInternalsKey));
27 } 27 }
28 28
29 void ContentAsText(Dart_NativeArguments args) {
30 Dart_SetReturnValue(args, Dart_EmptyString());
31 }
32
33 void NotifyTestComplete(Dart_NativeArguments args) {
34 }
35
36 void RenderTreeAsText(Dart_NativeArguments args) {
37 Dart_SetReturnValue(args, Dart_EmptyString());
38 }
39
40 void TakeShellProxyHandle(Dart_NativeArguments args) {
41 Dart_SetIntegerReturnValue(args, 0);
42 }
43
29 void TakeServicesProvidedByEmbedder(Dart_NativeArguments args) { 44 void TakeServicesProvidedByEmbedder(Dart_NativeArguments args) {
30 Dart_SetIntegerReturnValue( 45 Dart_SetIntegerReturnValue(
31 args, GetInternals()->TakeServicesProvidedByEmbedder().value()); 46 args, GetInternals()->TakeServicesProvidedByEmbedder().value());
32 } 47 }
33 48
49 void TakeServicesProvidedToEmbedder(Dart_NativeArguments args) {
50 Dart_SetIntegerReturnValue(args, 0);
51 }
52
53 void TakeServiceRegistry(Dart_NativeArguments args) {
54 Dart_SetIntegerReturnValue(args, 0);
55 }
56
34 const DartBuiltin::Natives kNativeFunctions[] = { 57 const DartBuiltin::Natives kNativeFunctions[] = {
58 {"contentAsText", ContentAsText, 0},
59 {"notifyTestComplete", NotifyTestComplete, 1},
60 {"renderTreeAsText", RenderTreeAsText, 0},
61 {"takeShellProxyHandle", TakeShellProxyHandle, 0},
35 {"takeServicesProvidedByEmbedder", TakeServicesProvidedByEmbedder, 0}, 62 {"takeServicesProvidedByEmbedder", TakeServicesProvidedByEmbedder, 0},
63 {"takeServicesProvidedToEmbedder", TakeServicesProvidedToEmbedder, 0},
64 {"takeServiceRegistry", TakeServiceRegistry, 0},
36 }; 65 };
37 66
38 const DartBuiltin& GetBuiltin() { 67 const DartBuiltin& GetBuiltin() {
39 static DartBuiltin& builtin = *new DartBuiltin(kNativeFunctions, 68 static DartBuiltin& builtin = *new DartBuiltin(kNativeFunctions,
40 arraysize(kNativeFunctions)); 69 arraysize(kNativeFunctions));
41 return builtin; 70 return builtin;
42 } 71 }
43 72
44 Dart_NativeFunction Resolver(Dart_Handle name, 73 Dart_NativeFunction Resolver(Dart_Handle name,
45 int argument_count, 74 int argument_count,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 mojo::InterfaceRequest<mojo::asset_bundle::AssetUnpacker> request) { 110 mojo::InterfaceRequest<mojo::asset_bundle::AssetUnpacker> request) {
82 new mojo::asset_bundle::AssetUnpackerImpl(request.Pass()); 111 new mojo::asset_bundle::AssetUnpackerImpl(request.Pass());
83 } 112 }
84 113
85 mojo::Handle Internals::TakeServicesProvidedByEmbedder() { 114 mojo::Handle Internals::TakeServicesProvidedByEmbedder() {
86 return service_provider_.PassInterface().PassHandle().release(); 115 return service_provider_.PassInterface().PassHandle().release();
87 } 116 }
88 117
89 } // namespace shell 118 } // namespace shell
90 } // namespace sky 119 } // namespace sky
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698