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

Side by Side Diff: sky/engine/bindings-dart/core/dart/custom/DartLocationCustom.cpp

Issue 918273002: Remove bindings-dart (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2011, Google Inc.
2 // All rights reserved.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are
6 // met:
7 //
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above
11 // copyright notice, this list of conditions and the following disclaimer
12 // in the documentation and/or other materials provided with the
13 // distribution.
14 // * Neither the name of Google Inc. nor the names of its
15 // contributors may be used to endorse or promote products derived from
16 // this software without specific prior written permission.
17 //
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
30 #include "config.h"
31 #include "bindings/core/dart/DartLocation.h"
32
33 #include "bindings/core/dart/DartDOMWrapper.h"
34 #include "bindings/core/dart/DartUtilities.h"
35 #include "core/dom/Document.h"
36 #include "core/frame/LocalFrame.h"
37 #include "core/frame/Location.h"
38
39 namespace blink {
40
41 namespace DartLocationInternal {
42
43 void hrefSetter(Dart_NativeArguments args)
44 {
45 Dart_Handle exception = 0;
46 {
47 Location* receiver = DartDOMWrapper::receiver<Location>(args);
48
49 DartStringAdapter href = DartUtilities::dartToString(args, 1, exception) ;
50 if (exception)
51 goto fail;
52
53 receiver->setHref(DartUtilities::domWindowForCurrentIsolate(), receiver- >frame()->document()->domWindow(), href);
54 return;
55 }
56
57 fail:
58 Dart_ThrowException(exception);
59 ASSERT_NOT_REACHED();
60 }
61
62 void protocolSetter(Dart_NativeArguments args)
63 {
64 Dart_Handle exception = 0;
65 {
66 Location* receiver = DartDOMWrapper::receiver<Location>(args);
67
68 DartStringAdapter protocol = DartUtilities::dartToString(args, 1, except ion);
69 if (exception)
70 goto fail;
71
72 LocalDOMWindow* window = receiver->frame()->document()->domWindow();
73 ASSERT(window == DartUtilities::domWindowForCurrentIsolate());
74 DartExceptionState es;
75 receiver->setProtocol(window, window, protocol, es);
76 if (es.hadException()) {
77 exception = es.toDart(args);
78 goto fail;
79 }
80 return;
81 }
82
83 fail:
84 Dart_ThrowException(exception);
85 ASSERT_NOT_REACHED();
86 }
87
88 void hostSetter(Dart_NativeArguments args)
89 {
90 Dart_Handle exception = 0;
91 {
92 Location* receiver = DartDOMWrapper::receiver<Location>(args);
93
94 DartStringAdapter host = DartUtilities::dartToString(args, 1, exception) ;
95 if (exception)
96 goto fail;
97
98 LocalDOMWindow* window = receiver->frame()->document()->domWindow();
99 ASSERT(window == DartUtilities::domWindowForCurrentIsolate());
100 receiver->setHost(window, window, host);
101 return;
102 }
103
104 fail:
105 Dart_ThrowException(exception);
106 ASSERT_NOT_REACHED();
107 }
108
109 void hostnameSetter(Dart_NativeArguments args)
110 {
111 Dart_Handle exception = 0;
112 {
113 Location* receiver = DartDOMWrapper::receiver<Location>(args);
114
115 DartStringAdapter hostname = DartUtilities::dartToString(args, 1, except ion);
116 if (exception)
117 goto fail;
118
119 LocalDOMWindow* window = receiver->frame()->document()->domWindow();
120 ASSERT(window == DartUtilities::domWindowForCurrentIsolate());
121 receiver->setHostname(window, window, hostname);
122 return;
123 }
124
125 fail:
126 Dart_ThrowException(exception);
127 ASSERT_NOT_REACHED();
128 }
129
130 void portSetter(Dart_NativeArguments args)
131 {
132 Dart_Handle exception = 0;
133 {
134 Location* receiver = DartDOMWrapper::receiver<Location>(args);
135
136 DartStringAdapter port = DartUtilities::dartToString(args, 1, exception) ;
137 if (exception)
138 goto fail;
139
140 LocalDOMWindow* window = receiver->frame()->document()->domWindow();
141 ASSERT(window == DartUtilities::domWindowForCurrentIsolate());
142 receiver->setPort(window, window, port);
143 return;
144 }
145
146 fail:
147 Dart_ThrowException(exception);
148 ASSERT_NOT_REACHED();
149 }
150
151 void pathnameSetter(Dart_NativeArguments args)
152 {
153 Dart_Handle exception = 0;
154 {
155 Location* receiver = DartDOMWrapper::receiver<Location>(args);
156
157 DartStringAdapter pathname = DartUtilities::dartToString(args, 1, except ion);
158 if (exception)
159 goto fail;
160
161 LocalDOMWindow* window = receiver->frame()->document()->domWindow();
162 ASSERT(window == DartUtilities::domWindowForCurrentIsolate());
163 receiver->setPathname(window, window, pathname);
164 return;
165 }
166
167 fail:
168 Dart_ThrowException(exception);
169 ASSERT_NOT_REACHED();
170 }
171
172 void searchSetter(Dart_NativeArguments args)
173 {
174 Dart_Handle exception = 0;
175 {
176 Location* receiver = DartDOMWrapper::receiver<Location>(args);
177
178 DartStringAdapter search = DartUtilities::dartToString(args, 1, exceptio n);
179 if (exception)
180 goto fail;
181
182 LocalDOMWindow* window = receiver->frame()->document()->domWindow();
183 ASSERT(window == DartUtilities::domWindowForCurrentIsolate());
184 receiver->setSearch(window, window, search);
185 return;
186 }
187
188 fail:
189 Dart_ThrowException(exception);
190 ASSERT_NOT_REACHED();
191 }
192
193 void hashSetter(Dart_NativeArguments args)
194 {
195 Dart_Handle exception = 0;
196 {
197 Location* receiver = DartDOMWrapper::receiver<Location>(args);
198 DartStringAdapter hash = DartUtilities::dartToString(args, 1, exception) ;
199 if (exception)
200 goto fail;
201
202 LocalDOMWindow* window = receiver->frame()->document()->domWindow();
203 ASSERT(window == DartUtilities::domWindowForCurrentIsolate());
204 receiver->setHash(window, window, hash);
205 return;
206 }
207
208 fail:
209 Dart_ThrowException(exception);
210 ASSERT_NOT_REACHED();
211 }
212
213 void assignCallback(Dart_NativeArguments args)
214 {
215 Dart_Handle exception = 0;
216 {
217 Location* receiver = DartDOMWrapper::receiver<Location>(args);
218 DartStringAdapter url = DartUtilities::dartToString(args, 1, exception);
219 if (exception)
220 goto fail;
221
222 LocalDOMWindow* window = receiver->frame()->document()->domWindow();
223 ASSERT(window == DartUtilities::domWindowForCurrentIsolate());
224 receiver->assign(window, window, url);
225 return;
226 }
227
228 fail:
229 Dart_ThrowException(exception);
230 ASSERT_NOT_REACHED();
231 }
232
233 void replaceCallback(Dart_NativeArguments args)
234 {
235 Dart_Handle exception = 0;
236 {
237 Location* receiver = DartDOMWrapper::receiver<Location>(args);
238 DartStringAdapter url = DartUtilities::dartToString(args, 1, exception);
239 if (exception)
240 goto fail;
241
242 LocalDOMWindow* window = receiver->frame()->document()->domWindow();
243 ASSERT(window == DartUtilities::domWindowForCurrentIsolate());
244 receiver->replace(window, window, url);
245 return;
246 }
247
248 fail:
249 Dart_ThrowException(exception);
250 ASSERT_NOT_REACHED();
251 }
252
253 void reloadCallback(Dart_NativeArguments args)
254 {
255 Location* receiver = DartDOMWrapper::receiver<Location>(args);
256 LocalDOMWindow* window = receiver->frame()->document()->domWindow();
257 ASSERT(window == DartUtilities::domWindowForCurrentIsolate());
258 receiver->reload(window);
259 }
260
261 void toStringCallback(Dart_NativeArguments args)
262 {
263 Location* receiver = DartDOMWrapper::receiver<Location>(args);
264 Dart_SetReturnValue(args, DartUtilities::stringToDart(receiver->href()));
265 }
266
267 void valueOfCallback(Dart_NativeArguments args)
268 {
269 DART_UNIMPLEMENTED();
270 }
271
272 }
273
274 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698