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

Side by Side Diff: chrome/renderer/content_settings_observer.cc

Issue 10412053: Whitelist unreachable webdata pages for content settings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 8 years, 7 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 | « no previous file | content/public/common/url_constants.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 "chrome/renderer/content_settings_observer.h" 5 #include "chrome/renderer/content_settings_observer.h"
6 6
7 #include "chrome/common/render_messages.h" 7 #include "chrome/common/render_messages.h"
8 #include "chrome/common/url_constants.h" 8 #include "chrome/common/url_constants.h"
9 #include "content/public/renderer/document_state.h" 9 #include "content/public/renderer/document_state.h"
10 #include "content/public/renderer/navigation_state.h" 10 #include "content/public/renderer/navigation_state.h"
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 } 312 }
313 313
314 bool ContentSettingsObserver::IsWhitelistedForContentSettings(WebFrame* frame) { 314 bool ContentSettingsObserver::IsWhitelistedForContentSettings(WebFrame* frame) {
315 return IsWhitelistedForContentSettings(frame->document().securityOrigin(), 315 return IsWhitelistedForContentSettings(frame->document().securityOrigin(),
316 frame->document().url()); 316 frame->document().url());
317 } 317 }
318 318
319 bool ContentSettingsObserver::IsWhitelistedForContentSettings( 319 bool ContentSettingsObserver::IsWhitelistedForContentSettings(
320 const WebSecurityOrigin& origin, 320 const WebSecurityOrigin& origin,
321 const GURL& document_url) { 321 const GURL& document_url) {
322 if (document_url == GURL(content::kUnreachableWebDataURL))
323 return true;
324
322 if (origin.isUnique()) 325 if (origin.isUnique())
323 return false; // Uninitialized document? 326 return false; // Uninitialized document?
324 327
325 if (EqualsASCII(origin.protocol(), chrome::kChromeUIScheme)) 328 if (EqualsASCII(origin.protocol(), chrome::kChromeUIScheme))
326 return true; // Browser UI elements should still work. 329 return true; // Browser UI elements should still work.
327 330
328 if (EqualsASCII(origin.protocol(), chrome::kChromeDevToolsScheme)) 331 if (EqualsASCII(origin.protocol(), chrome::kChromeDevToolsScheme))
329 return true; // DevTools UI elements should still work. 332 return true; // DevTools UI elements should still work.
330 333
331 if (EqualsASCII(origin.protocol(), chrome::kExtensionScheme)) 334 if (EqualsASCII(origin.protocol(), chrome::kExtensionScheme))
332 return true; 335 return true;
333 336
334 if (EqualsASCII(origin.protocol(), chrome::kChromeInternalScheme)) 337 if (EqualsASCII(origin.protocol(), chrome::kChromeInternalScheme))
335 return true; 338 return true;
336 339
337 // If the scheme is ftp: or file:, an empty file name indicates a directory 340 // If the scheme is ftp: or file:, an empty file name indicates a directory
338 // listing, which requires JavaScript to function properly. 341 // listing, which requires JavaScript to function properly.
339 const char* kDirProtocols[] = { chrome::kFtpScheme, chrome::kFileScheme }; 342 const char* kDirProtocols[] = { chrome::kFtpScheme, chrome::kFileScheme };
340 for (size_t i = 0; i < arraysize(kDirProtocols); ++i) { 343 for (size_t i = 0; i < arraysize(kDirProtocols); ++i) {
341 if (EqualsASCII(origin.protocol(), kDirProtocols[i])) { 344 if (EqualsASCII(origin.protocol(), kDirProtocols[i])) {
342 return document_url.SchemeIs(kDirProtocols[i]) && 345 return document_url.SchemeIs(kDirProtocols[i]) &&
343 document_url.ExtractFileName().empty(); 346 document_url.ExtractFileName().empty();
344 } 347 }
345 } 348 }
346 349
347 return false; 350 return false;
348 } 351 }
OLDNEW
« no previous file with comments | « no previous file | content/public/common/url_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698