Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/frame/RemoteDOMWindow.h" | 6 #include "core/frame/RemoteDOMWindow.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/SerializedScriptValue.h" | 8 #include "bindings/core/v8/SerializedScriptValue.h" |
| 9 #include "core/css/CSSRuleList.h" | 9 #include "core/css/CSSRuleList.h" |
| 10 #include "core/css/CSSStyleDeclaration.h" | 10 #include "core/css/CSSStyleDeclaration.h" |
| 11 #include "core/css/MediaQueryList.h" | 11 #include "core/css/MediaQueryList.h" |
| 12 #include "core/dom/Document.h" | |
| 13 #include "core/frame/Settings.h" | |
| 14 #include "core/page/Page.h" | |
| 15 #include "wtf/MainThread.h" | |
| 12 | 16 |
| 13 namespace blink { | 17 namespace blink { |
| 14 | 18 |
| 15 ExecutionContext* RemoteDOMWindow::executionContext() const | 19 ExecutionContext* RemoteDOMWindow::executionContext() const |
| 16 { | 20 { |
| 17 return nullptr; | 21 return nullptr; |
| 18 } | 22 } |
| 19 | 23 |
| 20 DEFINE_TRACE(RemoteDOMWindow) | 24 DEFINE_TRACE(RemoteDOMWindow) |
| 21 { | 25 { |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 219 void RemoteDOMWindow::focus(ExecutionContext* override) | 223 void RemoteDOMWindow::focus(ExecutionContext* override) |
| 220 { | 224 { |
| 221 // FIXME: Implement. | 225 // FIXME: Implement. |
| 222 } | 226 } |
| 223 | 227 |
| 224 void RemoteDOMWindow::blur() | 228 void RemoteDOMWindow::blur() |
| 225 { | 229 { |
| 226 // FIXME: Implement. | 230 // FIXME: Implement. |
| 227 } | 231 } |
| 228 | 232 |
| 229 void RemoteDOMWindow::close(ExecutionContext* override) | 233 void RemoteDOMWindow::close(ExecutionContext* context) |
| 230 { | 234 { |
| 231 // FIXME: Implement. | 235 if (!frame() || !frame()->isMainFrame()) |
| 236 return; | |
| 237 | |
| 238 Page* page = frame()->page(); | |
| 239 if (!page) | |
| 240 return; | |
| 241 | |
| 242 if (context) { | |
| 243 ASSERT(isMainThread()); | |
| 244 Document* activeDocument = toDocument(context); | |
| 245 if (!activeDocument) | |
| 246 return; | |
| 247 | |
| 248 if (!activeDocument->frame() || !activeDocument->frame()->canNavigate(*f rame())) | |
| 249 return; | |
| 250 } | |
| 251 | |
| 252 Settings* settings = frame()->settings(); | |
| 253 bool allowScriptsToCloseWindows = settings && settings->allowScriptsToCloseW indows(); | |
| 254 | |
| 255 if (!page->openedByDOM() && !allowScriptsToCloseWindows) | |
| 256 return; | |
|
nasko
2015/06/11 00:04:39
Most of the above checks are somewhat redundant be
| |
| 257 | |
| 258 m_frame->close(); | |
| 259 | |
| 260 m_windowIsClosing = true; | |
| 232 } | 261 } |
| 233 | 262 |
| 234 void RemoteDOMWindow::print() | 263 void RemoteDOMWindow::print() |
| 235 { | 264 { |
| 236 ASSERT_NOT_REACHED(); | 265 ASSERT_NOT_REACHED(); |
| 237 } | 266 } |
| 238 | 267 |
| 239 void RemoteDOMWindow::stop() | 268 void RemoteDOMWindow::stop() |
| 240 { | 269 { |
| 241 // FIXME: Implement. | 270 // FIXME: Implement. |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 338 { | 367 { |
| 339 ASSERT_NOT_REACHED(); | 368 ASSERT_NOT_REACHED(); |
| 340 } | 369 } |
| 341 | 370 |
| 342 RemoteDOMWindow::RemoteDOMWindow(RemoteFrame& frame) | 371 RemoteDOMWindow::RemoteDOMWindow(RemoteFrame& frame) |
| 343 : m_frame(&frame) | 372 : m_frame(&frame) |
| 344 { | 373 { |
| 345 } | 374 } |
| 346 | 375 |
| 347 } // namespace blink | 376 } // namespace blink |
| OLD | NEW |