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

Side by Side Diff: third_party/WebKit/Source/core/page/WindowFeatures.cpp

Issue 1459603002: Implement the 'noopener' window feature. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nasko Created 5 years, 1 month 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
1 /* 1 /*
2 * Copyright (C) 2000 Harri Porten (porten@kde.org) 2 * Copyright (C) 2000 Harri Porten (porten@kde.org)
3 * Copyright (C) 2006 Jon Shier (jshier@iastate.edu) 3 * Copyright (C) 2006 Jon Shier (jshier@iastate.edu)
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2010 Apple Inc. All rights resev ed. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2010 Apple Inc. All rights resev ed.
5 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public 8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 30 matching lines...) Expand all
41 , xSet(false) 41 , xSet(false)
42 , y(0) 42 , y(0)
43 , ySet(false) 43 , ySet(false)
44 , width(0) 44 , width(0)
45 , widthSet(false) 45 , widthSet(false)
46 , height(0) 46 , height(0)
47 , heightSet(false) 47 , heightSet(false)
48 , resizable(true) 48 , resizable(true)
49 , fullscreen(false) 49 , fullscreen(false)
50 , dialog(false) 50 , dialog(false)
51 , noopener(false)
51 { 52 {
52 /* 53 /*
53 The IE rule is: all features except for channelmode and fullscreen default to YES, but 54 The IE rule is: all features except for channelmode and fullscreen default to YES, but
54 if the user specifies a feature string, all features default to NO. (There is no public 55 if the user specifies a feature string, all features default to NO. (There is no public
55 standard that applies to this method.) 56 standard that applies to this method.)
56 57
57 <http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/open_0.a sp> 58 <http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/open_0.a sp>
58 We always allow a window to be resized, which is consistent with Firefox. 59 We always allow a window to be resized, which is consistent with Firefox.
59 */ 60 */
60 61
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 114
114 // skip to first separator 115 // skip to first separator
115 while (i < length && !isWindowFeaturesSeparator(buffer[i])) 116 while (i < length && !isWindowFeaturesSeparator(buffer[i]))
116 i++; 117 i++;
117 valueEnd = i; 118 valueEnd = i;
118 119
119 ASSERT_WITH_SECURITY_IMPLICATION(i <= length); 120 ASSERT_WITH_SECURITY_IMPLICATION(i <= length);
120 121
121 String keyString(buffer.substring(keyBegin, keyEnd - keyBegin)); 122 String keyString(buffer.substring(keyBegin, keyEnd - keyBegin));
122 String valueString(buffer.substring(valueBegin, valueEnd - valueBegin)); 123 String valueString(buffer.substring(valueBegin, valueEnd - valueBegin));
124
123 setWindowFeature(keyString, valueString); 125 setWindowFeature(keyString, valueString);
124 } 126 }
125 } 127 }
126 128
127 void WindowFeatures::setWindowFeature(const String& keyString, const String& val ueString) 129 void WindowFeatures::setWindowFeature(const String& keyString, const String& val ueString)
128 { 130 {
129 int value; 131 int value;
130 132
131 // Listing a key with no value is shorthand for key=yes 133 // Listing a key with no value is shorthand for key=yes
132 if (valueString.isEmpty() || valueString == "yes") 134 if (valueString.isEmpty() || valueString == "yes")
(...skipping 21 matching lines...) Expand all
154 } else if (keyString == "toolbar") { 156 } else if (keyString == "toolbar") {
155 toolBarVisible = value; 157 toolBarVisible = value;
156 } else if (keyString == "location") { 158 } else if (keyString == "location") {
157 locationBarVisible = value; 159 locationBarVisible = value;
158 } else if (keyString == "status") { 160 } else if (keyString == "status") {
159 statusBarVisible = value; 161 statusBarVisible = value;
160 } else if (keyString == "fullscreen") { 162 } else if (keyString == "fullscreen") {
161 fullscreen = value; 163 fullscreen = value;
162 } else if (keyString == "scrollbars") { 164 } else if (keyString == "scrollbars") {
163 scrollbarsVisible = value; 165 scrollbarsVisible = value;
166 } else if (keyString == "noopener") {
167 noopener = true;
164 } else if (value == 1) { 168 } else if (value == 1) {
165 additionalFeatures.append(keyString); 169 additionalFeatures.append(keyString);
166 } 170 }
167 } 171 }
168 172
169 WindowFeatures::WindowFeatures(const String& dialogFeaturesString, const IntRect & screenAvailableRect) 173 WindowFeatures::WindowFeatures(const String& dialogFeaturesString, const IntRect & screenAvailableRect)
170 : widthSet(true) 174 : widthSet(true)
171 , heightSet(true) 175 , heightSet(true)
172 , menuBarVisible(false) 176 , menuBarVisible(false)
173 , toolBarVisible(false) 177 , toolBarVisible(false)
174 , locationBarVisible(false) 178 , locationBarVisible(false)
175 , fullscreen(false) 179 , fullscreen(false)
176 , dialog(true) 180 , dialog(true)
181 , noopener(false)
177 { 182 {
178 DialogFeaturesMap features; 183 DialogFeaturesMap features;
179 parseDialogFeatures(dialogFeaturesString, features); 184 parseDialogFeatures(dialogFeaturesString, features);
180 185
181 const bool trusted = false; 186 const bool trusted = false;
182 187
183 // The following features from Microsoft's documentation are not implemented : 188 // The following features from Microsoft's documentation are not implemented :
184 // - default font settings 189 // - default font settings
185 // - width, height, left, and top specified in units other than "px" 190 // - width, height, left, and top specified in units other than "px"
186 // - edge (sunken or raised, default is raised) 191 // - edge (sunken or raised, default is raised)
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 if (separatorPosition != kNotFound) { 264 if (separatorPosition != kNotFound) {
260 value = featureString.substring(separatorPosition + 1).stripWhiteSpa ce().lower(); 265 value = featureString.substring(separatorPosition + 1).stripWhiteSpa ce().lower();
261 value = value.left(value.find(' ')); 266 value = value.left(value.find(' '));
262 } 267 }
263 268
264 map.set(key, value); 269 map.set(key, value);
265 } 270 }
266 } 271 }
267 272
268 } // namespace blink 273 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/page/WindowFeatures.h ('k') | third_party/WebKit/Source/core/page/WindowFeaturesTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698