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

Side by Side Diff: content/shell/webkit_test_runner_bindings.cc

Issue 11411282: [content shell] add support for testRunner.canOpenWindows and disallow opening windows per default … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 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 | « content/shell/webkit_test_runner.js ('k') | content/shell/webkit_test_runner_host.h » ('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 (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 "content/shell/webkit_test_runner_bindings.h" 5 #include "content/shell/webkit_test_runner_bindings.h"
6 6
7 #include "base/string_piece.h" 7 #include "base/string_piece.h"
8 #include "content/public/renderer/render_view.h" 8 #include "content/public/renderer/render_view.h"
9 #include "content/shell/shell_messages.h" 9 #include "content/shell/shell_messages.h"
10 #include "content/shell/webkit_test_runner.h" 10 #include "content/shell/webkit_test_runner.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 v8::Handle<v8::Value> NotifyDone(const v8::Arguments& args) { 56 v8::Handle<v8::Value> NotifyDone(const v8::Arguments& args) {
57 RenderView* view = GetCurrentRenderView(); 57 RenderView* view = GetCurrentRenderView();
58 if (!view) 58 if (!view)
59 return v8::Undefined(); 59 return v8::Undefined();
60 60
61 view->Send(new ShellViewHostMsg_NotifyDone(view->GetRoutingID())); 61 view->Send(new ShellViewHostMsg_NotifyDone(view->GetRoutingID()));
62 return v8::Undefined(); 62 return v8::Undefined();
63 } 63 }
64 64
65 v8::Handle<v8::Value> SetCanOpenWindows(const v8::Arguments& args) {
66 RenderView* view = GetCurrentRenderView();
67 if (!view)
68 return v8::Undefined();
69
70 view->Send(new ShellViewHostMsg_CanOpenWindows(view->GetRoutingID()));
71 return v8::Undefined();
72 }
73
65 v8::Handle<v8::Value> SetDumpAsText(const v8::Arguments& args) { 74 v8::Handle<v8::Value> SetDumpAsText(const v8::Arguments& args) {
66 RenderView* view = GetCurrentRenderView(); 75 RenderView* view = GetCurrentRenderView();
67 if (!view) 76 if (!view)
68 return v8::Undefined(); 77 return v8::Undefined();
69 78
70 view->Send(new ShellViewHostMsg_DumpAsText(view->GetRoutingID())); 79 view->Send(new ShellViewHostMsg_DumpAsText(view->GetRoutingID()));
71 return v8::Undefined(); 80 return v8::Undefined();
72 } 81 }
73 82
74 v8::Handle<v8::Value> SetDumpChildFramesAsText(const v8::Arguments& args) { 83 v8::Handle<v8::Value> SetDumpChildFramesAsText(const v8::Arguments& args) {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 175
167 WebKitTestRunnerBindings::~WebKitTestRunnerBindings() { 176 WebKitTestRunnerBindings::~WebKitTestRunnerBindings() {
168 } 177 }
169 178
170 v8::Handle<v8::FunctionTemplate> 179 v8::Handle<v8::FunctionTemplate>
171 WebKitTestRunnerBindings::GetNativeFunction(v8::Handle<v8::String> name) { 180 WebKitTestRunnerBindings::GetNativeFunction(v8::Handle<v8::String> name) {
172 if (name->Equals(v8::String::New("Display"))) 181 if (name->Equals(v8::String::New("Display")))
173 return v8::FunctionTemplate::New(Display); 182 return v8::FunctionTemplate::New(Display);
174 if (name->Equals(v8::String::New("NotifyDone"))) 183 if (name->Equals(v8::String::New("NotifyDone")))
175 return v8::FunctionTemplate::New(NotifyDone); 184 return v8::FunctionTemplate::New(NotifyDone);
185 if (name->Equals(v8::String::New("SetCanOpenWindows")))
186 return v8::FunctionTemplate::New(SetCanOpenWindows);
176 if (name->Equals(v8::String::New("SetDumpAsText"))) 187 if (name->Equals(v8::String::New("SetDumpAsText")))
177 return v8::FunctionTemplate::New(SetDumpAsText); 188 return v8::FunctionTemplate::New(SetDumpAsText);
178 if (name->Equals(v8::String::New("SetDumpChildFramesAsText"))) 189 if (name->Equals(v8::String::New("SetDumpChildFramesAsText")))
179 return v8::FunctionTemplate::New(SetDumpChildFramesAsText); 190 return v8::FunctionTemplate::New(SetDumpChildFramesAsText);
180 if (name->Equals(v8::String::New("SetPrinting"))) 191 if (name->Equals(v8::String::New("SetPrinting")))
181 return v8::FunctionTemplate::New(SetPrinting); 192 return v8::FunctionTemplate::New(SetPrinting);
182 if (name->Equals(v8::String::New( 193 if (name->Equals(v8::String::New(
183 "SetShouldStayOnPageAfterHandlingBeforeUnload"))) { 194 "SetShouldStayOnPageAfterHandlingBeforeUnload"))) {
184 return v8::FunctionTemplate::New( 195 return v8::FunctionTemplate::New(
185 SetShouldStayOnPageAfterHandlingBeforeUnload); 196 SetShouldStayOnPageAfterHandlingBeforeUnload);
186 } 197 }
187 if (name->Equals(v8::String::New("SetWaitUntilDone"))) 198 if (name->Equals(v8::String::New("SetWaitUntilDone")))
188 return v8::FunctionTemplate::New(SetWaitUntilDone); 199 return v8::FunctionTemplate::New(SetWaitUntilDone);
189 if (name->Equals(v8::String::New("SetXSSAuditorEnabled"))) 200 if (name->Equals(v8::String::New("SetXSSAuditorEnabled")))
190 return v8::FunctionTemplate::New(SetXSSAuditorEnabled); 201 return v8::FunctionTemplate::New(SetXSSAuditorEnabled);
191 if (name->Equals(v8::String::New("GetWorkerThreadCount"))) 202 if (name->Equals(v8::String::New("GetWorkerThreadCount")))
192 return v8::FunctionTemplate::New(GetWorkerThreadCount); 203 return v8::FunctionTemplate::New(GetWorkerThreadCount);
193 if (name->Equals(v8::String::New("NotImplemented"))) 204 if (name->Equals(v8::String::New("NotImplemented")))
194 return v8::FunctionTemplate::New(NotImplemented); 205 return v8::FunctionTemplate::New(NotImplemented);
195 206
196 NOTREACHED(); 207 NOTREACHED();
197 return v8::FunctionTemplate::New(); 208 return v8::FunctionTemplate::New();
198 } 209 }
199 210
200 } // namespace content 211 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/webkit_test_runner.js ('k') | content/shell/webkit_test_runner_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698