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

Side by Side Diff: webkit/pending/DOMWindow.cpp

Issue 2915: Add a new switch: --allow-scripts-to-close-windows.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « webkit/glue/webview_impl.cc ('k') | webkit/pending/Settings.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 /* 1 /*
2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 28 matching lines...) Expand all
39 #include "Frame.h" 39 #include "Frame.h"
40 #include "FrameLoader.h" 40 #include "FrameLoader.h"
41 #include "FrameTree.h" 41 #include "FrameTree.h"
42 #include "FrameView.h" 42 #include "FrameView.h"
43 #include "History.h" 43 #include "History.h"
44 #include "MessageEvent.h" 44 #include "MessageEvent.h"
45 #include "Page.h" 45 #include "Page.h"
46 #include "PlatformScreen.h" 46 #include "PlatformScreen.h"
47 #include "PlatformString.h" 47 #include "PlatformString.h"
48 #include "Screen.h" 48 #include "Screen.h"
49 #include "Settings.h"
49 #include <algorithm> 50 #include <algorithm>
50 #include <wtf/MathExtras.h> 51 #include <wtf/MathExtras.h>
51 52
52 #if ENABLE(DATABASE) 53 #if ENABLE(DATABASE)
53 #include "Database.h" 54 #include "Database.h"
54 #endif 55 #endif
55 56
56 using std::min; 57 using std::min;
57 using std::max; 58 using std::max;
58 59
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 return; 339 return;
339 340
340 m_frame->unfocusWindow(); 341 m_frame->unfocusWindow();
341 } 342 }
342 343
343 void DOMWindow::close() 344 void DOMWindow::close()
344 { 345 {
345 if (!m_frame) 346 if (!m_frame)
346 return; 347 return;
347 348
348 if (m_frame->loader()->openedByDOM() || m_frame->loader()->getHistoryLength( ) <= 1) 349 Settings* settings = m_frame->settings();
350 bool allow_scripts_to_close_windows =
351 (settings && settings->allowScriptsToCloseWindows());
352
353 if (m_frame->loader()->openedByDOM()
354 || m_frame->loader()->getHistoryLength() <= 1
355 || allow_scripts_to_close_windows)
349 m_frame->scheduleClose(); 356 m_frame->scheduleClose();
350 } 357 }
351 358
352 void DOMWindow::print() 359 void DOMWindow::print()
353 { 360 {
354 if (!m_frame) 361 if (!m_frame)
355 return; 362 return;
356 363
357 Page* page = m_frame->page(); 364 Page* page = m_frame->page();
358 if (!page) 365 if (!page)
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 ASSERT(doc); 1006 ASSERT(doc);
1000 if (!doc) 1007 if (!doc)
1001 return 0; 1008 return 0;
1002 1009
1003 return Database::openDatabase(doc, name, version, displayName, estimatedSize , ec); 1010 return Database::openDatabase(doc, name, version, displayName, estimatedSize , ec);
1004 } 1011 }
1005 #endif 1012 #endif
1006 1013
1007 1014
1008 } // namespace WebCore 1015 } // namespace WebCore
OLDNEW
« no previous file with comments | « webkit/glue/webview_impl.cc ('k') | webkit/pending/Settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698